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

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

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

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

#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_235583_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235583_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235583_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235583_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235583_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235583_total_iter;
    int64_t *futhark_mc_segred_task_235580_total_runtime;
    int *futhark_mc_segred_task_235580_runs;
    int64_t *futhark_mc_segred_task_235580_iter;
    int64_t futhark_mc_segred_task_235580_total_time;
    int64_t futhark_mc_segred_task_235580_total_iter;
    int64_t *futhark_mc_segmap_parloop_235593_total_runtime;
    int *futhark_mc_segmap_parloop_235593_runs;
    int64_t *futhark_mc_segmap_parloop_235593_iter;
    int64_t futhark_mc_segmap_parloop_235593_total_total_runtime;
    int futhark_mc_segmap_parloop_235593_total_runs;
    int64_t futhark_mc_segmap_parloop_235593_total_iter;
    int64_t *futhark_mc_segmap_task_235591_total_runtime;
    int *futhark_mc_segmap_task_235591_runs;
    int64_t *futhark_mc_segmap_task_235591_iter;
    int64_t futhark_mc_segmap_task_235591_total_time;
    int64_t futhark_mc_segmap_task_235591_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235598_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235598_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235598_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235598_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235598_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235598_total_iter;
    int64_t *futhark_mc_segred_task_235595_total_runtime;
    int *futhark_mc_segred_task_235595_runs;
    int64_t *futhark_mc_segred_task_235595_iter;
    int64_t futhark_mc_segred_task_235595_total_time;
    int64_t futhark_mc_segred_task_235595_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235588_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235588_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235588_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235588_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235588_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235588_total_iter;
    int64_t *futhark_mc_segred_nested_task_235585_total_runtime;
    int *futhark_mc_segred_nested_task_235585_runs;
    int64_t *futhark_mc_segred_nested_task_235585_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_235578_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_235578_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_235578_iter;
    int64_t futhark_mc_scan_stage_1_parloop_235578_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_235578_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_235578_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235603_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235603_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235603_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235603_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235603_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235603_total_iter;
    int64_t *futhark_mc_segred_task_235600_total_runtime;
    int *futhark_mc_segred_task_235600_runs;
    int64_t *futhark_mc_segred_task_235600_iter;
    int64_t futhark_mc_segred_task_235600_total_time;
    int64_t futhark_mc_segred_task_235600_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_segred_stage_1_parloop_235618_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235618_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235618_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235618_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235618_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235618_total_iter;
    int64_t *futhark_mc_segred_task_235615_total_runtime;
    int *futhark_mc_segred_task_235615_runs;
    int64_t *futhark_mc_segred_task_235615_iter;
    int64_t futhark_mc_segred_task_235615_total_time;
    int64_t futhark_mc_segred_task_235615_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235608_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235608_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235608_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235608_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235608_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235608_total_iter;
    int64_t *futhark_mc_segred_nested_task_235605_total_runtime;
    int *futhark_mc_segred_nested_task_235605_runs;
    int64_t *futhark_mc_segred_nested_task_235605_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235625_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235625_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235625_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235625_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235625_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235625_total_iter;
    int64_t *futhark_mc_segred_task_235622_total_runtime;
    int *futhark_mc_segred_task_235622_runs;
    int64_t *futhark_mc_segred_task_235622_iter;
    int64_t futhark_mc_segred_task_235622_total_time;
    int64_t futhark_mc_segred_task_235622_total_iter;
    int64_t *futhark_mc_segmap_parloop_235635_total_runtime;
    int *futhark_mc_segmap_parloop_235635_runs;
    int64_t *futhark_mc_segmap_parloop_235635_iter;
    int64_t futhark_mc_segmap_parloop_235635_total_total_runtime;
    int futhark_mc_segmap_parloop_235635_total_runs;
    int64_t futhark_mc_segmap_parloop_235635_total_iter;
    int64_t *futhark_mc_segmap_task_235633_total_runtime;
    int *futhark_mc_segmap_task_235633_runs;
    int64_t *futhark_mc_segmap_task_235633_iter;
    int64_t futhark_mc_segmap_task_235633_total_time;
    int64_t futhark_mc_segmap_task_235633_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235640_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235640_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235640_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235640_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235640_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235640_total_iter;
    int64_t *futhark_mc_segred_task_235637_total_runtime;
    int *futhark_mc_segred_task_235637_runs;
    int64_t *futhark_mc_segred_task_235637_iter;
    int64_t futhark_mc_segred_task_235637_total_time;
    int64_t futhark_mc_segred_task_235637_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235630_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235630_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235630_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235630_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235630_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235630_total_iter;
    int64_t *futhark_mc_segred_nested_task_235627_total_runtime;
    int *futhark_mc_segred_nested_task_235627_runs;
    int64_t *futhark_mc_segred_nested_task_235627_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_235620_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_235620_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_235620_iter;
    int64_t futhark_mc_scan_stage_3_parloop_235620_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_235620_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_235620_total_iter;
    int64_t *futhark_mc_segscan_task_235575_total_runtime;
    int *futhark_mc_segscan_task_235575_runs;
    int64_t *futhark_mc_segscan_task_235575_iter;
    int64_t futhark_mc_segscan_task_235575_total_time;
    int64_t futhark_mc_segscan_task_235575_total_iter;
    int64_t *futhark_mc_segmap_parloop_235644_total_runtime;
    int *futhark_mc_segmap_parloop_235644_runs;
    int64_t *futhark_mc_segmap_parloop_235644_iter;
    int64_t futhark_mc_segmap_parloop_235644_total_total_runtime;
    int futhark_mc_segmap_parloop_235644_total_runs;
    int64_t futhark_mc_segmap_parloop_235644_total_iter;
    int64_t *futhark_mc_segmap_task_235642_total_runtime;
    int *futhark_mc_segmap_task_235642_runs;
    int64_t *futhark_mc_segmap_task_235642_iter;
    int64_t futhark_mc_segmap_task_235642_total_time;
    int64_t futhark_mc_segmap_task_235642_total_iter;
    int64_t *futhark_mc_segmap_parloop_235648_total_runtime;
    int *futhark_mc_segmap_parloop_235648_runs;
    int64_t *futhark_mc_segmap_parloop_235648_iter;
    int64_t futhark_mc_segmap_parloop_235648_total_total_runtime;
    int futhark_mc_segmap_parloop_235648_total_runs;
    int64_t futhark_mc_segmap_parloop_235648_total_iter;
    int64_t *futhark_mc_segmap_task_235646_total_runtime;
    int *futhark_mc_segmap_task_235646_runs;
    int64_t *futhark_mc_segmap_task_235646_iter;
    int64_t futhark_mc_segmap_task_235646_total_time;
    int64_t futhark_mc_segmap_task_235646_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_235660_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_235660_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_235660_iter;
    int64_t futhark_mc_scan_stage_1_parloop_235660_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_235660_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_235660_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_235662_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_235662_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_235662_iter;
    int64_t futhark_mc_scan_stage_3_parloop_235662_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_235662_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_235662_total_iter;
    int64_t *futhark_mc_segscan_task_235657_total_runtime;
    int *futhark_mc_segscan_task_235657_runs;
    int64_t *futhark_mc_segscan_task_235657_iter;
    int64_t futhark_mc_segscan_task_235657_total_time;
    int64_t futhark_mc_segscan_task_235657_total_iter;
    int64_t *futhark_mc_segmap_parloop_235666_total_runtime;
    int *futhark_mc_segmap_parloop_235666_runs;
    int64_t *futhark_mc_segmap_parloop_235666_iter;
    int64_t futhark_mc_segmap_parloop_235666_total_total_runtime;
    int futhark_mc_segmap_parloop_235666_total_runs;
    int64_t futhark_mc_segmap_parloop_235666_total_iter;
    int64_t *futhark_mc_segmap_task_235664_total_runtime;
    int *futhark_mc_segmap_task_235664_runs;
    int64_t *futhark_mc_segmap_task_235664_iter;
    int64_t futhark_mc_segmap_task_235664_total_time;
    int64_t futhark_mc_segmap_task_235664_total_iter;
    int64_t *futhark_mc_segmap_parloop_235653_total_runtime;
    int *futhark_mc_segmap_parloop_235653_runs;
    int64_t *futhark_mc_segmap_parloop_235653_iter;
    int64_t futhark_mc_segmap_parloop_235653_total_total_runtime;
    int futhark_mc_segmap_parloop_235653_total_runs;
    int64_t futhark_mc_segmap_parloop_235653_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235651_total_runtime;
    int *futhark_mc_segmap_nested_task_235651_runs;
    int64_t *futhark_mc_segmap_nested_task_235651_iter;
    int64_t *futhark_mc_segmap_parloop_235670_total_runtime;
    int *futhark_mc_segmap_parloop_235670_runs;
    int64_t *futhark_mc_segmap_parloop_235670_iter;
    int64_t futhark_mc_segmap_parloop_235670_total_total_runtime;
    int futhark_mc_segmap_parloop_235670_total_runs;
    int64_t futhark_mc_segmap_parloop_235670_total_iter;
    int64_t *futhark_mc_segmap_task_235668_total_runtime;
    int *futhark_mc_segmap_task_235668_runs;
    int64_t *futhark_mc_segmap_task_235668_iter;
    int64_t futhark_mc_segmap_task_235668_total_time;
    int64_t futhark_mc_segmap_task_235668_total_iter;
    int64_t *futhark_mc_segmap_parloop_235679_total_runtime;
    int *futhark_mc_segmap_parloop_235679_runs;
    int64_t *futhark_mc_segmap_parloop_235679_iter;
    int64_t futhark_mc_segmap_parloop_235679_total_total_runtime;
    int futhark_mc_segmap_parloop_235679_total_runs;
    int64_t futhark_mc_segmap_parloop_235679_total_iter;
    int64_t *futhark_mc_segmap_task_235677_total_runtime;
    int *futhark_mc_segmap_task_235677_runs;
    int64_t *futhark_mc_segmap_task_235677_iter;
    int64_t futhark_mc_segmap_task_235677_total_time;
    int64_t futhark_mc_segmap_task_235677_total_iter;
    int64_t *futhark_mc_segmap_parloop_235688_total_runtime;
    int *futhark_mc_segmap_parloop_235688_runs;
    int64_t *futhark_mc_segmap_parloop_235688_iter;
    int64_t futhark_mc_segmap_parloop_235688_total_total_runtime;
    int futhark_mc_segmap_parloop_235688_total_runs;
    int64_t futhark_mc_segmap_parloop_235688_total_iter;
    int64_t *futhark_mc_segmap_task_235686_total_runtime;
    int *futhark_mc_segmap_task_235686_runs;
    int64_t *futhark_mc_segmap_task_235686_iter;
    int64_t futhark_mc_segmap_task_235686_total_time;
    int64_t futhark_mc_segmap_task_235686_total_iter;
    int64_t *futhark_mc_segmap_parloop_235683_total_runtime;
    int *futhark_mc_segmap_parloop_235683_runs;
    int64_t *futhark_mc_segmap_parloop_235683_iter;
    int64_t futhark_mc_segmap_parloop_235683_total_total_runtime;
    int futhark_mc_segmap_parloop_235683_total_runs;
    int64_t futhark_mc_segmap_parloop_235683_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235681_total_runtime;
    int *futhark_mc_segmap_nested_task_235681_runs;
    int64_t *futhark_mc_segmap_nested_task_235681_iter;
    int64_t *futhark_mc_segmap_parloop_235674_total_runtime;
    int *futhark_mc_segmap_parloop_235674_runs;
    int64_t *futhark_mc_segmap_parloop_235674_iter;
    int64_t futhark_mc_segmap_parloop_235674_total_total_runtime;
    int futhark_mc_segmap_parloop_235674_total_runs;
    int64_t futhark_mc_segmap_parloop_235674_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235672_total_runtime;
    int *futhark_mc_segmap_nested_task_235672_runs;
    int64_t *futhark_mc_segmap_nested_task_235672_iter;
    int64_t *futhark_mc_segmap_parloop_235692_total_runtime;
    int *futhark_mc_segmap_parloop_235692_runs;
    int64_t *futhark_mc_segmap_parloop_235692_iter;
    int64_t futhark_mc_segmap_parloop_235692_total_total_runtime;
    int futhark_mc_segmap_parloop_235692_total_runs;
    int64_t futhark_mc_segmap_parloop_235692_total_iter;
    int64_t *futhark_mc_segmap_task_235690_total_runtime;
    int *futhark_mc_segmap_task_235690_runs;
    int64_t *futhark_mc_segmap_task_235690_iter;
    int64_t futhark_mc_segmap_task_235690_total_time;
    int64_t futhark_mc_segmap_task_235690_total_iter;
    int64_t *futhark_mc_segmap_parloop_235705_total_runtime;
    int *futhark_mc_segmap_parloop_235705_runs;
    int64_t *futhark_mc_segmap_parloop_235705_iter;
    int64_t futhark_mc_segmap_parloop_235705_total_total_runtime;
    int futhark_mc_segmap_parloop_235705_total_runs;
    int64_t futhark_mc_segmap_parloop_235705_total_iter;
    int64_t *futhark_mc_segmap_task_235703_total_runtime;
    int *futhark_mc_segmap_task_235703_runs;
    int64_t *futhark_mc_segmap_task_235703_iter;
    int64_t futhark_mc_segmap_task_235703_total_time;
    int64_t futhark_mc_segmap_task_235703_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_235717_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_235717_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_235717_iter;
    int64_t futhark_mc_scan_stage_1_parloop_235717_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_235717_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_235717_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_235719_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_235719_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_235719_iter;
    int64_t futhark_mc_scan_stage_3_parloop_235719_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_235719_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_235719_total_iter;
    int64_t *futhark_mc_segscan_task_235714_total_runtime;
    int *futhark_mc_segscan_task_235714_runs;
    int64_t *futhark_mc_segscan_task_235714_iter;
    int64_t futhark_mc_segscan_task_235714_total_time;
    int64_t futhark_mc_segscan_task_235714_total_iter;
    int64_t *futhark_mc_segmap_parloop_235723_total_runtime;
    int *futhark_mc_segmap_parloop_235723_runs;
    int64_t *futhark_mc_segmap_parloop_235723_iter;
    int64_t futhark_mc_segmap_parloop_235723_total_total_runtime;
    int futhark_mc_segmap_parloop_235723_total_runs;
    int64_t futhark_mc_segmap_parloop_235723_total_iter;
    int64_t *futhark_mc_segmap_task_235721_total_runtime;
    int *futhark_mc_segmap_task_235721_runs;
    int64_t *futhark_mc_segmap_task_235721_iter;
    int64_t futhark_mc_segmap_task_235721_total_time;
    int64_t futhark_mc_segmap_task_235721_total_iter;
    int64_t *futhark_mc_segmap_parloop_235710_total_runtime;
    int *futhark_mc_segmap_parloop_235710_runs;
    int64_t *futhark_mc_segmap_parloop_235710_iter;
    int64_t futhark_mc_segmap_parloop_235710_total_total_runtime;
    int futhark_mc_segmap_parloop_235710_total_runs;
    int64_t futhark_mc_segmap_parloop_235710_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235708_total_runtime;
    int *futhark_mc_segmap_nested_task_235708_runs;
    int64_t *futhark_mc_segmap_nested_task_235708_iter;
    int64_t *futhark_mc_segmap_parloop_235699_total_runtime;
    int *futhark_mc_segmap_parloop_235699_runs;
    int64_t *futhark_mc_segmap_parloop_235699_iter;
    int64_t futhark_mc_segmap_parloop_235699_total_total_runtime;
    int futhark_mc_segmap_parloop_235699_total_runs;
    int64_t futhark_mc_segmap_parloop_235699_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235697_total_runtime;
    int *futhark_mc_segmap_nested_task_235697_runs;
    int64_t *futhark_mc_segmap_nested_task_235697_iter;
    int64_t *futhark_mc_segmap_parloop_235727_total_runtime;
    int *futhark_mc_segmap_parloop_235727_runs;
    int64_t *futhark_mc_segmap_parloop_235727_iter;
    int64_t futhark_mc_segmap_parloop_235727_total_total_runtime;
    int futhark_mc_segmap_parloop_235727_total_runs;
    int64_t futhark_mc_segmap_parloop_235727_total_iter;
    int64_t *futhark_mc_segmap_task_235725_total_runtime;
    int *futhark_mc_segmap_task_235725_runs;
    int64_t *futhark_mc_segmap_task_235725_iter;
    int64_t futhark_mc_segmap_task_235725_total_time;
    int64_t futhark_mc_segmap_task_235725_total_iter;
    int64_t *futhark_mc_segmap_parloop_235739_total_runtime;
    int *futhark_mc_segmap_parloop_235739_runs;
    int64_t *futhark_mc_segmap_parloop_235739_iter;
    int64_t futhark_mc_segmap_parloop_235739_total_total_runtime;
    int futhark_mc_segmap_parloop_235739_total_runs;
    int64_t futhark_mc_segmap_parloop_235739_total_iter;
    int64_t *futhark_mc_segmap_task_235737_total_runtime;
    int *futhark_mc_segmap_task_235737_runs;
    int64_t *futhark_mc_segmap_task_235737_iter;
    int64_t futhark_mc_segmap_task_235737_total_time;
    int64_t futhark_mc_segmap_task_235737_total_iter;
    int64_t *futhark_mc_segmap_parloop_235752_total_runtime;
    int *futhark_mc_segmap_parloop_235752_runs;
    int64_t *futhark_mc_segmap_parloop_235752_iter;
    int64_t futhark_mc_segmap_parloop_235752_total_total_runtime;
    int futhark_mc_segmap_parloop_235752_total_runs;
    int64_t futhark_mc_segmap_parloop_235752_total_iter;
    int64_t *futhark_mc_segmap_task_235750_total_runtime;
    int *futhark_mc_segmap_task_235750_runs;
    int64_t *futhark_mc_segmap_task_235750_iter;
    int64_t futhark_mc_segmap_task_235750_total_time;
    int64_t futhark_mc_segmap_task_235750_total_iter;
    int64_t *futhark_mc_segmap_parloop_235756_total_runtime;
    int *futhark_mc_segmap_parloop_235756_runs;
    int64_t *futhark_mc_segmap_parloop_235756_iter;
    int64_t futhark_mc_segmap_parloop_235756_total_total_runtime;
    int futhark_mc_segmap_parloop_235756_total_runs;
    int64_t futhark_mc_segmap_parloop_235756_total_iter;
    int64_t *futhark_mc_segmap_task_235754_total_runtime;
    int *futhark_mc_segmap_task_235754_runs;
    int64_t *futhark_mc_segmap_task_235754_iter;
    int64_t futhark_mc_segmap_task_235754_total_time;
    int64_t futhark_mc_segmap_task_235754_total_iter;
    int64_t *futhark_mc_segmap_parloop_235745_total_runtime;
    int *futhark_mc_segmap_parloop_235745_runs;
    int64_t *futhark_mc_segmap_parloop_235745_iter;
    int64_t futhark_mc_segmap_parloop_235745_total_total_runtime;
    int futhark_mc_segmap_parloop_235745_total_runs;
    int64_t futhark_mc_segmap_parloop_235745_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235743_total_runtime;
    int *futhark_mc_segmap_nested_task_235743_runs;
    int64_t *futhark_mc_segmap_nested_task_235743_iter;
    int64_t *futhark_mc_segmap_parloop_235733_total_runtime;
    int *futhark_mc_segmap_parloop_235733_runs;
    int64_t *futhark_mc_segmap_parloop_235733_iter;
    int64_t futhark_mc_segmap_parloop_235733_total_total_runtime;
    int futhark_mc_segmap_parloop_235733_total_runs;
    int64_t futhark_mc_segmap_parloop_235733_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235731_total_runtime;
    int *futhark_mc_segmap_nested_task_235731_runs;
    int64_t *futhark_mc_segmap_nested_task_235731_iter;
    int64_t *futhark_mc_segmap_parloop_235760_total_runtime;
    int *futhark_mc_segmap_parloop_235760_runs;
    int64_t *futhark_mc_segmap_parloop_235760_iter;
    int64_t futhark_mc_segmap_parloop_235760_total_total_runtime;
    int futhark_mc_segmap_parloop_235760_total_runs;
    int64_t futhark_mc_segmap_parloop_235760_total_iter;
    int64_t *futhark_mc_segmap_task_235758_total_runtime;
    int *futhark_mc_segmap_task_235758_runs;
    int64_t *futhark_mc_segmap_task_235758_iter;
    int64_t futhark_mc_segmap_task_235758_total_time;
    int64_t futhark_mc_segmap_task_235758_total_iter;
    int64_t *futhark_mc_segmap_parloop_235773_total_runtime;
    int *futhark_mc_segmap_parloop_235773_runs;
    int64_t *futhark_mc_segmap_parloop_235773_iter;
    int64_t futhark_mc_segmap_parloop_235773_total_total_runtime;
    int futhark_mc_segmap_parloop_235773_total_runs;
    int64_t futhark_mc_segmap_parloop_235773_total_iter;
    int64_t *futhark_mc_segmap_task_235771_total_runtime;
    int *futhark_mc_segmap_task_235771_runs;
    int64_t *futhark_mc_segmap_task_235771_iter;
    int64_t futhark_mc_segmap_task_235771_total_time;
    int64_t futhark_mc_segmap_task_235771_total_iter;
    int64_t *futhark_mc_segmap_parloop_235777_total_runtime;
    int *futhark_mc_segmap_parloop_235777_runs;
    int64_t *futhark_mc_segmap_parloop_235777_iter;
    int64_t futhark_mc_segmap_parloop_235777_total_total_runtime;
    int futhark_mc_segmap_parloop_235777_total_runs;
    int64_t futhark_mc_segmap_parloop_235777_total_iter;
    int64_t *futhark_mc_segmap_task_235775_total_runtime;
    int *futhark_mc_segmap_task_235775_runs;
    int64_t *futhark_mc_segmap_task_235775_iter;
    int64_t futhark_mc_segmap_task_235775_total_time;
    int64_t futhark_mc_segmap_task_235775_total_iter;
    int64_t *futhark_mc_segmap_parloop_235766_total_runtime;
    int *futhark_mc_segmap_parloop_235766_runs;
    int64_t *futhark_mc_segmap_parloop_235766_iter;
    int64_t futhark_mc_segmap_parloop_235766_total_total_runtime;
    int futhark_mc_segmap_parloop_235766_total_runs;
    int64_t futhark_mc_segmap_parloop_235766_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235764_total_runtime;
    int *futhark_mc_segmap_nested_task_235764_runs;
    int64_t *futhark_mc_segmap_nested_task_235764_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_235794_total_runtime;
    int *futhark_mc_segmap_parloop_235794_runs;
    int64_t *futhark_mc_segmap_parloop_235794_iter;
    int64_t futhark_mc_segmap_parloop_235794_total_total_runtime;
    int futhark_mc_segmap_parloop_235794_total_runs;
    int64_t futhark_mc_segmap_parloop_235794_total_iter;
    int64_t *futhark_mc_segmap_task_235792_total_runtime;
    int *futhark_mc_segmap_task_235792_runs;
    int64_t *futhark_mc_segmap_task_235792_iter;
    int64_t futhark_mc_segmap_task_235792_total_time;
    int64_t futhark_mc_segmap_task_235792_total_iter;
    int64_t *futhark_mc_segmap_parloop_235798_total_runtime;
    int *futhark_mc_segmap_parloop_235798_runs;
    int64_t *futhark_mc_segmap_parloop_235798_iter;
    int64_t futhark_mc_segmap_parloop_235798_total_total_runtime;
    int futhark_mc_segmap_parloop_235798_total_runs;
    int64_t futhark_mc_segmap_parloop_235798_total_iter;
    int64_t *futhark_mc_segmap_task_235796_total_runtime;
    int *futhark_mc_segmap_task_235796_runs;
    int64_t *futhark_mc_segmap_task_235796_iter;
    int64_t futhark_mc_segmap_task_235796_total_time;
    int64_t futhark_mc_segmap_task_235796_total_iter;
    int64_t *futhark_mc_segmap_parloop_235787_total_runtime;
    int *futhark_mc_segmap_parloop_235787_runs;
    int64_t *futhark_mc_segmap_parloop_235787_iter;
    int64_t futhark_mc_segmap_parloop_235787_total_total_runtime;
    int futhark_mc_segmap_parloop_235787_total_runs;
    int64_t futhark_mc_segmap_parloop_235787_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235785_total_runtime;
    int *futhark_mc_segmap_nested_task_235785_runs;
    int64_t *futhark_mc_segmap_nested_task_235785_iter;
    int64_t *futhark_mc_segmap_parloop_235802_total_runtime;
    int *futhark_mc_segmap_parloop_235802_runs;
    int64_t *futhark_mc_segmap_parloop_235802_iter;
    int64_t futhark_mc_segmap_parloop_235802_total_total_runtime;
    int futhark_mc_segmap_parloop_235802_total_runs;
    int64_t futhark_mc_segmap_parloop_235802_total_iter;
    int64_t *futhark_mc_segmap_task_235800_total_runtime;
    int *futhark_mc_segmap_task_235800_runs;
    int64_t *futhark_mc_segmap_task_235800_iter;
    int64_t futhark_mc_segmap_task_235800_total_time;
    int64_t futhark_mc_segmap_task_235800_total_iter;
    int64_t *futhark_mc_segmap_parloop_235811_total_runtime;
    int *futhark_mc_segmap_parloop_235811_runs;
    int64_t *futhark_mc_segmap_parloop_235811_iter;
    int64_t futhark_mc_segmap_parloop_235811_total_total_runtime;
    int futhark_mc_segmap_parloop_235811_total_runs;
    int64_t futhark_mc_segmap_parloop_235811_total_iter;
    int64_t *futhark_mc_segmap_task_235809_total_runtime;
    int *futhark_mc_segmap_task_235809_runs;
    int64_t *futhark_mc_segmap_task_235809_iter;
    int64_t futhark_mc_segmap_task_235809_total_time;
    int64_t futhark_mc_segmap_task_235809_total_iter;
    int64_t *futhark_mc_segmap_parloop_235806_total_runtime;
    int *futhark_mc_segmap_parloop_235806_runs;
    int64_t *futhark_mc_segmap_parloop_235806_iter;
    int64_t futhark_mc_segmap_parloop_235806_total_total_runtime;
    int futhark_mc_segmap_parloop_235806_total_runs;
    int64_t futhark_mc_segmap_parloop_235806_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235804_total_runtime;
    int *futhark_mc_segmap_nested_task_235804_runs;
    int64_t *futhark_mc_segmap_nested_task_235804_iter;
    int64_t *futhark_mc_segmap_parloop_235815_total_runtime;
    int *futhark_mc_segmap_parloop_235815_runs;
    int64_t *futhark_mc_segmap_parloop_235815_iter;
    int64_t futhark_mc_segmap_parloop_235815_total_total_runtime;
    int futhark_mc_segmap_parloop_235815_total_runs;
    int64_t futhark_mc_segmap_parloop_235815_total_iter;
    int64_t *futhark_mc_segmap_task_235813_total_runtime;
    int *futhark_mc_segmap_task_235813_runs;
    int64_t *futhark_mc_segmap_task_235813_iter;
    int64_t futhark_mc_segmap_task_235813_total_time;
    int64_t futhark_mc_segmap_task_235813_total_iter;
    int64_t *futhark_mc_segmap_parloop_235826_total_runtime;
    int *futhark_mc_segmap_parloop_235826_runs;
    int64_t *futhark_mc_segmap_parloop_235826_iter;
    int64_t futhark_mc_segmap_parloop_235826_total_total_runtime;
    int futhark_mc_segmap_parloop_235826_total_runs;
    int64_t futhark_mc_segmap_parloop_235826_total_iter;
    int64_t *futhark_mc_segmap_task_235824_total_runtime;
    int *futhark_mc_segmap_task_235824_runs;
    int64_t *futhark_mc_segmap_task_235824_iter;
    int64_t futhark_mc_segmap_task_235824_total_time;
    int64_t futhark_mc_segmap_task_235824_total_iter;
    int64_t *futhark_mc_segmap_parloop_235837_total_runtime;
    int *futhark_mc_segmap_parloop_235837_runs;
    int64_t *futhark_mc_segmap_parloop_235837_iter;
    int64_t futhark_mc_segmap_parloop_235837_total_total_runtime;
    int futhark_mc_segmap_parloop_235837_total_runs;
    int64_t futhark_mc_segmap_parloop_235837_total_iter;
    int64_t *futhark_mc_segmap_task_235835_total_runtime;
    int *futhark_mc_segmap_task_235835_runs;
    int64_t *futhark_mc_segmap_task_235835_iter;
    int64_t futhark_mc_segmap_task_235835_total_time;
    int64_t futhark_mc_segmap_task_235835_total_iter;
    int64_t *futhark_mc_segmap_parloop_235831_total_runtime;
    int *futhark_mc_segmap_parloop_235831_runs;
    int64_t *futhark_mc_segmap_parloop_235831_iter;
    int64_t futhark_mc_segmap_parloop_235831_total_total_runtime;
    int futhark_mc_segmap_parloop_235831_total_runs;
    int64_t futhark_mc_segmap_parloop_235831_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235829_total_runtime;
    int *futhark_mc_segmap_nested_task_235829_runs;
    int64_t *futhark_mc_segmap_nested_task_235829_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_nested_task_235818_total_runtime;
    int *futhark_mc_segmap_nested_task_235818_runs;
    int64_t *futhark_mc_segmap_nested_task_235818_iter;
    int64_t *futhark_mc_segmap_parloop_235841_total_runtime;
    int *futhark_mc_segmap_parloop_235841_runs;
    int64_t *futhark_mc_segmap_parloop_235841_iter;
    int64_t futhark_mc_segmap_parloop_235841_total_total_runtime;
    int futhark_mc_segmap_parloop_235841_total_runs;
    int64_t futhark_mc_segmap_parloop_235841_total_iter;
    int64_t *futhark_mc_segmap_task_235839_total_runtime;
    int *futhark_mc_segmap_task_235839_runs;
    int64_t *futhark_mc_segmap_task_235839_iter;
    int64_t futhark_mc_segmap_task_235839_total_time;
    int64_t futhark_mc_segmap_task_235839_total_iter;
    int64_t *futhark_mc_segmap_parloop_235850_total_runtime;
    int *futhark_mc_segmap_parloop_235850_runs;
    int64_t *futhark_mc_segmap_parloop_235850_iter;
    int64_t futhark_mc_segmap_parloop_235850_total_total_runtime;
    int futhark_mc_segmap_parloop_235850_total_runs;
    int64_t futhark_mc_segmap_parloop_235850_total_iter;
    int64_t *futhark_mc_segmap_task_235848_total_runtime;
    int *futhark_mc_segmap_task_235848_runs;
    int64_t *futhark_mc_segmap_task_235848_iter;
    int64_t futhark_mc_segmap_task_235848_total_time;
    int64_t futhark_mc_segmap_task_235848_total_iter;
    int64_t *futhark_mc_segmap_parloop_235859_total_runtime;
    int *futhark_mc_segmap_parloop_235859_runs;
    int64_t *futhark_mc_segmap_parloop_235859_iter;
    int64_t futhark_mc_segmap_parloop_235859_total_total_runtime;
    int futhark_mc_segmap_parloop_235859_total_runs;
    int64_t futhark_mc_segmap_parloop_235859_total_iter;
    int64_t *futhark_mc_segmap_task_235857_total_runtime;
    int *futhark_mc_segmap_task_235857_runs;
    int64_t *futhark_mc_segmap_task_235857_iter;
    int64_t futhark_mc_segmap_task_235857_total_time;
    int64_t futhark_mc_segmap_task_235857_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235867_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235867_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235867_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235867_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235867_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235867_total_iter;
    int64_t *futhark_mc_segred_task_235864_total_runtime;
    int *futhark_mc_segred_task_235864_runs;
    int64_t *futhark_mc_segred_task_235864_iter;
    int64_t futhark_mc_segred_task_235864_total_time;
    int64_t futhark_mc_segred_task_235864_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235872_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235872_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235872_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235872_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235872_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235872_total_iter;
    int64_t *futhark_mc_segred_task_235869_total_runtime;
    int *futhark_mc_segred_task_235869_runs;
    int64_t *futhark_mc_segred_task_235869_iter;
    int64_t futhark_mc_segred_task_235869_total_time;
    int64_t futhark_mc_segred_task_235869_total_iter;
    int64_t *futhark_mc_segmap_parloop_235862_total_runtime;
    int *futhark_mc_segmap_parloop_235862_runs;
    int64_t *futhark_mc_segmap_parloop_235862_iter;
    int64_t futhark_mc_segmap_parloop_235862_total_total_runtime;
    int futhark_mc_segmap_parloop_235862_total_runs;
    int64_t futhark_mc_segmap_parloop_235862_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235860_total_runtime;
    int *futhark_mc_segmap_nested_task_235860_runs;
    int64_t *futhark_mc_segmap_nested_task_235860_iter;
    int64_t *futhark_mc_segmap_parloop_235854_total_runtime;
    int *futhark_mc_segmap_parloop_235854_runs;
    int64_t *futhark_mc_segmap_parloop_235854_iter;
    int64_t futhark_mc_segmap_parloop_235854_total_total_runtime;
    int futhark_mc_segmap_parloop_235854_total_runs;
    int64_t futhark_mc_segmap_parloop_235854_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235852_total_runtime;
    int *futhark_mc_segmap_nested_task_235852_runs;
    int64_t *futhark_mc_segmap_nested_task_235852_iter;
    int64_t *futhark_mc_segmap_parloop_235845_total_runtime;
    int *futhark_mc_segmap_parloop_235845_runs;
    int64_t *futhark_mc_segmap_parloop_235845_iter;
    int64_t futhark_mc_segmap_parloop_235845_total_total_runtime;
    int futhark_mc_segmap_parloop_235845_total_runs;
    int64_t futhark_mc_segmap_parloop_235845_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235843_total_runtime;
    int *futhark_mc_segmap_nested_task_235843_runs;
    int64_t *futhark_mc_segmap_nested_task_235843_iter;
    int64_t *futhark_mc_segmap_parloop_235876_total_runtime;
    int *futhark_mc_segmap_parloop_235876_runs;
    int64_t *futhark_mc_segmap_parloop_235876_iter;
    int64_t futhark_mc_segmap_parloop_235876_total_total_runtime;
    int futhark_mc_segmap_parloop_235876_total_runs;
    int64_t futhark_mc_segmap_parloop_235876_total_iter;
    int64_t *futhark_mc_segmap_task_235874_total_runtime;
    int *futhark_mc_segmap_task_235874_runs;
    int64_t *futhark_mc_segmap_task_235874_iter;
    int64_t futhark_mc_segmap_task_235874_total_time;
    int64_t futhark_mc_segmap_task_235874_total_iter;
    int64_t *futhark_mc_segmap_parloop_235887_total_runtime;
    int *futhark_mc_segmap_parloop_235887_runs;
    int64_t *futhark_mc_segmap_parloop_235887_iter;
    int64_t futhark_mc_segmap_parloop_235887_total_total_runtime;
    int futhark_mc_segmap_parloop_235887_total_runs;
    int64_t futhark_mc_segmap_parloop_235887_total_iter;
    int64_t *futhark_mc_segmap_task_235885_total_runtime;
    int *futhark_mc_segmap_task_235885_runs;
    int64_t *futhark_mc_segmap_task_235885_iter;
    int64_t futhark_mc_segmap_task_235885_total_time;
    int64_t futhark_mc_segmap_task_235885_total_iter;
    int64_t *futhark_mc_segmap_parloop_235898_total_runtime;
    int *futhark_mc_segmap_parloop_235898_runs;
    int64_t *futhark_mc_segmap_parloop_235898_iter;
    int64_t futhark_mc_segmap_parloop_235898_total_total_runtime;
    int futhark_mc_segmap_parloop_235898_total_runs;
    int64_t futhark_mc_segmap_parloop_235898_total_iter;
    int64_t *futhark_mc_segmap_task_235896_total_runtime;
    int *futhark_mc_segmap_task_235896_runs;
    int64_t *futhark_mc_segmap_task_235896_iter;
    int64_t futhark_mc_segmap_task_235896_total_time;
    int64_t futhark_mc_segmap_task_235896_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235908_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235908_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235908_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235908_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235908_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235908_total_iter;
    int64_t *futhark_mc_segred_task_235903_total_runtime;
    int *futhark_mc_segred_task_235903_runs;
    int64_t *futhark_mc_segred_task_235903_iter;
    int64_t futhark_mc_segred_task_235903_total_time;
    int64_t futhark_mc_segred_task_235903_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235914_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235914_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235914_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235914_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235914_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235914_total_iter;
    int64_t *futhark_mc_segred_task_235910_total_runtime;
    int *futhark_mc_segred_task_235910_runs;
    int64_t *futhark_mc_segred_task_235910_iter;
    int64_t futhark_mc_segred_task_235910_total_time;
    int64_t futhark_mc_segred_task_235910_total_iter;
    int64_t *futhark_mc_segmap_parloop_235901_total_runtime;
    int *futhark_mc_segmap_parloop_235901_runs;
    int64_t *futhark_mc_segmap_parloop_235901_iter;
    int64_t futhark_mc_segmap_parloop_235901_total_total_runtime;
    int futhark_mc_segmap_parloop_235901_total_runs;
    int64_t futhark_mc_segmap_parloop_235901_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235899_total_runtime;
    int *futhark_mc_segmap_nested_task_235899_runs;
    int64_t *futhark_mc_segmap_nested_task_235899_iter;
    int64_t *futhark_mc_segmap_parloop_235892_total_runtime;
    int *futhark_mc_segmap_parloop_235892_runs;
    int64_t *futhark_mc_segmap_parloop_235892_iter;
    int64_t futhark_mc_segmap_parloop_235892_total_total_runtime;
    int futhark_mc_segmap_parloop_235892_total_runs;
    int64_t futhark_mc_segmap_parloop_235892_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235890_total_runtime;
    int *futhark_mc_segmap_nested_task_235890_runs;
    int64_t *futhark_mc_segmap_nested_task_235890_iter;
    int64_t *futhark_mc_segmap_parloop_235881_total_runtime;
    int *futhark_mc_segmap_parloop_235881_runs;
    int64_t *futhark_mc_segmap_parloop_235881_iter;
    int64_t futhark_mc_segmap_parloop_235881_total_total_runtime;
    int futhark_mc_segmap_parloop_235881_total_runs;
    int64_t futhark_mc_segmap_parloop_235881_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235879_total_runtime;
    int *futhark_mc_segmap_nested_task_235879_runs;
    int64_t *futhark_mc_segmap_nested_task_235879_iter;
    int64_t *futhark_mc_segmap_parloop_235918_total_runtime;
    int *futhark_mc_segmap_parloop_235918_runs;
    int64_t *futhark_mc_segmap_parloop_235918_iter;
    int64_t futhark_mc_segmap_parloop_235918_total_total_runtime;
    int futhark_mc_segmap_parloop_235918_total_runs;
    int64_t futhark_mc_segmap_parloop_235918_total_iter;
    int64_t *futhark_mc_segmap_task_235916_total_runtime;
    int *futhark_mc_segmap_task_235916_runs;
    int64_t *futhark_mc_segmap_task_235916_iter;
    int64_t futhark_mc_segmap_task_235916_total_time;
    int64_t futhark_mc_segmap_task_235916_total_iter;
    int64_t *futhark_mc_segmap_parloop_235929_total_runtime;
    int *futhark_mc_segmap_parloop_235929_runs;
    int64_t *futhark_mc_segmap_parloop_235929_iter;
    int64_t futhark_mc_segmap_parloop_235929_total_total_runtime;
    int futhark_mc_segmap_parloop_235929_total_runs;
    int64_t futhark_mc_segmap_parloop_235929_total_iter;
    int64_t *futhark_mc_segmap_task_235927_total_runtime;
    int *futhark_mc_segmap_task_235927_runs;
    int64_t *futhark_mc_segmap_task_235927_iter;
    int64_t futhark_mc_segmap_task_235927_total_time;
    int64_t futhark_mc_segmap_task_235927_total_iter;
    int64_t *futhark_mc_segmap_parloop_235940_total_runtime;
    int *futhark_mc_segmap_parloop_235940_runs;
    int64_t *futhark_mc_segmap_parloop_235940_iter;
    int64_t futhark_mc_segmap_parloop_235940_total_total_runtime;
    int futhark_mc_segmap_parloop_235940_total_runs;
    int64_t futhark_mc_segmap_parloop_235940_total_iter;
    int64_t *futhark_mc_segmap_task_235938_total_runtime;
    int *futhark_mc_segmap_task_235938_runs;
    int64_t *futhark_mc_segmap_task_235938_iter;
    int64_t futhark_mc_segmap_task_235938_total_time;
    int64_t futhark_mc_segmap_task_235938_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235952_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235952_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235952_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235952_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235952_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235952_total_iter;
    int64_t *futhark_mc_segred_task_235945_total_runtime;
    int *futhark_mc_segred_task_235945_runs;
    int64_t *futhark_mc_segred_task_235945_iter;
    int64_t futhark_mc_segred_task_235945_total_time;
    int64_t futhark_mc_segred_task_235945_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235958_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235958_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235958_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235958_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235958_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235958_total_iter;
    int64_t *futhark_mc_segred_task_235954_total_runtime;
    int *futhark_mc_segred_task_235954_runs;
    int64_t *futhark_mc_segred_task_235954_iter;
    int64_t futhark_mc_segred_task_235954_total_time;
    int64_t futhark_mc_segred_task_235954_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_nested_task_235941_total_runtime;
    int *futhark_mc_segmap_nested_task_235941_runs;
    int64_t *futhark_mc_segmap_nested_task_235941_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_nested_task_235932_total_runtime;
    int *futhark_mc_segmap_nested_task_235932_runs;
    int64_t *futhark_mc_segmap_nested_task_235932_iter;
    int64_t *futhark_mc_segmap_parloop_235923_total_runtime;
    int *futhark_mc_segmap_parloop_235923_runs;
    int64_t *futhark_mc_segmap_parloop_235923_iter;
    int64_t futhark_mc_segmap_parloop_235923_total_total_runtime;
    int futhark_mc_segmap_parloop_235923_total_runs;
    int64_t futhark_mc_segmap_parloop_235923_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235921_total_runtime;
    int *futhark_mc_segmap_nested_task_235921_runs;
    int64_t *futhark_mc_segmap_nested_task_235921_iter;
    int64_t *futhark_mc_segmap_parloop_235962_total_runtime;
    int *futhark_mc_segmap_parloop_235962_runs;
    int64_t *futhark_mc_segmap_parloop_235962_iter;
    int64_t futhark_mc_segmap_parloop_235962_total_total_runtime;
    int futhark_mc_segmap_parloop_235962_total_runs;
    int64_t futhark_mc_segmap_parloop_235962_total_iter;
    int64_t *futhark_mc_segmap_task_235960_total_runtime;
    int *futhark_mc_segmap_task_235960_runs;
    int64_t *futhark_mc_segmap_task_235960_iter;
    int64_t futhark_mc_segmap_task_235960_total_time;
    int64_t futhark_mc_segmap_task_235960_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_task_235970_total_runtime;
    int *futhark_mc_segmap_task_235970_runs;
    int64_t *futhark_mc_segmap_task_235970_iter;
    int64_t futhark_mc_segmap_task_235970_total_time;
    int64_t futhark_mc_segmap_task_235970_total_iter;
    int64_t *futhark_mc_segmap_parloop_235982_total_runtime;
    int *futhark_mc_segmap_parloop_235982_runs;
    int64_t *futhark_mc_segmap_parloop_235982_iter;
    int64_t futhark_mc_segmap_parloop_235982_total_total_runtime;
    int futhark_mc_segmap_parloop_235982_total_runs;
    int64_t futhark_mc_segmap_parloop_235982_total_iter;
    int64_t *futhark_mc_segmap_task_235980_total_runtime;
    int *futhark_mc_segmap_task_235980_runs;
    int64_t *futhark_mc_segmap_task_235980_iter;
    int64_t futhark_mc_segmap_task_235980_total_time;
    int64_t futhark_mc_segmap_task_235980_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235992_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235992_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235992_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235992_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235992_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235992_total_iter;
    int64_t *futhark_mc_segred_task_235989_total_runtime;
    int *futhark_mc_segred_task_235989_runs;
    int64_t *futhark_mc_segred_task_235989_iter;
    int64_t futhark_mc_segred_task_235989_total_time;
    int64_t futhark_mc_segred_task_235989_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_235997_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_235997_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_235997_iter;
    int64_t futhark_mc_segred_stage_1_parloop_235997_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_235997_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_235997_total_iter;
    int64_t *futhark_mc_segred_task_235994_total_runtime;
    int *futhark_mc_segred_task_235994_runs;
    int64_t *futhark_mc_segred_task_235994_iter;
    int64_t futhark_mc_segred_task_235994_total_time;
    int64_t futhark_mc_segred_task_235994_total_iter;
    int64_t *futhark_mc_segmap_parloop_235986_total_runtime;
    int *futhark_mc_segmap_parloop_235986_runs;
    int64_t *futhark_mc_segmap_parloop_235986_iter;
    int64_t futhark_mc_segmap_parloop_235986_total_total_runtime;
    int futhark_mc_segmap_parloop_235986_total_runs;
    int64_t futhark_mc_segmap_parloop_235986_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235984_total_runtime;
    int *futhark_mc_segmap_nested_task_235984_runs;
    int64_t *futhark_mc_segmap_nested_task_235984_iter;
    int64_t *futhark_mc_segmap_parloop_235977_total_runtime;
    int *futhark_mc_segmap_parloop_235977_runs;
    int64_t *futhark_mc_segmap_parloop_235977_iter;
    int64_t futhark_mc_segmap_parloop_235977_total_total_runtime;
    int futhark_mc_segmap_parloop_235977_total_runs;
    int64_t futhark_mc_segmap_parloop_235977_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235975_total_runtime;
    int *futhark_mc_segmap_nested_task_235975_runs;
    int64_t *futhark_mc_segmap_nested_task_235975_iter;
    int64_t *futhark_mc_segmap_parloop_235967_total_runtime;
    int *futhark_mc_segmap_parloop_235967_runs;
    int64_t *futhark_mc_segmap_parloop_235967_iter;
    int64_t futhark_mc_segmap_parloop_235967_total_total_runtime;
    int futhark_mc_segmap_parloop_235967_total_runs;
    int64_t futhark_mc_segmap_parloop_235967_total_iter;
    int64_t *futhark_mc_segmap_nested_task_235965_total_runtime;
    int *futhark_mc_segmap_nested_task_235965_runs;
    int64_t *futhark_mc_segmap_nested_task_235965_iter;
    int64_t *futhark_mc_segmap_parloop_236001_total_runtime;
    int *futhark_mc_segmap_parloop_236001_runs;
    int64_t *futhark_mc_segmap_parloop_236001_iter;
    int64_t futhark_mc_segmap_parloop_236001_total_total_runtime;
    int futhark_mc_segmap_parloop_236001_total_runs;
    int64_t futhark_mc_segmap_parloop_236001_total_iter;
    int64_t *futhark_mc_segmap_task_235999_total_runtime;
    int *futhark_mc_segmap_task_235999_runs;
    int64_t *futhark_mc_segmap_task_235999_iter;
    int64_t futhark_mc_segmap_task_235999_total_time;
    int64_t futhark_mc_segmap_task_235999_total_iter;
    int64_t *futhark_mc_segmap_parloop_236014_total_runtime;
    int *futhark_mc_segmap_parloop_236014_runs;
    int64_t *futhark_mc_segmap_parloop_236014_iter;
    int64_t futhark_mc_segmap_parloop_236014_total_total_runtime;
    int futhark_mc_segmap_parloop_236014_total_runs;
    int64_t futhark_mc_segmap_parloop_236014_total_iter;
    int64_t *futhark_mc_segmap_task_236012_total_runtime;
    int *futhark_mc_segmap_task_236012_runs;
    int64_t *futhark_mc_segmap_task_236012_iter;
    int64_t futhark_mc_segmap_task_236012_total_time;
    int64_t futhark_mc_segmap_task_236012_total_iter;
    int64_t *futhark_mc_segmap_parloop_236027_total_runtime;
    int *futhark_mc_segmap_parloop_236027_runs;
    int64_t *futhark_mc_segmap_parloop_236027_iter;
    int64_t futhark_mc_segmap_parloop_236027_total_total_runtime;
    int futhark_mc_segmap_parloop_236027_total_runs;
    int64_t futhark_mc_segmap_parloop_236027_total_iter;
    int64_t *futhark_mc_segmap_task_236025_total_runtime;
    int *futhark_mc_segmap_task_236025_runs;
    int64_t *futhark_mc_segmap_task_236025_iter;
    int64_t futhark_mc_segmap_task_236025_total_time;
    int64_t futhark_mc_segmap_task_236025_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236041_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236041_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236041_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236041_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236041_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236041_total_iter;
    int64_t *futhark_mc_segred_task_236036_total_runtime;
    int *futhark_mc_segred_task_236036_runs;
    int64_t *futhark_mc_segred_task_236036_iter;
    int64_t futhark_mc_segred_task_236036_total_time;
    int64_t futhark_mc_segred_task_236036_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236047_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236047_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236047_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236047_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236047_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236047_total_iter;
    int64_t *futhark_mc_segred_task_236043_total_runtime;
    int *futhark_mc_segred_task_236043_runs;
    int64_t *futhark_mc_segred_task_236043_iter;
    int64_t futhark_mc_segred_task_236043_total_time;
    int64_t futhark_mc_segred_task_236043_total_iter;
    int64_t *futhark_mc_segmap_parloop_236032_total_runtime;
    int *futhark_mc_segmap_parloop_236032_runs;
    int64_t *futhark_mc_segmap_parloop_236032_iter;
    int64_t futhark_mc_segmap_parloop_236032_total_total_runtime;
    int futhark_mc_segmap_parloop_236032_total_runs;
    int64_t futhark_mc_segmap_parloop_236032_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236030_total_runtime;
    int *futhark_mc_segmap_nested_task_236030_runs;
    int64_t *futhark_mc_segmap_nested_task_236030_iter;
    int64_t *futhark_mc_segmap_parloop_236021_total_runtime;
    int *futhark_mc_segmap_parloop_236021_runs;
    int64_t *futhark_mc_segmap_parloop_236021_iter;
    int64_t futhark_mc_segmap_parloop_236021_total_total_runtime;
    int futhark_mc_segmap_parloop_236021_total_runs;
    int64_t futhark_mc_segmap_parloop_236021_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236019_total_runtime;
    int *futhark_mc_segmap_nested_task_236019_runs;
    int64_t *futhark_mc_segmap_nested_task_236019_iter;
    int64_t *futhark_mc_segmap_parloop_236008_total_runtime;
    int *futhark_mc_segmap_parloop_236008_runs;
    int64_t *futhark_mc_segmap_parloop_236008_iter;
    int64_t futhark_mc_segmap_parloop_236008_total_total_runtime;
    int futhark_mc_segmap_parloop_236008_total_runs;
    int64_t futhark_mc_segmap_parloop_236008_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236006_total_runtime;
    int *futhark_mc_segmap_nested_task_236006_runs;
    int64_t *futhark_mc_segmap_nested_task_236006_iter;
    int64_t *futhark_mc_segmap_parloop_236051_total_runtime;
    int *futhark_mc_segmap_parloop_236051_runs;
    int64_t *futhark_mc_segmap_parloop_236051_iter;
    int64_t futhark_mc_segmap_parloop_236051_total_total_runtime;
    int futhark_mc_segmap_parloop_236051_total_runs;
    int64_t futhark_mc_segmap_parloop_236051_total_iter;
    int64_t *futhark_mc_segmap_task_236049_total_runtime;
    int *futhark_mc_segmap_task_236049_runs;
    int64_t *futhark_mc_segmap_task_236049_iter;
    int64_t futhark_mc_segmap_task_236049_total_time;
    int64_t futhark_mc_segmap_task_236049_total_iter;
    int64_t *futhark_mc_segmap_parloop_236066_total_runtime;
    int *futhark_mc_segmap_parloop_236066_runs;
    int64_t *futhark_mc_segmap_parloop_236066_iter;
    int64_t futhark_mc_segmap_parloop_236066_total_total_runtime;
    int futhark_mc_segmap_parloop_236066_total_runs;
    int64_t futhark_mc_segmap_parloop_236066_total_iter;
    int64_t *futhark_mc_segmap_task_236064_total_runtime;
    int *futhark_mc_segmap_task_236064_runs;
    int64_t *futhark_mc_segmap_task_236064_iter;
    int64_t futhark_mc_segmap_task_236064_total_time;
    int64_t futhark_mc_segmap_task_236064_total_iter;
    int64_t *futhark_mc_segmap_parloop_236081_total_runtime;
    int *futhark_mc_segmap_parloop_236081_runs;
    int64_t *futhark_mc_segmap_parloop_236081_iter;
    int64_t futhark_mc_segmap_parloop_236081_total_total_runtime;
    int futhark_mc_segmap_parloop_236081_total_runs;
    int64_t futhark_mc_segmap_parloop_236081_total_iter;
    int64_t *futhark_mc_segmap_task_236079_total_runtime;
    int *futhark_mc_segmap_task_236079_runs;
    int64_t *futhark_mc_segmap_task_236079_iter;
    int64_t futhark_mc_segmap_task_236079_total_time;
    int64_t futhark_mc_segmap_task_236079_total_iter;
    int64_t *futhark_mc_segmap_parloop_236096_total_runtime;
    int *futhark_mc_segmap_parloop_236096_runs;
    int64_t *futhark_mc_segmap_parloop_236096_iter;
    int64_t futhark_mc_segmap_parloop_236096_total_total_runtime;
    int futhark_mc_segmap_parloop_236096_total_runs;
    int64_t futhark_mc_segmap_parloop_236096_total_iter;
    int64_t *futhark_mc_segmap_task_236094_total_runtime;
    int *futhark_mc_segmap_task_236094_runs;
    int64_t *futhark_mc_segmap_task_236094_iter;
    int64_t futhark_mc_segmap_task_236094_total_time;
    int64_t futhark_mc_segmap_task_236094_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236105_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236105_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236105_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236105_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236105_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236105_total_iter;
    int64_t *futhark_mc_segred_task_236098_total_runtime;
    int *futhark_mc_segred_task_236098_runs;
    int64_t *futhark_mc_segred_task_236098_iter;
    int64_t futhark_mc_segred_task_236098_total_time;
    int64_t futhark_mc_segred_task_236098_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236111_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236111_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236111_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236111_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236111_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236111_total_iter;
    int64_t *futhark_mc_segred_task_236107_total_runtime;
    int *futhark_mc_segred_task_236107_runs;
    int64_t *futhark_mc_segred_task_236107_iter;
    int64_t futhark_mc_segred_task_236107_total_time;
    int64_t futhark_mc_segred_task_236107_total_iter;
    int64_t *futhark_mc_segmap_parloop_236088_total_runtime;
    int *futhark_mc_segmap_parloop_236088_runs;
    int64_t *futhark_mc_segmap_parloop_236088_iter;
    int64_t futhark_mc_segmap_parloop_236088_total_total_runtime;
    int futhark_mc_segmap_parloop_236088_total_runs;
    int64_t futhark_mc_segmap_parloop_236088_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236086_total_runtime;
    int *futhark_mc_segmap_nested_task_236086_runs;
    int64_t *futhark_mc_segmap_nested_task_236086_iter;
    int64_t *futhark_mc_segmap_parloop_236075_total_runtime;
    int *futhark_mc_segmap_parloop_236075_runs;
    int64_t *futhark_mc_segmap_parloop_236075_iter;
    int64_t futhark_mc_segmap_parloop_236075_total_total_runtime;
    int futhark_mc_segmap_parloop_236075_total_runs;
    int64_t futhark_mc_segmap_parloop_236075_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236073_total_runtime;
    int *futhark_mc_segmap_nested_task_236073_runs;
    int64_t *futhark_mc_segmap_nested_task_236073_iter;
    int64_t *futhark_mc_segmap_parloop_236060_total_runtime;
    int *futhark_mc_segmap_parloop_236060_runs;
    int64_t *futhark_mc_segmap_parloop_236060_iter;
    int64_t futhark_mc_segmap_parloop_236060_total_total_runtime;
    int futhark_mc_segmap_parloop_236060_total_runs;
    int64_t futhark_mc_segmap_parloop_236060_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236058_total_runtime;
    int *futhark_mc_segmap_nested_task_236058_runs;
    int64_t *futhark_mc_segmap_nested_task_236058_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_task_236113_total_runtime;
    int *futhark_mc_segmap_task_236113_runs;
    int64_t *futhark_mc_segmap_task_236113_iter;
    int64_t futhark_mc_segmap_task_236113_total_time;
    int64_t futhark_mc_segmap_task_236113_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_task_236122_total_runtime;
    int *futhark_mc_segmap_task_236122_runs;
    int64_t *futhark_mc_segmap_task_236122_iter;
    int64_t futhark_mc_segmap_task_236122_total_time;
    int64_t futhark_mc_segmap_task_236122_total_iter;
    int64_t *futhark_mc_segmap_parloop_236133_total_runtime;
    int *futhark_mc_segmap_parloop_236133_runs;
    int64_t *futhark_mc_segmap_parloop_236133_iter;
    int64_t futhark_mc_segmap_parloop_236133_total_total_runtime;
    int futhark_mc_segmap_parloop_236133_total_runs;
    int64_t futhark_mc_segmap_parloop_236133_total_iter;
    int64_t *futhark_mc_segmap_task_236131_total_runtime;
    int *futhark_mc_segmap_task_236131_runs;
    int64_t *futhark_mc_segmap_task_236131_iter;
    int64_t futhark_mc_segmap_task_236131_total_time;
    int64_t futhark_mc_segmap_task_236131_total_iter;
    int64_t *futhark_mc_segmap_parloop_236128_total_runtime;
    int *futhark_mc_segmap_parloop_236128_runs;
    int64_t *futhark_mc_segmap_parloop_236128_iter;
    int64_t futhark_mc_segmap_parloop_236128_total_total_runtime;
    int futhark_mc_segmap_parloop_236128_total_runs;
    int64_t futhark_mc_segmap_parloop_236128_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236126_total_runtime;
    int *futhark_mc_segmap_nested_task_236126_runs;
    int64_t *futhark_mc_segmap_nested_task_236126_iter;
    int64_t *futhark_mc_segmap_parloop_236119_total_runtime;
    int *futhark_mc_segmap_parloop_236119_runs;
    int64_t *futhark_mc_segmap_parloop_236119_iter;
    int64_t futhark_mc_segmap_parloop_236119_total_total_runtime;
    int futhark_mc_segmap_parloop_236119_total_runs;
    int64_t futhark_mc_segmap_parloop_236119_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236117_total_runtime;
    int *futhark_mc_segmap_nested_task_236117_runs;
    int64_t *futhark_mc_segmap_nested_task_236117_iter;
    int64_t *futhark_mc_segmap_parloop_236137_total_runtime;
    int *futhark_mc_segmap_parloop_236137_runs;
    int64_t *futhark_mc_segmap_parloop_236137_iter;
    int64_t futhark_mc_segmap_parloop_236137_total_total_runtime;
    int futhark_mc_segmap_parloop_236137_total_runs;
    int64_t futhark_mc_segmap_parloop_236137_total_iter;
    int64_t *futhark_mc_segmap_task_236135_total_runtime;
    int *futhark_mc_segmap_task_236135_runs;
    int64_t *futhark_mc_segmap_task_236135_iter;
    int64_t futhark_mc_segmap_task_236135_total_time;
    int64_t futhark_mc_segmap_task_236135_total_iter;
    int64_t *futhark_mc_segmap_parloop_236146_total_runtime;
    int *futhark_mc_segmap_parloop_236146_runs;
    int64_t *futhark_mc_segmap_parloop_236146_iter;
    int64_t futhark_mc_segmap_parloop_236146_total_total_runtime;
    int futhark_mc_segmap_parloop_236146_total_runs;
    int64_t futhark_mc_segmap_parloop_236146_total_iter;
    int64_t *futhark_mc_segmap_task_236144_total_runtime;
    int *futhark_mc_segmap_task_236144_runs;
    int64_t *futhark_mc_segmap_task_236144_iter;
    int64_t futhark_mc_segmap_task_236144_total_time;
    int64_t futhark_mc_segmap_task_236144_total_iter;
    int64_t *futhark_mc_segmap_parloop_236141_total_runtime;
    int *futhark_mc_segmap_parloop_236141_runs;
    int64_t *futhark_mc_segmap_parloop_236141_iter;
    int64_t futhark_mc_segmap_parloop_236141_total_total_runtime;
    int futhark_mc_segmap_parloop_236141_total_runs;
    int64_t futhark_mc_segmap_parloop_236141_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236139_total_runtime;
    int *futhark_mc_segmap_nested_task_236139_runs;
    int64_t *futhark_mc_segmap_nested_task_236139_iter;
    int64_t *futhark_mc_segmap_parloop_236150_total_runtime;
    int *futhark_mc_segmap_parloop_236150_runs;
    int64_t *futhark_mc_segmap_parloop_236150_iter;
    int64_t futhark_mc_segmap_parloop_236150_total_total_runtime;
    int futhark_mc_segmap_parloop_236150_total_runs;
    int64_t futhark_mc_segmap_parloop_236150_total_iter;
    int64_t *futhark_mc_segmap_task_236148_total_runtime;
    int *futhark_mc_segmap_task_236148_runs;
    int64_t *futhark_mc_segmap_task_236148_iter;
    int64_t futhark_mc_segmap_task_236148_total_time;
    int64_t futhark_mc_segmap_task_236148_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236158_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236158_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236158_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236158_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236158_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236158_total_iter;
    int64_t *futhark_mc_segred_task_236155_total_runtime;
    int *futhark_mc_segred_task_236155_runs;
    int64_t *futhark_mc_segred_task_236155_iter;
    int64_t futhark_mc_segred_task_236155_total_time;
    int64_t futhark_mc_segred_task_236155_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_nested_task_236151_total_runtime;
    int *futhark_mc_segmap_nested_task_236151_runs;
    int64_t *futhark_mc_segmap_nested_task_236151_iter;
    int64_t *futhark_mc_segmap_parloop_236162_total_runtime;
    int *futhark_mc_segmap_parloop_236162_runs;
    int64_t *futhark_mc_segmap_parloop_236162_iter;
    int64_t futhark_mc_segmap_parloop_236162_total_total_runtime;
    int futhark_mc_segmap_parloop_236162_total_runs;
    int64_t futhark_mc_segmap_parloop_236162_total_iter;
    int64_t *futhark_mc_segmap_task_236160_total_runtime;
    int *futhark_mc_segmap_task_236160_runs;
    int64_t *futhark_mc_segmap_task_236160_iter;
    int64_t futhark_mc_segmap_task_236160_total_time;
    int64_t futhark_mc_segmap_task_236160_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_236172_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_236172_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_236172_iter;
    int64_t futhark_mc_scan_stage_1_parloop_236172_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_236172_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_236172_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_236174_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_236174_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_236174_iter;
    int64_t futhark_mc_scan_stage_3_parloop_236174_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_236174_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_236174_total_iter;
    int64_t *futhark_mc_segscan_task_236169_total_runtime;
    int *futhark_mc_segscan_task_236169_runs;
    int64_t *futhark_mc_segscan_task_236169_iter;
    int64_t futhark_mc_segscan_task_236169_total_time;
    int64_t futhark_mc_segscan_task_236169_total_iter;
    int64_t *futhark_mc_segmap_parloop_236166_total_runtime;
    int *futhark_mc_segmap_parloop_236166_runs;
    int64_t *futhark_mc_segmap_parloop_236166_iter;
    int64_t futhark_mc_segmap_parloop_236166_total_total_runtime;
    int futhark_mc_segmap_parloop_236166_total_runs;
    int64_t futhark_mc_segmap_parloop_236166_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236164_total_runtime;
    int *futhark_mc_segmap_nested_task_236164_runs;
    int64_t *futhark_mc_segmap_nested_task_236164_iter;
    int64_t *futhark_mc_segmap_parloop_236178_total_runtime;
    int *futhark_mc_segmap_parloop_236178_runs;
    int64_t *futhark_mc_segmap_parloop_236178_iter;
    int64_t futhark_mc_segmap_parloop_236178_total_total_runtime;
    int futhark_mc_segmap_parloop_236178_total_runs;
    int64_t futhark_mc_segmap_parloop_236178_total_iter;
    int64_t *futhark_mc_segmap_task_236176_total_runtime;
    int *futhark_mc_segmap_task_236176_runs;
    int64_t *futhark_mc_segmap_task_236176_iter;
    int64_t futhark_mc_segmap_task_236176_total_time;
    int64_t futhark_mc_segmap_task_236176_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236186_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236186_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236186_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236186_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236186_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236186_total_iter;
    int64_t *futhark_mc_segred_task_236183_total_runtime;
    int *futhark_mc_segred_task_236183_runs;
    int64_t *futhark_mc_segred_task_236183_iter;
    int64_t futhark_mc_segred_task_236183_total_time;
    int64_t futhark_mc_segred_task_236183_total_iter;
    int64_t *futhark_mc_segmap_parloop_236181_total_runtime;
    int *futhark_mc_segmap_parloop_236181_runs;
    int64_t *futhark_mc_segmap_parloop_236181_iter;
    int64_t futhark_mc_segmap_parloop_236181_total_total_runtime;
    int futhark_mc_segmap_parloop_236181_total_runs;
    int64_t futhark_mc_segmap_parloop_236181_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236179_total_runtime;
    int *futhark_mc_segmap_nested_task_236179_runs;
    int64_t *futhark_mc_segmap_nested_task_236179_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_task_236188_total_runtime;
    int *futhark_mc_segmap_task_236188_runs;
    int64_t *futhark_mc_segmap_task_236188_iter;
    int64_t futhark_mc_segmap_task_236188_total_time;
    int64_t futhark_mc_segmap_task_236188_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_236200_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_236200_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_236200_iter;
    int64_t futhark_mc_scan_stage_1_parloop_236200_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_236200_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_236200_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_236202_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_236202_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_236202_iter;
    int64_t futhark_mc_scan_stage_3_parloop_236202_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_236202_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_236202_total_iter;
    int64_t *futhark_mc_segscan_task_236197_total_runtime;
    int *futhark_mc_segscan_task_236197_runs;
    int64_t *futhark_mc_segscan_task_236197_iter;
    int64_t futhark_mc_segscan_task_236197_total_time;
    int64_t futhark_mc_segscan_task_236197_total_iter;
    int64_t *futhark_mc_segmap_parloop_236194_total_runtime;
    int *futhark_mc_segmap_parloop_236194_runs;
    int64_t *futhark_mc_segmap_parloop_236194_iter;
    int64_t futhark_mc_segmap_parloop_236194_total_total_runtime;
    int futhark_mc_segmap_parloop_236194_total_runs;
    int64_t futhark_mc_segmap_parloop_236194_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236192_total_runtime;
    int *futhark_mc_segmap_nested_task_236192_runs;
    int64_t *futhark_mc_segmap_nested_task_236192_iter;
    int64_t *futhark_mc_segmap_parloop_236206_total_runtime;
    int *futhark_mc_segmap_parloop_236206_runs;
    int64_t *futhark_mc_segmap_parloop_236206_iter;
    int64_t futhark_mc_segmap_parloop_236206_total_total_runtime;
    int futhark_mc_segmap_parloop_236206_total_runs;
    int64_t futhark_mc_segmap_parloop_236206_total_iter;
    int64_t *futhark_mc_segmap_task_236204_total_runtime;
    int *futhark_mc_segmap_task_236204_runs;
    int64_t *futhark_mc_segmap_task_236204_iter;
    int64_t futhark_mc_segmap_task_236204_total_time;
    int64_t futhark_mc_segmap_task_236204_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236214_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236214_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236214_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236214_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236214_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236214_total_iter;
    int64_t *futhark_mc_segred_task_236211_total_runtime;
    int *futhark_mc_segred_task_236211_runs;
    int64_t *futhark_mc_segred_task_236211_iter;
    int64_t futhark_mc_segred_task_236211_total_time;
    int64_t futhark_mc_segred_task_236211_total_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_nested_task_236207_total_runtime;
    int *futhark_mc_segmap_nested_task_236207_runs;
    int64_t *futhark_mc_segmap_nested_task_236207_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_task_236216_total_runtime;
    int *futhark_mc_segmap_task_236216_runs;
    int64_t *futhark_mc_segmap_task_236216_iter;
    int64_t futhark_mc_segmap_task_236216_total_time;
    int64_t futhark_mc_segmap_task_236216_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_236228_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_236228_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_236228_iter;
    int64_t futhark_mc_scan_stage_1_parloop_236228_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_236228_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_236228_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_236230_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_236230_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_236230_iter;
    int64_t futhark_mc_scan_stage_3_parloop_236230_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_236230_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_236230_total_iter;
    int64_t *futhark_mc_segscan_task_236225_total_runtime;
    int *futhark_mc_segscan_task_236225_runs;
    int64_t *futhark_mc_segscan_task_236225_iter;
    int64_t futhark_mc_segscan_task_236225_total_time;
    int64_t futhark_mc_segscan_task_236225_total_iter;
    int64_t *futhark_mc_segmap_parloop_236222_total_runtime;
    int *futhark_mc_segmap_parloop_236222_runs;
    int64_t *futhark_mc_segmap_parloop_236222_iter;
    int64_t futhark_mc_segmap_parloop_236222_total_total_runtime;
    int futhark_mc_segmap_parloop_236222_total_runs;
    int64_t futhark_mc_segmap_parloop_236222_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236220_total_runtime;
    int *futhark_mc_segmap_nested_task_236220_runs;
    int64_t *futhark_mc_segmap_nested_task_236220_iter;
    int64_t *futhark_mc_segmap_parloop_236234_total_runtime;
    int *futhark_mc_segmap_parloop_236234_runs;
    int64_t *futhark_mc_segmap_parloop_236234_iter;
    int64_t futhark_mc_segmap_parloop_236234_total_total_runtime;
    int futhark_mc_segmap_parloop_236234_total_runs;
    int64_t futhark_mc_segmap_parloop_236234_total_iter;
    int64_t *futhark_mc_segmap_task_236232_total_runtime;
    int *futhark_mc_segmap_task_236232_runs;
    int64_t *futhark_mc_segmap_task_236232_iter;
    int64_t futhark_mc_segmap_task_236232_total_time;
    int64_t futhark_mc_segmap_task_236232_total_iter;
    int64_t *futhark_mc_segmap_parloop_236243_total_runtime;
    int *futhark_mc_segmap_parloop_236243_runs;
    int64_t *futhark_mc_segmap_parloop_236243_iter;
    int64_t futhark_mc_segmap_parloop_236243_total_total_runtime;
    int futhark_mc_segmap_parloop_236243_total_runs;
    int64_t futhark_mc_segmap_parloop_236243_total_iter;
    int64_t *futhark_mc_segmap_task_236241_total_runtime;
    int *futhark_mc_segmap_task_236241_runs;
    int64_t *futhark_mc_segmap_task_236241_iter;
    int64_t futhark_mc_segmap_task_236241_total_time;
    int64_t futhark_mc_segmap_task_236241_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236251_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236251_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236251_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236251_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236251_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236251_total_iter;
    int64_t *futhark_mc_segred_task_236248_total_runtime;
    int *futhark_mc_segred_task_236248_runs;
    int64_t *futhark_mc_segred_task_236248_iter;
    int64_t futhark_mc_segred_task_236248_total_time;
    int64_t futhark_mc_segred_task_236248_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236256_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236256_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236256_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236256_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236256_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236256_total_iter;
    int64_t *futhark_mc_segred_task_236253_total_runtime;
    int *futhark_mc_segred_task_236253_runs;
    int64_t *futhark_mc_segred_task_236253_iter;
    int64_t futhark_mc_segred_task_236253_total_time;
    int64_t futhark_mc_segred_task_236253_total_iter;
    int64_t *futhark_mc_segmap_parloop_236246_total_runtime;
    int *futhark_mc_segmap_parloop_236246_runs;
    int64_t *futhark_mc_segmap_parloop_236246_iter;
    int64_t futhark_mc_segmap_parloop_236246_total_total_runtime;
    int futhark_mc_segmap_parloop_236246_total_runs;
    int64_t futhark_mc_segmap_parloop_236246_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236244_total_runtime;
    int *futhark_mc_segmap_nested_task_236244_runs;
    int64_t *futhark_mc_segmap_nested_task_236244_iter;
    int64_t *futhark_mc_segmap_parloop_236238_total_runtime;
    int *futhark_mc_segmap_parloop_236238_runs;
    int64_t *futhark_mc_segmap_parloop_236238_iter;
    int64_t futhark_mc_segmap_parloop_236238_total_total_runtime;
    int futhark_mc_segmap_parloop_236238_total_runs;
    int64_t futhark_mc_segmap_parloop_236238_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236236_total_runtime;
    int *futhark_mc_segmap_nested_task_236236_runs;
    int64_t *futhark_mc_segmap_nested_task_236236_iter;
    int64_t *futhark_mc_segmap_parloop_236260_total_runtime;
    int *futhark_mc_segmap_parloop_236260_runs;
    int64_t *futhark_mc_segmap_parloop_236260_iter;
    int64_t futhark_mc_segmap_parloop_236260_total_total_runtime;
    int futhark_mc_segmap_parloop_236260_total_runs;
    int64_t futhark_mc_segmap_parloop_236260_total_iter;
    int64_t *futhark_mc_segmap_task_236258_total_runtime;
    int *futhark_mc_segmap_task_236258_runs;
    int64_t *futhark_mc_segmap_task_236258_iter;
    int64_t futhark_mc_segmap_task_236258_total_time;
    int64_t futhark_mc_segmap_task_236258_total_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_segred_stage_1_parloop_236281_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236281_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236281_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236281_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236281_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236281_total_iter;
    int64_t *futhark_mc_segred_task_236276_total_runtime;
    int *futhark_mc_segred_task_236276_runs;
    int64_t *futhark_mc_segred_task_236276_iter;
    int64_t futhark_mc_segred_task_236276_total_time;
    int64_t futhark_mc_segred_task_236276_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236287_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236287_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236287_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236287_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236287_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236287_total_iter;
    int64_t *futhark_mc_segred_task_236283_total_runtime;
    int *futhark_mc_segred_task_236283_runs;
    int64_t *futhark_mc_segred_task_236283_iter;
    int64_t futhark_mc_segred_task_236283_total_time;
    int64_t futhark_mc_segred_task_236283_total_iter;
    int64_t *futhark_mc_segmap_parloop_236274_total_runtime;
    int *futhark_mc_segmap_parloop_236274_runs;
    int64_t *futhark_mc_segmap_parloop_236274_iter;
    int64_t futhark_mc_segmap_parloop_236274_total_total_runtime;
    int futhark_mc_segmap_parloop_236274_total_runs;
    int64_t futhark_mc_segmap_parloop_236274_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236272_total_runtime;
    int *futhark_mc_segmap_nested_task_236272_runs;
    int64_t *futhark_mc_segmap_nested_task_236272_iter;
    int64_t *futhark_mc_segmap_parloop_236265_total_runtime;
    int *futhark_mc_segmap_parloop_236265_runs;
    int64_t *futhark_mc_segmap_parloop_236265_iter;
    int64_t futhark_mc_segmap_parloop_236265_total_total_runtime;
    int futhark_mc_segmap_parloop_236265_total_runs;
    int64_t futhark_mc_segmap_parloop_236265_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236263_total_runtime;
    int *futhark_mc_segmap_nested_task_236263_runs;
    int64_t *futhark_mc_segmap_nested_task_236263_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_task_236289_total_runtime;
    int *futhark_mc_segmap_task_236289_runs;
    int64_t *futhark_mc_segmap_task_236289_iter;
    int64_t futhark_mc_segmap_task_236289_total_time;
    int64_t futhark_mc_segmap_task_236289_total_iter;
    int64_t *futhark_mc_segmap_parloop_236302_total_runtime;
    int *futhark_mc_segmap_parloop_236302_runs;
    int64_t *futhark_mc_segmap_parloop_236302_iter;
    int64_t futhark_mc_segmap_parloop_236302_total_total_runtime;
    int futhark_mc_segmap_parloop_236302_total_runs;
    int64_t futhark_mc_segmap_parloop_236302_total_iter;
    int64_t *futhark_mc_segmap_task_236300_total_runtime;
    int *futhark_mc_segmap_task_236300_runs;
    int64_t *futhark_mc_segmap_task_236300_iter;
    int64_t futhark_mc_segmap_task_236300_total_time;
    int64_t futhark_mc_segmap_task_236300_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236314_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236314_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236314_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236314_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236314_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236314_total_iter;
    int64_t *futhark_mc_segred_task_236307_total_runtime;
    int *futhark_mc_segred_task_236307_runs;
    int64_t *futhark_mc_segred_task_236307_iter;
    int64_t futhark_mc_segred_task_236307_total_time;
    int64_t futhark_mc_segred_task_236307_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_236316_total_runtime;
    int *futhark_mc_segred_task_236316_runs;
    int64_t *futhark_mc_segred_task_236316_iter;
    int64_t futhark_mc_segred_task_236316_total_time;
    int64_t futhark_mc_segred_task_236316_total_iter;
    int64_t *futhark_mc_segmap_parloop_236305_total_runtime;
    int *futhark_mc_segmap_parloop_236305_runs;
    int64_t *futhark_mc_segmap_parloop_236305_iter;
    int64_t futhark_mc_segmap_parloop_236305_total_total_runtime;
    int futhark_mc_segmap_parloop_236305_total_runs;
    int64_t futhark_mc_segmap_parloop_236305_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236303_total_runtime;
    int *futhark_mc_segmap_nested_task_236303_runs;
    int64_t *futhark_mc_segmap_nested_task_236303_iter;
    int64_t *futhark_mc_segmap_parloop_236296_total_runtime;
    int *futhark_mc_segmap_parloop_236296_runs;
    int64_t *futhark_mc_segmap_parloop_236296_iter;
    int64_t futhark_mc_segmap_parloop_236296_total_total_runtime;
    int futhark_mc_segmap_parloop_236296_total_runs;
    int64_t futhark_mc_segmap_parloop_236296_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236294_total_runtime;
    int *futhark_mc_segmap_nested_task_236294_runs;
    int64_t *futhark_mc_segmap_nested_task_236294_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_236334_total_runtime;
    int *futhark_mc_segmap_parloop_236334_runs;
    int64_t *futhark_mc_segmap_parloop_236334_iter;
    int64_t futhark_mc_segmap_parloop_236334_total_total_runtime;
    int futhark_mc_segmap_parloop_236334_total_runs;
    int64_t futhark_mc_segmap_parloop_236334_total_iter;
    int64_t *futhark_mc_segmap_task_236332_total_runtime;
    int *futhark_mc_segmap_task_236332_runs;
    int64_t *futhark_mc_segmap_task_236332_iter;
    int64_t futhark_mc_segmap_task_236332_total_time;
    int64_t futhark_mc_segmap_task_236332_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236344_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236344_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236344_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236344_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236344_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236344_total_iter;
    int64_t *futhark_mc_segred_task_236341_total_runtime;
    int *futhark_mc_segred_task_236341_runs;
    int64_t *futhark_mc_segred_task_236341_iter;
    int64_t futhark_mc_segred_task_236341_total_time;
    int64_t futhark_mc_segred_task_236341_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236349_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236349_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236349_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236349_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236349_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236349_total_iter;
    int64_t *futhark_mc_segred_task_236346_total_runtime;
    int *futhark_mc_segred_task_236346_runs;
    int64_t *futhark_mc_segred_task_236346_iter;
    int64_t futhark_mc_segred_task_236346_total_time;
    int64_t futhark_mc_segred_task_236346_total_iter;
    int64_t *futhark_mc_segmap_parloop_236338_total_runtime;
    int *futhark_mc_segmap_parloop_236338_runs;
    int64_t *futhark_mc_segmap_parloop_236338_iter;
    int64_t futhark_mc_segmap_parloop_236338_total_total_runtime;
    int futhark_mc_segmap_parloop_236338_total_runs;
    int64_t futhark_mc_segmap_parloop_236338_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236336_total_runtime;
    int *futhark_mc_segmap_nested_task_236336_runs;
    int64_t *futhark_mc_segmap_nested_task_236336_iter;
    int64_t *futhark_mc_segmap_parloop_236329_total_runtime;
    int *futhark_mc_segmap_parloop_236329_runs;
    int64_t *futhark_mc_segmap_parloop_236329_iter;
    int64_t futhark_mc_segmap_parloop_236329_total_total_runtime;
    int futhark_mc_segmap_parloop_236329_total_runs;
    int64_t futhark_mc_segmap_parloop_236329_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236327_total_runtime;
    int *futhark_mc_segmap_nested_task_236327_runs;
    int64_t *futhark_mc_segmap_nested_task_236327_iter;
    int64_t *futhark_mc_segmap_parloop_236353_total_runtime;
    int *futhark_mc_segmap_parloop_236353_runs;
    int64_t *futhark_mc_segmap_parloop_236353_iter;
    int64_t futhark_mc_segmap_parloop_236353_total_total_runtime;
    int futhark_mc_segmap_parloop_236353_total_runs;
    int64_t futhark_mc_segmap_parloop_236353_total_iter;
    int64_t *futhark_mc_segmap_task_236351_total_runtime;
    int *futhark_mc_segmap_task_236351_runs;
    int64_t *futhark_mc_segmap_task_236351_iter;
    int64_t futhark_mc_segmap_task_236351_total_time;
    int64_t futhark_mc_segmap_task_236351_total_iter;
    int64_t *futhark_mc_segmap_parloop_236366_total_runtime;
    int *futhark_mc_segmap_parloop_236366_runs;
    int64_t *futhark_mc_segmap_parloop_236366_iter;
    int64_t futhark_mc_segmap_parloop_236366_total_total_runtime;
    int futhark_mc_segmap_parloop_236366_total_runs;
    int64_t futhark_mc_segmap_parloop_236366_total_iter;
    int64_t *futhark_mc_segmap_task_236364_total_runtime;
    int *futhark_mc_segmap_task_236364_runs;
    int64_t *futhark_mc_segmap_task_236364_iter;
    int64_t futhark_mc_segmap_task_236364_total_time;
    int64_t futhark_mc_segmap_task_236364_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236380_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236380_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236380_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236380_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236380_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236380_total_iter;
    int64_t *futhark_mc_segred_task_236375_total_runtime;
    int *futhark_mc_segred_task_236375_runs;
    int64_t *futhark_mc_segred_task_236375_iter;
    int64_t futhark_mc_segred_task_236375_total_time;
    int64_t futhark_mc_segred_task_236375_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236386_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236386_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236386_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236386_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236386_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236386_total_iter;
    int64_t *futhark_mc_segred_task_236382_total_runtime;
    int *futhark_mc_segred_task_236382_runs;
    int64_t *futhark_mc_segred_task_236382_iter;
    int64_t futhark_mc_segred_task_236382_total_time;
    int64_t futhark_mc_segred_task_236382_total_iter;
    int64_t *futhark_mc_segmap_parloop_236371_total_runtime;
    int *futhark_mc_segmap_parloop_236371_runs;
    int64_t *futhark_mc_segmap_parloop_236371_iter;
    int64_t futhark_mc_segmap_parloop_236371_total_total_runtime;
    int futhark_mc_segmap_parloop_236371_total_runs;
    int64_t futhark_mc_segmap_parloop_236371_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236369_total_runtime;
    int *futhark_mc_segmap_nested_task_236369_runs;
    int64_t *futhark_mc_segmap_nested_task_236369_iter;
    int64_t *futhark_mc_segmap_parloop_236360_total_runtime;
    int *futhark_mc_segmap_parloop_236360_runs;
    int64_t *futhark_mc_segmap_parloop_236360_iter;
    int64_t futhark_mc_segmap_parloop_236360_total_total_runtime;
    int futhark_mc_segmap_parloop_236360_total_runs;
    int64_t futhark_mc_segmap_parloop_236360_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236358_total_runtime;
    int *futhark_mc_segmap_nested_task_236358_runs;
    int64_t *futhark_mc_segmap_nested_task_236358_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_236405_total_runtime;
    int *futhark_mc_segmap_parloop_236405_runs;
    int64_t *futhark_mc_segmap_parloop_236405_iter;
    int64_t futhark_mc_segmap_parloop_236405_total_total_runtime;
    int futhark_mc_segmap_parloop_236405_total_runs;
    int64_t futhark_mc_segmap_parloop_236405_total_iter;
    int64_t *futhark_mc_segmap_task_236403_total_runtime;
    int *futhark_mc_segmap_task_236403_runs;
    int64_t *futhark_mc_segmap_task_236403_iter;
    int64_t futhark_mc_segmap_task_236403_total_time;
    int64_t futhark_mc_segmap_task_236403_total_iter;
    int64_t *futhark_mc_segmap_parloop_236420_total_runtime;
    int *futhark_mc_segmap_parloop_236420_runs;
    int64_t *futhark_mc_segmap_parloop_236420_iter;
    int64_t futhark_mc_segmap_parloop_236420_total_total_runtime;
    int futhark_mc_segmap_parloop_236420_total_runs;
    int64_t futhark_mc_segmap_parloop_236420_total_iter;
    int64_t *futhark_mc_segmap_task_236418_total_runtime;
    int *futhark_mc_segmap_task_236418_runs;
    int64_t *futhark_mc_segmap_task_236418_iter;
    int64_t futhark_mc_segmap_task_236418_total_time;
    int64_t futhark_mc_segmap_task_236418_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236429_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236429_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236429_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236429_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236429_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236429_total_iter;
    int64_t *futhark_mc_segred_task_236422_total_runtime;
    int *futhark_mc_segred_task_236422_runs;
    int64_t *futhark_mc_segred_task_236422_iter;
    int64_t futhark_mc_segred_task_236422_total_time;
    int64_t futhark_mc_segred_task_236422_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236435_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236435_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236435_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236435_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236435_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236435_total_iter;
    int64_t *futhark_mc_segred_task_236431_total_runtime;
    int *futhark_mc_segred_task_236431_runs;
    int64_t *futhark_mc_segred_task_236431_iter;
    int64_t futhark_mc_segred_task_236431_total_time;
    int64_t futhark_mc_segred_task_236431_total_iter;
    int64_t *futhark_mc_segmap_parloop_236412_total_runtime;
    int *futhark_mc_segmap_parloop_236412_runs;
    int64_t *futhark_mc_segmap_parloop_236412_iter;
    int64_t futhark_mc_segmap_parloop_236412_total_total_runtime;
    int futhark_mc_segmap_parloop_236412_total_runs;
    int64_t futhark_mc_segmap_parloop_236412_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236410_total_runtime;
    int *futhark_mc_segmap_nested_task_236410_runs;
    int64_t *futhark_mc_segmap_nested_task_236410_iter;
    int64_t *futhark_mc_segmap_parloop_236399_total_runtime;
    int *futhark_mc_segmap_parloop_236399_runs;
    int64_t *futhark_mc_segmap_parloop_236399_iter;
    int64_t futhark_mc_segmap_parloop_236399_total_total_runtime;
    int futhark_mc_segmap_parloop_236399_total_runs;
    int64_t futhark_mc_segmap_parloop_236399_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236397_total_runtime;
    int *futhark_mc_segmap_nested_task_236397_runs;
    int64_t *futhark_mc_segmap_nested_task_236397_iter;
    int64_t *futhark_mc_segmap_parloop_236439_total_runtime;
    int *futhark_mc_segmap_parloop_236439_runs;
    int64_t *futhark_mc_segmap_parloop_236439_iter;
    int64_t futhark_mc_segmap_parloop_236439_total_total_runtime;
    int futhark_mc_segmap_parloop_236439_total_runs;
    int64_t futhark_mc_segmap_parloop_236439_total_iter;
    int64_t *futhark_mc_segmap_task_236437_total_runtime;
    int *futhark_mc_segmap_task_236437_runs;
    int64_t *futhark_mc_segmap_task_236437_iter;
    int64_t futhark_mc_segmap_task_236437_total_time;
    int64_t futhark_mc_segmap_task_236437_total_iter;
    int64_t *futhark_mc_segmap_parloop_236448_total_runtime;
    int *futhark_mc_segmap_parloop_236448_runs;
    int64_t *futhark_mc_segmap_parloop_236448_iter;
    int64_t futhark_mc_segmap_parloop_236448_total_total_runtime;
    int futhark_mc_segmap_parloop_236448_total_runs;
    int64_t futhark_mc_segmap_parloop_236448_total_iter;
    int64_t *futhark_mc_segmap_task_236446_total_runtime;
    int *futhark_mc_segmap_task_236446_runs;
    int64_t *futhark_mc_segmap_task_236446_iter;
    int64_t futhark_mc_segmap_task_236446_total_time;
    int64_t futhark_mc_segmap_task_236446_total_iter;
    int64_t *futhark_mc_segmap_parloop_236443_total_runtime;
    int *futhark_mc_segmap_parloop_236443_runs;
    int64_t *futhark_mc_segmap_parloop_236443_iter;
    int64_t futhark_mc_segmap_parloop_236443_total_total_runtime;
    int futhark_mc_segmap_parloop_236443_total_runs;
    int64_t futhark_mc_segmap_parloop_236443_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236441_total_runtime;
    int *futhark_mc_segmap_nested_task_236441_runs;
    int64_t *futhark_mc_segmap_nested_task_236441_iter;
    int64_t *futhark_mc_segmap_parloop_236452_total_runtime;
    int *futhark_mc_segmap_parloop_236452_runs;
    int64_t *futhark_mc_segmap_parloop_236452_iter;
    int64_t futhark_mc_segmap_parloop_236452_total_total_runtime;
    int futhark_mc_segmap_parloop_236452_total_runs;
    int64_t futhark_mc_segmap_parloop_236452_total_iter;
    int64_t *futhark_mc_segmap_task_236450_total_runtime;
    int *futhark_mc_segmap_task_236450_runs;
    int64_t *futhark_mc_segmap_task_236450_iter;
    int64_t futhark_mc_segmap_task_236450_total_time;
    int64_t futhark_mc_segmap_task_236450_total_iter;
    int64_t *futhark_mc_segmap_parloop_236461_total_runtime;
    int *futhark_mc_segmap_parloop_236461_runs;
    int64_t *futhark_mc_segmap_parloop_236461_iter;
    int64_t futhark_mc_segmap_parloop_236461_total_total_runtime;
    int futhark_mc_segmap_parloop_236461_total_runs;
    int64_t futhark_mc_segmap_parloop_236461_total_iter;
    int64_t *futhark_mc_segmap_task_236459_total_runtime;
    int *futhark_mc_segmap_task_236459_runs;
    int64_t *futhark_mc_segmap_task_236459_iter;
    int64_t futhark_mc_segmap_task_236459_total_time;
    int64_t futhark_mc_segmap_task_236459_total_iter;
    int64_t *futhark_mc_segmap_parloop_236456_total_runtime;
    int *futhark_mc_segmap_parloop_236456_runs;
    int64_t *futhark_mc_segmap_parloop_236456_iter;
    int64_t futhark_mc_segmap_parloop_236456_total_total_runtime;
    int futhark_mc_segmap_parloop_236456_total_runs;
    int64_t futhark_mc_segmap_parloop_236456_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236454_total_runtime;
    int *futhark_mc_segmap_nested_task_236454_runs;
    int64_t *futhark_mc_segmap_nested_task_236454_iter;
    int64_t *futhark_mc_segmap_parloop_236465_total_runtime;
    int *futhark_mc_segmap_parloop_236465_runs;
    int64_t *futhark_mc_segmap_parloop_236465_iter;
    int64_t futhark_mc_segmap_parloop_236465_total_total_runtime;
    int futhark_mc_segmap_parloop_236465_total_runs;
    int64_t futhark_mc_segmap_parloop_236465_total_iter;
    int64_t *futhark_mc_segmap_task_236463_total_runtime;
    int *futhark_mc_segmap_task_236463_runs;
    int64_t *futhark_mc_segmap_task_236463_iter;
    int64_t futhark_mc_segmap_task_236463_total_time;
    int64_t futhark_mc_segmap_task_236463_total_iter;
    int64_t *futhark_mc_segmap_parloop_236480_total_runtime;
    int *futhark_mc_segmap_parloop_236480_runs;
    int64_t *futhark_mc_segmap_parloop_236480_iter;
    int64_t futhark_mc_segmap_parloop_236480_total_total_runtime;
    int futhark_mc_segmap_parloop_236480_total_runs;
    int64_t futhark_mc_segmap_parloop_236480_total_iter;
    int64_t *futhark_mc_segmap_task_236478_total_runtime;
    int *futhark_mc_segmap_task_236478_runs;
    int64_t *futhark_mc_segmap_task_236478_iter;
    int64_t futhark_mc_segmap_task_236478_total_time;
    int64_t futhark_mc_segmap_task_236478_total_iter;
    int64_t *futhark_mc_segmap_parloop_236484_total_runtime;
    int *futhark_mc_segmap_parloop_236484_runs;
    int64_t *futhark_mc_segmap_parloop_236484_iter;
    int64_t futhark_mc_segmap_parloop_236484_total_total_runtime;
    int futhark_mc_segmap_parloop_236484_total_runs;
    int64_t futhark_mc_segmap_parloop_236484_total_iter;
    int64_t *futhark_mc_segmap_task_236482_total_runtime;
    int *futhark_mc_segmap_task_236482_runs;
    int64_t *futhark_mc_segmap_task_236482_iter;
    int64_t futhark_mc_segmap_task_236482_total_time;
    int64_t futhark_mc_segmap_task_236482_total_iter;
    int64_t *futhark_mc_segmap_parloop_236488_total_runtime;
    int *futhark_mc_segmap_parloop_236488_runs;
    int64_t *futhark_mc_segmap_parloop_236488_iter;
    int64_t futhark_mc_segmap_parloop_236488_total_total_runtime;
    int futhark_mc_segmap_parloop_236488_total_runs;
    int64_t futhark_mc_segmap_parloop_236488_total_iter;
    int64_t *futhark_mc_segmap_task_236486_total_runtime;
    int *futhark_mc_segmap_task_236486_runs;
    int64_t *futhark_mc_segmap_task_236486_iter;
    int64_t futhark_mc_segmap_task_236486_total_time;
    int64_t futhark_mc_segmap_task_236486_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236496_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236496_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236496_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236496_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236496_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236496_total_iter;
    int64_t *futhark_mc_segred_task_236493_total_runtime;
    int *futhark_mc_segred_task_236493_runs;
    int64_t *futhark_mc_segred_task_236493_iter;
    int64_t futhark_mc_segred_task_236493_total_time;
    int64_t futhark_mc_segred_task_236493_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236501_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236501_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236501_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236501_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236501_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236501_total_iter;
    int64_t *futhark_mc_segred_task_236498_total_runtime;
    int *futhark_mc_segred_task_236498_runs;
    int64_t *futhark_mc_segred_task_236498_iter;
    int64_t futhark_mc_segred_task_236498_total_time;
    int64_t futhark_mc_segred_task_236498_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_236472_total_runtime;
    int *futhark_mc_segmap_parloop_236472_runs;
    int64_t *futhark_mc_segmap_parloop_236472_iter;
    int64_t futhark_mc_segmap_parloop_236472_total_total_runtime;
    int futhark_mc_segmap_parloop_236472_total_runs;
    int64_t futhark_mc_segmap_parloop_236472_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236470_total_runtime;
    int *futhark_mc_segmap_nested_task_236470_runs;
    int64_t *futhark_mc_segmap_nested_task_236470_iter;
    int64_t *futhark_mc_segmap_parloop_236505_total_runtime;
    int *futhark_mc_segmap_parloop_236505_runs;
    int64_t *futhark_mc_segmap_parloop_236505_iter;
    int64_t futhark_mc_segmap_parloop_236505_total_total_runtime;
    int futhark_mc_segmap_parloop_236505_total_runs;
    int64_t futhark_mc_segmap_parloop_236505_total_iter;
    int64_t *futhark_mc_segmap_task_236503_total_runtime;
    int *futhark_mc_segmap_task_236503_runs;
    int64_t *futhark_mc_segmap_task_236503_iter;
    int64_t futhark_mc_segmap_task_236503_total_time;
    int64_t futhark_mc_segmap_task_236503_total_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_task_236520_total_runtime;
    int *futhark_mc_segmap_task_236520_runs;
    int64_t *futhark_mc_segmap_task_236520_iter;
    int64_t futhark_mc_segmap_task_236520_total_time;
    int64_t futhark_mc_segmap_task_236520_total_iter;
    int64_t *futhark_mc_segmap_parloop_236526_total_runtime;
    int *futhark_mc_segmap_parloop_236526_runs;
    int64_t *futhark_mc_segmap_parloop_236526_iter;
    int64_t futhark_mc_segmap_parloop_236526_total_total_runtime;
    int futhark_mc_segmap_parloop_236526_total_runs;
    int64_t futhark_mc_segmap_parloop_236526_total_iter;
    int64_t *futhark_mc_segmap_task_236524_total_runtime;
    int *futhark_mc_segmap_task_236524_runs;
    int64_t *futhark_mc_segmap_task_236524_iter;
    int64_t futhark_mc_segmap_task_236524_total_time;
    int64_t futhark_mc_segmap_task_236524_total_iter;
    int64_t *futhark_mc_segmap_parloop_236530_total_runtime;
    int *futhark_mc_segmap_parloop_236530_runs;
    int64_t *futhark_mc_segmap_parloop_236530_iter;
    int64_t futhark_mc_segmap_parloop_236530_total_total_runtime;
    int futhark_mc_segmap_parloop_236530_total_runs;
    int64_t futhark_mc_segmap_parloop_236530_total_iter;
    int64_t *futhark_mc_segmap_task_236528_total_runtime;
    int *futhark_mc_segmap_task_236528_runs;
    int64_t *futhark_mc_segmap_task_236528_iter;
    int64_t futhark_mc_segmap_task_236528_total_time;
    int64_t futhark_mc_segmap_task_236528_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236540_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236540_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236540_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236540_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236540_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236540_total_iter;
    int64_t *futhark_mc_segred_task_236535_total_runtime;
    int *futhark_mc_segred_task_236535_runs;
    int64_t *futhark_mc_segred_task_236535_iter;
    int64_t futhark_mc_segred_task_236535_total_time;
    int64_t futhark_mc_segred_task_236535_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236546_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236546_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236546_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236546_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236546_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236546_total_iter;
    int64_t *futhark_mc_segred_task_236542_total_runtime;
    int *futhark_mc_segred_task_236542_runs;
    int64_t *futhark_mc_segred_task_236542_iter;
    int64_t futhark_mc_segred_task_236542_total_time;
    int64_t futhark_mc_segred_task_236542_total_iter;
    int64_t *futhark_mc_segmap_parloop_236533_total_runtime;
    int *futhark_mc_segmap_parloop_236533_runs;
    int64_t *futhark_mc_segmap_parloop_236533_iter;
    int64_t futhark_mc_segmap_parloop_236533_total_total_runtime;
    int futhark_mc_segmap_parloop_236533_total_runs;
    int64_t futhark_mc_segmap_parloop_236533_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236531_total_runtime;
    int *futhark_mc_segmap_nested_task_236531_runs;
    int64_t *futhark_mc_segmap_nested_task_236531_iter;
    int64_t *futhark_mc_segmap_parloop_236513_total_runtime;
    int *futhark_mc_segmap_parloop_236513_runs;
    int64_t *futhark_mc_segmap_parloop_236513_iter;
    int64_t futhark_mc_segmap_parloop_236513_total_total_runtime;
    int futhark_mc_segmap_parloop_236513_total_runs;
    int64_t futhark_mc_segmap_parloop_236513_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236511_total_runtime;
    int *futhark_mc_segmap_nested_task_236511_runs;
    int64_t *futhark_mc_segmap_nested_task_236511_iter;
    int64_t *futhark_mc_segmap_parloop_236550_total_runtime;
    int *futhark_mc_segmap_parloop_236550_runs;
    int64_t *futhark_mc_segmap_parloop_236550_iter;
    int64_t futhark_mc_segmap_parloop_236550_total_total_runtime;
    int futhark_mc_segmap_parloop_236550_total_runs;
    int64_t futhark_mc_segmap_parloop_236550_total_iter;
    int64_t *futhark_mc_segmap_task_236548_total_runtime;
    int *futhark_mc_segmap_task_236548_runs;
    int64_t *futhark_mc_segmap_task_236548_iter;
    int64_t futhark_mc_segmap_task_236548_total_time;
    int64_t futhark_mc_segmap_task_236548_total_iter;
    int64_t *futhark_mc_segmap_parloop_236567_total_runtime;
    int *futhark_mc_segmap_parloop_236567_runs;
    int64_t *futhark_mc_segmap_parloop_236567_iter;
    int64_t futhark_mc_segmap_parloop_236567_total_total_runtime;
    int futhark_mc_segmap_parloop_236567_total_runs;
    int64_t futhark_mc_segmap_parloop_236567_total_iter;
    int64_t *futhark_mc_segmap_task_236565_total_runtime;
    int *futhark_mc_segmap_task_236565_runs;
    int64_t *futhark_mc_segmap_task_236565_iter;
    int64_t futhark_mc_segmap_task_236565_total_time;
    int64_t futhark_mc_segmap_task_236565_total_iter;
    int64_t *futhark_mc_segmap_parloop_236571_total_runtime;
    int *futhark_mc_segmap_parloop_236571_runs;
    int64_t *futhark_mc_segmap_parloop_236571_iter;
    int64_t futhark_mc_segmap_parloop_236571_total_total_runtime;
    int futhark_mc_segmap_parloop_236571_total_runs;
    int64_t futhark_mc_segmap_parloop_236571_total_iter;
    int64_t *futhark_mc_segmap_task_236569_total_runtime;
    int *futhark_mc_segmap_task_236569_runs;
    int64_t *futhark_mc_segmap_task_236569_iter;
    int64_t futhark_mc_segmap_task_236569_total_time;
    int64_t futhark_mc_segmap_task_236569_total_iter;
    int64_t *futhark_mc_segmap_parloop_236575_total_runtime;
    int *futhark_mc_segmap_parloop_236575_runs;
    int64_t *futhark_mc_segmap_parloop_236575_iter;
    int64_t futhark_mc_segmap_parloop_236575_total_total_runtime;
    int futhark_mc_segmap_parloop_236575_total_runs;
    int64_t futhark_mc_segmap_parloop_236575_total_iter;
    int64_t *futhark_mc_segmap_task_236573_total_runtime;
    int *futhark_mc_segmap_task_236573_runs;
    int64_t *futhark_mc_segmap_task_236573_iter;
    int64_t futhark_mc_segmap_task_236573_total_time;
    int64_t futhark_mc_segmap_task_236573_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236587_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236587_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236587_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236587_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236587_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236587_total_iter;
    int64_t *futhark_mc_segred_task_236580_total_runtime;
    int *futhark_mc_segred_task_236580_runs;
    int64_t *futhark_mc_segred_task_236580_iter;
    int64_t futhark_mc_segred_task_236580_total_time;
    int64_t futhark_mc_segred_task_236580_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236593_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236593_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236593_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236593_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236593_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236593_total_iter;
    int64_t *futhark_mc_segred_task_236589_total_runtime;
    int *futhark_mc_segred_task_236589_runs;
    int64_t *futhark_mc_segred_task_236589_iter;
    int64_t futhark_mc_segred_task_236589_total_time;
    int64_t futhark_mc_segred_task_236589_total_iter;
    int64_t *futhark_mc_segmap_parloop_236578_total_runtime;
    int *futhark_mc_segmap_parloop_236578_runs;
    int64_t *futhark_mc_segmap_parloop_236578_iter;
    int64_t futhark_mc_segmap_parloop_236578_total_total_runtime;
    int futhark_mc_segmap_parloop_236578_total_runs;
    int64_t futhark_mc_segmap_parloop_236578_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236576_total_runtime;
    int *futhark_mc_segmap_nested_task_236576_runs;
    int64_t *futhark_mc_segmap_nested_task_236576_iter;
    int64_t *futhark_mc_segmap_parloop_236558_total_runtime;
    int *futhark_mc_segmap_parloop_236558_runs;
    int64_t *futhark_mc_segmap_parloop_236558_iter;
    int64_t futhark_mc_segmap_parloop_236558_total_total_runtime;
    int futhark_mc_segmap_parloop_236558_total_runs;
    int64_t futhark_mc_segmap_parloop_236558_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236556_total_runtime;
    int *futhark_mc_segmap_nested_task_236556_runs;
    int64_t *futhark_mc_segmap_nested_task_236556_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_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_task_236611_total_runtime;
    int *futhark_mc_segmap_task_236611_runs;
    int64_t *futhark_mc_segmap_task_236611_iter;
    int64_t futhark_mc_segmap_task_236611_total_time;
    int64_t futhark_mc_segmap_task_236611_total_iter;
    int64_t *futhark_mc_segmap_parloop_236617_total_runtime;
    int *futhark_mc_segmap_parloop_236617_runs;
    int64_t *futhark_mc_segmap_parloop_236617_iter;
    int64_t futhark_mc_segmap_parloop_236617_total_total_runtime;
    int futhark_mc_segmap_parloop_236617_total_runs;
    int64_t futhark_mc_segmap_parloop_236617_total_iter;
    int64_t *futhark_mc_segmap_task_236615_total_runtime;
    int *futhark_mc_segmap_task_236615_runs;
    int64_t *futhark_mc_segmap_task_236615_iter;
    int64_t futhark_mc_segmap_task_236615_total_time;
    int64_t futhark_mc_segmap_task_236615_total_iter;
    int64_t *futhark_mc_segmap_parloop_236621_total_runtime;
    int *futhark_mc_segmap_parloop_236621_runs;
    int64_t *futhark_mc_segmap_parloop_236621_iter;
    int64_t futhark_mc_segmap_parloop_236621_total_total_runtime;
    int futhark_mc_segmap_parloop_236621_total_runs;
    int64_t futhark_mc_segmap_parloop_236621_total_iter;
    int64_t *futhark_mc_segmap_task_236619_total_runtime;
    int *futhark_mc_segmap_task_236619_runs;
    int64_t *futhark_mc_segmap_task_236619_iter;
    int64_t futhark_mc_segmap_task_236619_total_time;
    int64_t futhark_mc_segmap_task_236619_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236631_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236631_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236631_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236631_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236631_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236631_total_iter;
    int64_t *futhark_mc_segred_task_236628_total_runtime;
    int *futhark_mc_segred_task_236628_runs;
    int64_t *futhark_mc_segred_task_236628_iter;
    int64_t futhark_mc_segred_task_236628_total_time;
    int64_t futhark_mc_segred_task_236628_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236636_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236636_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236636_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236636_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236636_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236636_total_iter;
    int64_t *futhark_mc_segred_task_236633_total_runtime;
    int *futhark_mc_segred_task_236633_runs;
    int64_t *futhark_mc_segred_task_236633_iter;
    int64_t futhark_mc_segred_task_236633_total_time;
    int64_t futhark_mc_segred_task_236633_total_iter;
    int64_t *futhark_mc_segmap_parloop_236625_total_runtime;
    int *futhark_mc_segmap_parloop_236625_runs;
    int64_t *futhark_mc_segmap_parloop_236625_iter;
    int64_t futhark_mc_segmap_parloop_236625_total_total_runtime;
    int futhark_mc_segmap_parloop_236625_total_runs;
    int64_t futhark_mc_segmap_parloop_236625_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236623_total_runtime;
    int *futhark_mc_segmap_nested_task_236623_runs;
    int64_t *futhark_mc_segmap_nested_task_236623_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_nested_task_236603_total_runtime;
    int *futhark_mc_segmap_nested_task_236603_runs;
    int64_t *futhark_mc_segmap_nested_task_236603_iter;
    int64_t *futhark_mc_segmap_parloop_236640_total_runtime;
    int *futhark_mc_segmap_parloop_236640_runs;
    int64_t *futhark_mc_segmap_parloop_236640_iter;
    int64_t futhark_mc_segmap_parloop_236640_total_total_runtime;
    int futhark_mc_segmap_parloop_236640_total_runs;
    int64_t futhark_mc_segmap_parloop_236640_total_iter;
    int64_t *futhark_mc_segmap_task_236638_total_runtime;
    int *futhark_mc_segmap_task_236638_runs;
    int64_t *futhark_mc_segmap_task_236638_iter;
    int64_t futhark_mc_segmap_task_236638_total_time;
    int64_t futhark_mc_segmap_task_236638_total_iter;
    int64_t *futhark_mc_segmap_parloop_236659_total_runtime;
    int *futhark_mc_segmap_parloop_236659_runs;
    int64_t *futhark_mc_segmap_parloop_236659_iter;
    int64_t futhark_mc_segmap_parloop_236659_total_total_runtime;
    int futhark_mc_segmap_parloop_236659_total_runs;
    int64_t futhark_mc_segmap_parloop_236659_total_iter;
    int64_t *futhark_mc_segmap_task_236657_total_runtime;
    int *futhark_mc_segmap_task_236657_runs;
    int64_t *futhark_mc_segmap_task_236657_iter;
    int64_t futhark_mc_segmap_task_236657_total_time;
    int64_t futhark_mc_segmap_task_236657_total_iter;
    int64_t *futhark_mc_segmap_parloop_236663_total_runtime;
    int *futhark_mc_segmap_parloop_236663_runs;
    int64_t *futhark_mc_segmap_parloop_236663_iter;
    int64_t futhark_mc_segmap_parloop_236663_total_total_runtime;
    int futhark_mc_segmap_parloop_236663_total_runs;
    int64_t futhark_mc_segmap_parloop_236663_total_iter;
    int64_t *futhark_mc_segmap_task_236661_total_runtime;
    int *futhark_mc_segmap_task_236661_runs;
    int64_t *futhark_mc_segmap_task_236661_iter;
    int64_t futhark_mc_segmap_task_236661_total_time;
    int64_t futhark_mc_segmap_task_236661_total_iter;
    int64_t *futhark_mc_segmap_parloop_236667_total_runtime;
    int *futhark_mc_segmap_parloop_236667_runs;
    int64_t *futhark_mc_segmap_parloop_236667_iter;
    int64_t futhark_mc_segmap_parloop_236667_total_total_runtime;
    int futhark_mc_segmap_parloop_236667_total_runs;
    int64_t futhark_mc_segmap_parloop_236667_total_iter;
    int64_t *futhark_mc_segmap_task_236665_total_runtime;
    int *futhark_mc_segmap_task_236665_runs;
    int64_t *futhark_mc_segmap_task_236665_iter;
    int64_t futhark_mc_segmap_task_236665_total_time;
    int64_t futhark_mc_segmap_task_236665_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236681_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236681_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236681_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236681_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236681_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236681_total_iter;
    int64_t *futhark_mc_segred_task_236676_total_runtime;
    int *futhark_mc_segred_task_236676_runs;
    int64_t *futhark_mc_segred_task_236676_iter;
    int64_t futhark_mc_segred_task_236676_total_time;
    int64_t futhark_mc_segred_task_236676_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236687_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236687_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236687_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236687_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236687_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236687_total_iter;
    int64_t *futhark_mc_segred_task_236683_total_runtime;
    int *futhark_mc_segred_task_236683_runs;
    int64_t *futhark_mc_segred_task_236683_iter;
    int64_t futhark_mc_segred_task_236683_total_time;
    int64_t futhark_mc_segred_task_236683_total_iter;
    int64_t *futhark_mc_segmap_parloop_236672_total_runtime;
    int *futhark_mc_segmap_parloop_236672_runs;
    int64_t *futhark_mc_segmap_parloop_236672_iter;
    int64_t futhark_mc_segmap_parloop_236672_total_total_runtime;
    int futhark_mc_segmap_parloop_236672_total_runs;
    int64_t futhark_mc_segmap_parloop_236672_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236670_total_runtime;
    int *futhark_mc_segmap_nested_task_236670_runs;
    int64_t *futhark_mc_segmap_nested_task_236670_iter;
    int64_t *futhark_mc_segmap_parloop_236650_total_runtime;
    int *futhark_mc_segmap_parloop_236650_runs;
    int64_t *futhark_mc_segmap_parloop_236650_iter;
    int64_t futhark_mc_segmap_parloop_236650_total_total_runtime;
    int futhark_mc_segmap_parloop_236650_total_runs;
    int64_t futhark_mc_segmap_parloop_236650_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236648_total_runtime;
    int *futhark_mc_segmap_nested_task_236648_runs;
    int64_t *futhark_mc_segmap_nested_task_236648_iter;
    int64_t *futhark_mc_segmap_parloop_236691_total_runtime;
    int *futhark_mc_segmap_parloop_236691_runs;
    int64_t *futhark_mc_segmap_parloop_236691_iter;
    int64_t futhark_mc_segmap_parloop_236691_total_total_runtime;
    int futhark_mc_segmap_parloop_236691_total_runs;
    int64_t futhark_mc_segmap_parloop_236691_total_iter;
    int64_t *futhark_mc_segmap_task_236689_total_runtime;
    int *futhark_mc_segmap_task_236689_runs;
    int64_t *futhark_mc_segmap_task_236689_iter;
    int64_t futhark_mc_segmap_task_236689_total_time;
    int64_t futhark_mc_segmap_task_236689_total_iter;
    int64_t *futhark_mc_segmap_parloop_236712_total_runtime;
    int *futhark_mc_segmap_parloop_236712_runs;
    int64_t *futhark_mc_segmap_parloop_236712_iter;
    int64_t futhark_mc_segmap_parloop_236712_total_total_runtime;
    int futhark_mc_segmap_parloop_236712_total_runs;
    int64_t futhark_mc_segmap_parloop_236712_total_iter;
    int64_t *futhark_mc_segmap_task_236710_total_runtime;
    int *futhark_mc_segmap_task_236710_runs;
    int64_t *futhark_mc_segmap_task_236710_iter;
    int64_t futhark_mc_segmap_task_236710_total_time;
    int64_t futhark_mc_segmap_task_236710_total_iter;
    int64_t *futhark_mc_segmap_parloop_236716_total_runtime;
    int *futhark_mc_segmap_parloop_236716_runs;
    int64_t *futhark_mc_segmap_parloop_236716_iter;
    int64_t futhark_mc_segmap_parloop_236716_total_total_runtime;
    int futhark_mc_segmap_parloop_236716_total_runs;
    int64_t futhark_mc_segmap_parloop_236716_total_iter;
    int64_t *futhark_mc_segmap_task_236714_total_runtime;
    int *futhark_mc_segmap_task_236714_runs;
    int64_t *futhark_mc_segmap_task_236714_iter;
    int64_t futhark_mc_segmap_task_236714_total_time;
    int64_t futhark_mc_segmap_task_236714_total_iter;
    int64_t *futhark_mc_segmap_parloop_236720_total_runtime;
    int *futhark_mc_segmap_parloop_236720_runs;
    int64_t *futhark_mc_segmap_parloop_236720_iter;
    int64_t futhark_mc_segmap_parloop_236720_total_total_runtime;
    int futhark_mc_segmap_parloop_236720_total_runs;
    int64_t futhark_mc_segmap_parloop_236720_total_iter;
    int64_t *futhark_mc_segmap_task_236718_total_runtime;
    int *futhark_mc_segmap_task_236718_runs;
    int64_t *futhark_mc_segmap_task_236718_iter;
    int64_t futhark_mc_segmap_task_236718_total_time;
    int64_t futhark_mc_segmap_task_236718_total_iter;
    int64_t *futhark_mc_segmap_parloop_236735_total_runtime;
    int *futhark_mc_segmap_parloop_236735_runs;
    int64_t *futhark_mc_segmap_parloop_236735_iter;
    int64_t futhark_mc_segmap_parloop_236735_total_total_runtime;
    int futhark_mc_segmap_parloop_236735_total_runs;
    int64_t futhark_mc_segmap_parloop_236735_total_iter;
    int64_t *futhark_mc_segmap_task_236733_total_runtime;
    int *futhark_mc_segmap_task_236733_runs;
    int64_t *futhark_mc_segmap_task_236733_iter;
    int64_t futhark_mc_segmap_task_236733_total_time;
    int64_t futhark_mc_segmap_task_236733_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236744_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236744_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236744_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236744_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236744_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236744_total_iter;
    int64_t *futhark_mc_segred_task_236737_total_runtime;
    int *futhark_mc_segred_task_236737_runs;
    int64_t *futhark_mc_segred_task_236737_iter;
    int64_t futhark_mc_segred_task_236737_total_time;
    int64_t futhark_mc_segred_task_236737_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236750_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236750_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236750_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236750_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236750_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236750_total_iter;
    int64_t *futhark_mc_segred_task_236746_total_runtime;
    int *futhark_mc_segred_task_236746_runs;
    int64_t *futhark_mc_segred_task_236746_iter;
    int64_t futhark_mc_segred_task_236746_total_time;
    int64_t futhark_mc_segred_task_236746_total_iter;
    int64_t *futhark_mc_segmap_parloop_236727_total_runtime;
    int *futhark_mc_segmap_parloop_236727_runs;
    int64_t *futhark_mc_segmap_parloop_236727_iter;
    int64_t futhark_mc_segmap_parloop_236727_total_total_runtime;
    int futhark_mc_segmap_parloop_236727_total_runs;
    int64_t futhark_mc_segmap_parloop_236727_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236725_total_runtime;
    int *futhark_mc_segmap_nested_task_236725_runs;
    int64_t *futhark_mc_segmap_nested_task_236725_iter;
    int64_t *futhark_mc_segmap_parloop_236703_total_runtime;
    int *futhark_mc_segmap_parloop_236703_runs;
    int64_t *futhark_mc_segmap_parloop_236703_iter;
    int64_t futhark_mc_segmap_parloop_236703_total_total_runtime;
    int futhark_mc_segmap_parloop_236703_total_runs;
    int64_t futhark_mc_segmap_parloop_236703_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236701_total_runtime;
    int *futhark_mc_segmap_nested_task_236701_runs;
    int64_t *futhark_mc_segmap_nested_task_236701_iter;
    int64_t *futhark_mc_segmap_parloop_236754_total_runtime;
    int *futhark_mc_segmap_parloop_236754_runs;
    int64_t *futhark_mc_segmap_parloop_236754_iter;
    int64_t futhark_mc_segmap_parloop_236754_total_total_runtime;
    int futhark_mc_segmap_parloop_236754_total_runs;
    int64_t futhark_mc_segmap_parloop_236754_total_iter;
    int64_t *futhark_mc_segmap_task_236752_total_runtime;
    int *futhark_mc_segmap_task_236752_runs;
    int64_t *futhark_mc_segmap_task_236752_iter;
    int64_t futhark_mc_segmap_task_236752_total_time;
    int64_t futhark_mc_segmap_task_236752_total_iter;
    int64_t *futhark_mc_segmap_parloop_236763_total_runtime;
    int *futhark_mc_segmap_parloop_236763_runs;
    int64_t *futhark_mc_segmap_parloop_236763_iter;
    int64_t futhark_mc_segmap_parloop_236763_total_total_runtime;
    int futhark_mc_segmap_parloop_236763_total_runs;
    int64_t futhark_mc_segmap_parloop_236763_total_iter;
    int64_t *futhark_mc_segmap_task_236761_total_runtime;
    int *futhark_mc_segmap_task_236761_runs;
    int64_t *futhark_mc_segmap_task_236761_iter;
    int64_t futhark_mc_segmap_task_236761_total_time;
    int64_t futhark_mc_segmap_task_236761_total_iter;
    int64_t *futhark_mc_segmap_parloop_236758_total_runtime;
    int *futhark_mc_segmap_parloop_236758_runs;
    int64_t *futhark_mc_segmap_parloop_236758_iter;
    int64_t futhark_mc_segmap_parloop_236758_total_total_runtime;
    int futhark_mc_segmap_parloop_236758_total_runs;
    int64_t futhark_mc_segmap_parloop_236758_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236756_total_runtime;
    int *futhark_mc_segmap_nested_task_236756_runs;
    int64_t *futhark_mc_segmap_nested_task_236756_iter;
    int64_t *futhark_mc_segmap_parloop_236767_total_runtime;
    int *futhark_mc_segmap_parloop_236767_runs;
    int64_t *futhark_mc_segmap_parloop_236767_iter;
    int64_t futhark_mc_segmap_parloop_236767_total_total_runtime;
    int futhark_mc_segmap_parloop_236767_total_runs;
    int64_t futhark_mc_segmap_parloop_236767_total_iter;
    int64_t *futhark_mc_segmap_task_236765_total_runtime;
    int *futhark_mc_segmap_task_236765_runs;
    int64_t *futhark_mc_segmap_task_236765_iter;
    int64_t futhark_mc_segmap_task_236765_total_time;
    int64_t futhark_mc_segmap_task_236765_total_iter;
    int64_t *futhark_mc_segmap_parloop_236778_total_runtime;
    int *futhark_mc_segmap_parloop_236778_runs;
    int64_t *futhark_mc_segmap_parloop_236778_iter;
    int64_t futhark_mc_segmap_parloop_236778_total_total_runtime;
    int futhark_mc_segmap_parloop_236778_total_runs;
    int64_t futhark_mc_segmap_parloop_236778_total_iter;
    int64_t *futhark_mc_segmap_task_236776_total_runtime;
    int *futhark_mc_segmap_task_236776_runs;
    int64_t *futhark_mc_segmap_task_236776_iter;
    int64_t futhark_mc_segmap_task_236776_total_time;
    int64_t futhark_mc_segmap_task_236776_total_iter;
    int64_t *futhark_mc_segmap_parloop_236782_total_runtime;
    int *futhark_mc_segmap_parloop_236782_runs;
    int64_t *futhark_mc_segmap_parloop_236782_iter;
    int64_t futhark_mc_segmap_parloop_236782_total_total_runtime;
    int futhark_mc_segmap_parloop_236782_total_runs;
    int64_t futhark_mc_segmap_parloop_236782_total_iter;
    int64_t *futhark_mc_segmap_task_236780_total_runtime;
    int *futhark_mc_segmap_task_236780_runs;
    int64_t *futhark_mc_segmap_task_236780_iter;
    int64_t futhark_mc_segmap_task_236780_total_time;
    int64_t futhark_mc_segmap_task_236780_total_iter;
    int64_t *futhark_mc_segmap_parloop_236772_total_runtime;
    int *futhark_mc_segmap_parloop_236772_runs;
    int64_t *futhark_mc_segmap_parloop_236772_iter;
    int64_t futhark_mc_segmap_parloop_236772_total_total_runtime;
    int futhark_mc_segmap_parloop_236772_total_runs;
    int64_t futhark_mc_segmap_parloop_236772_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236770_total_runtime;
    int *futhark_mc_segmap_nested_task_236770_runs;
    int64_t *futhark_mc_segmap_nested_task_236770_iter;
    int64_t *futhark_mc_segmap_parloop_236786_total_runtime;
    int *futhark_mc_segmap_parloop_236786_runs;
    int64_t *futhark_mc_segmap_parloop_236786_iter;
    int64_t futhark_mc_segmap_parloop_236786_total_total_runtime;
    int futhark_mc_segmap_parloop_236786_total_runs;
    int64_t futhark_mc_segmap_parloop_236786_total_iter;
    int64_t *futhark_mc_segmap_task_236784_total_runtime;
    int *futhark_mc_segmap_task_236784_runs;
    int64_t *futhark_mc_segmap_task_236784_iter;
    int64_t futhark_mc_segmap_task_236784_total_time;
    int64_t futhark_mc_segmap_task_236784_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_236807_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_236807_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_236807_iter;
    int64_t futhark_mc_scan_stage_1_parloop_236807_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_236807_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_236807_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_236809_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_236809_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_236809_iter;
    int64_t futhark_mc_scan_stage_3_parloop_236809_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_236809_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_236809_total_iter;
    int64_t *futhark_mc_segscan_task_236801_total_runtime;
    int *futhark_mc_segscan_task_236801_runs;
    int64_t *futhark_mc_segscan_task_236801_iter;
    int64_t futhark_mc_segscan_task_236801_total_time;
    int64_t futhark_mc_segscan_task_236801_total_iter;
    int64_t *futhark_mc_segmap_parloop_236813_total_runtime;
    int *futhark_mc_segmap_parloop_236813_runs;
    int64_t *futhark_mc_segmap_parloop_236813_iter;
    int64_t futhark_mc_segmap_parloop_236813_total_total_runtime;
    int futhark_mc_segmap_parloop_236813_total_runs;
    int64_t futhark_mc_segmap_parloop_236813_total_iter;
    int64_t *futhark_mc_segmap_task_236811_total_runtime;
    int *futhark_mc_segmap_task_236811_runs;
    int64_t *futhark_mc_segmap_task_236811_iter;
    int64_t futhark_mc_segmap_task_236811_total_time;
    int64_t futhark_mc_segmap_task_236811_total_iter;
    int64_t *futhark_mc_segmap_parloop_236794_total_runtime;
    int *futhark_mc_segmap_parloop_236794_runs;
    int64_t *futhark_mc_segmap_parloop_236794_iter;
    int64_t futhark_mc_segmap_parloop_236794_total_total_runtime;
    int futhark_mc_segmap_parloop_236794_total_runs;
    int64_t futhark_mc_segmap_parloop_236794_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236792_total_runtime;
    int *futhark_mc_segmap_nested_task_236792_runs;
    int64_t *futhark_mc_segmap_nested_task_236792_iter;
    int64_t *futhark_mc_segmap_parloop_236817_total_runtime;
    int *futhark_mc_segmap_parloop_236817_runs;
    int64_t *futhark_mc_segmap_parloop_236817_iter;
    int64_t futhark_mc_segmap_parloop_236817_total_total_runtime;
    int futhark_mc_segmap_parloop_236817_total_runs;
    int64_t futhark_mc_segmap_parloop_236817_total_iter;
    int64_t *futhark_mc_segmap_task_236815_total_runtime;
    int *futhark_mc_segmap_task_236815_runs;
    int64_t *futhark_mc_segmap_task_236815_iter;
    int64_t futhark_mc_segmap_task_236815_total_time;
    int64_t futhark_mc_segmap_task_236815_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_236825_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_236825_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_236825_iter;
    int64_t futhark_mc_segred_stage_1_parloop_236825_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_236825_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_236825_total_iter;
    int64_t *futhark_mc_segred_task_236822_total_runtime;
    int *futhark_mc_segred_task_236822_runs;
    int64_t *futhark_mc_segred_task_236822_iter;
    int64_t futhark_mc_segred_task_236822_total_time;
    int64_t futhark_mc_segred_task_236822_total_iter;
    int64_t *futhark_mc_segmap_parloop_236820_total_runtime;
    int *futhark_mc_segmap_parloop_236820_runs;
    int64_t *futhark_mc_segmap_parloop_236820_iter;
    int64_t futhark_mc_segmap_parloop_236820_total_total_runtime;
    int futhark_mc_segmap_parloop_236820_total_runs;
    int64_t futhark_mc_segmap_parloop_236820_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236818_total_runtime;
    int *futhark_mc_segmap_nested_task_236818_runs;
    int64_t *futhark_mc_segmap_nested_task_236818_iter;
    int64_t *futhark_mc_segmap_parloop_236829_total_runtime;
    int *futhark_mc_segmap_parloop_236829_runs;
    int64_t *futhark_mc_segmap_parloop_236829_iter;
    int64_t futhark_mc_segmap_parloop_236829_total_total_runtime;
    int futhark_mc_segmap_parloop_236829_total_runs;
    int64_t futhark_mc_segmap_parloop_236829_total_iter;
    int64_t *futhark_mc_segmap_task_236827_total_runtime;
    int *futhark_mc_segmap_task_236827_runs;
    int64_t *futhark_mc_segmap_task_236827_iter;
    int64_t futhark_mc_segmap_task_236827_total_time;
    int64_t futhark_mc_segmap_task_236827_total_iter;
    int64_t *futhark_mc_segmap_parloop_236838_total_runtime;
    int *futhark_mc_segmap_parloop_236838_runs;
    int64_t *futhark_mc_segmap_parloop_236838_iter;
    int64_t futhark_mc_segmap_parloop_236838_total_total_runtime;
    int futhark_mc_segmap_parloop_236838_total_runs;
    int64_t futhark_mc_segmap_parloop_236838_total_iter;
    int64_t *futhark_mc_segmap_task_236836_total_runtime;
    int *futhark_mc_segmap_task_236836_runs;
    int64_t *futhark_mc_segmap_task_236836_iter;
    int64_t futhark_mc_segmap_task_236836_total_time;
    int64_t futhark_mc_segmap_task_236836_total_iter;
    int64_t *futhark_mc_segmap_parloop_236833_total_runtime;
    int *futhark_mc_segmap_parloop_236833_runs;
    int64_t *futhark_mc_segmap_parloop_236833_iter;
    int64_t futhark_mc_segmap_parloop_236833_total_total_runtime;
    int futhark_mc_segmap_parloop_236833_total_runs;
    int64_t futhark_mc_segmap_parloop_236833_total_iter;
    int64_t *futhark_mc_segmap_nested_task_236831_total_runtime;
    int *futhark_mc_segmap_nested_task_236831_runs;
    int64_t *futhark_mc_segmap_nested_task_236831_iter;
    int64_t *futhark_mc_segmap_parloop_236847_total_runtime;
    int *futhark_mc_segmap_parloop_236847_runs;
    int64_t *futhark_mc_segmap_parloop_236847_iter;
    int64_t futhark_mc_segmap_parloop_236847_total_total_runtime;
    int futhark_mc_segmap_parloop_236847_total_runs;
    int64_t futhark_mc_segmap_parloop_236847_total_iter;
    int64_t *futhark_mc_segmap_task_236845_total_runtime;
    int *futhark_mc_segmap_task_236845_runs;
    int64_t *futhark_mc_segmap_task_236845_iter;
    int64_t futhark_mc_segmap_task_236845_total_time;
    int64_t futhark_mc_segmap_task_236845_total_iter;
    int64_t *futhark_mc_segmap_parloop_236842_total_runtime;
    int *futhark_mc_segmap_parloop_236842_runs;
    int64_t *futhark_mc_segmap_parloop_236842_iter;
    int64_t futhark_mc_segmap_parloop_236842_total_total_runtime;
    int futhark_mc_segmap_parloop_236842_total_runs;
    int64_t futhark_mc_segmap_parloop_236842_total_iter;
    int64_t *futhark_mc_segmap_task_236840_total_runtime;
    int *futhark_mc_segmap_task_236840_runs;
    int64_t *futhark_mc_segmap_task_236840_iter;
    int64_t futhark_mc_segmap_task_236840_total_time;
    int64_t futhark_mc_segmap_task_236840_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_235583_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235583_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235583_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235583_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235583_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235583_total_iter = 0;
    ctx->futhark_mc_segred_task_235580_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235580_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235580_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235580_total_time = 0;
    ctx->futhark_mc_segred_task_235580_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235593_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235593_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235593_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235593_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235593_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235593_total_iter = 0;
    ctx->futhark_mc_segmap_task_235591_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235591_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235591_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235591_total_time = 0;
    ctx->futhark_mc_segmap_task_235591_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235598_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235598_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235598_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235598_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235598_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235598_total_iter = 0;
    ctx->futhark_mc_segred_task_235595_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235595_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235595_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235595_total_time = 0;
    ctx->futhark_mc_segred_task_235595_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235588_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235588_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235588_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235588_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235588_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235588_total_iter = 0;
    ctx->futhark_mc_segred_nested_task_235585_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235585_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235585_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235578_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235578_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235578_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235578_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235578_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235578_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235603_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235603_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235603_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235603_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235603_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235603_total_iter = 0;
    ctx->futhark_mc_segred_task_235600_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235600_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235600_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235600_total_time = 0;
    ctx->futhark_mc_segred_task_235600_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_segred_stage_1_parloop_235618_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235618_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235618_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235618_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235618_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235618_total_iter = 0;
    ctx->futhark_mc_segred_task_235615_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235615_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235615_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235615_total_time = 0;
    ctx->futhark_mc_segred_task_235615_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235608_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235608_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235608_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235608_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235608_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235608_total_iter = 0;
    ctx->futhark_mc_segred_nested_task_235605_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235605_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235605_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235625_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235625_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235625_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235625_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235625_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235625_total_iter = 0;
    ctx->futhark_mc_segred_task_235622_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235622_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235622_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235622_total_time = 0;
    ctx->futhark_mc_segred_task_235622_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235635_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235635_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235635_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235635_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235635_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235635_total_iter = 0;
    ctx->futhark_mc_segmap_task_235633_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235633_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235633_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235633_total_time = 0;
    ctx->futhark_mc_segmap_task_235633_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235640_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235640_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235640_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235640_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235640_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235640_total_iter = 0;
    ctx->futhark_mc_segred_task_235637_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235637_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235637_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235637_total_time = 0;
    ctx->futhark_mc_segred_task_235637_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235630_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235630_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235630_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235630_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235630_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235630_total_iter = 0;
    ctx->futhark_mc_segred_nested_task_235627_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235627_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_nested_task_235627_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235620_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235620_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235620_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235620_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235620_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235620_total_iter = 0;
    ctx->futhark_mc_segscan_task_235575_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235575_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235575_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235575_total_time = 0;
    ctx->futhark_mc_segscan_task_235575_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235644_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235644_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235644_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235644_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235644_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235644_total_iter = 0;
    ctx->futhark_mc_segmap_task_235642_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235642_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235642_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235642_total_time = 0;
    ctx->futhark_mc_segmap_task_235642_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235648_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235648_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235648_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235648_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235648_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235648_total_iter = 0;
    ctx->futhark_mc_segmap_task_235646_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235646_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235646_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235646_total_time = 0;
    ctx->futhark_mc_segmap_task_235646_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235660_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235660_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235660_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235660_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235660_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235660_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235662_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235662_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235662_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235662_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235662_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235662_total_iter = 0;
    ctx->futhark_mc_segscan_task_235657_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235657_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235657_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235657_total_time = 0;
    ctx->futhark_mc_segscan_task_235657_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235666_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235666_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235666_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235666_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235666_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235666_total_iter = 0;
    ctx->futhark_mc_segmap_task_235664_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235664_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235664_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235664_total_time = 0;
    ctx->futhark_mc_segmap_task_235664_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235653_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235653_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235653_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235653_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235653_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235653_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235651_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235651_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235651_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235670_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235670_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235670_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235670_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235670_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235670_total_iter = 0;
    ctx->futhark_mc_segmap_task_235668_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235668_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235668_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235668_total_time = 0;
    ctx->futhark_mc_segmap_task_235668_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235679_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235679_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235679_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235679_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235679_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235679_total_iter = 0;
    ctx->futhark_mc_segmap_task_235677_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235677_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235677_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235677_total_time = 0;
    ctx->futhark_mc_segmap_task_235677_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235688_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235688_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235688_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235688_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235688_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235688_total_iter = 0;
    ctx->futhark_mc_segmap_task_235686_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235686_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235686_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235686_total_time = 0;
    ctx->futhark_mc_segmap_task_235686_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235683_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235683_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235683_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235683_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235683_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235683_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235681_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235681_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235681_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235674_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235674_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235674_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235674_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235674_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235674_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235672_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235672_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235672_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235692_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235692_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235692_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235692_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235692_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235692_total_iter = 0;
    ctx->futhark_mc_segmap_task_235690_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235690_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235690_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235690_total_time = 0;
    ctx->futhark_mc_segmap_task_235690_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235705_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235705_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235705_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235705_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235705_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235705_total_iter = 0;
    ctx->futhark_mc_segmap_task_235703_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235703_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235703_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235703_total_time = 0;
    ctx->futhark_mc_segmap_task_235703_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235717_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235717_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235717_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_235717_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235717_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_235717_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235719_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235719_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235719_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_235719_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235719_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_235719_total_iter = 0;
    ctx->futhark_mc_segscan_task_235714_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235714_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235714_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_235714_total_time = 0;
    ctx->futhark_mc_segscan_task_235714_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235723_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235723_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235723_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235723_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235723_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235723_total_iter = 0;
    ctx->futhark_mc_segmap_task_235721_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235721_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235721_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235721_total_time = 0;
    ctx->futhark_mc_segmap_task_235721_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235710_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235710_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235710_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235710_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235710_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235710_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235708_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235708_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235708_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235699_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235699_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235699_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235699_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235699_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235699_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235697_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235697_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235697_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235727_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235727_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235727_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235727_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235727_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235727_total_iter = 0;
    ctx->futhark_mc_segmap_task_235725_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235725_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235725_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235725_total_time = 0;
    ctx->futhark_mc_segmap_task_235725_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235739_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235739_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235739_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235739_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235739_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235739_total_iter = 0;
    ctx->futhark_mc_segmap_task_235737_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235737_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235737_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235737_total_time = 0;
    ctx->futhark_mc_segmap_task_235737_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235752_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235752_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235752_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235752_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235752_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235752_total_iter = 0;
    ctx->futhark_mc_segmap_task_235750_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235750_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235750_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235750_total_time = 0;
    ctx->futhark_mc_segmap_task_235750_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235756_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235756_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235756_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235756_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235756_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235756_total_iter = 0;
    ctx->futhark_mc_segmap_task_235754_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235754_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235754_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235754_total_time = 0;
    ctx->futhark_mc_segmap_task_235754_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235745_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235745_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235745_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235745_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235745_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235745_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235743_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235743_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235743_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235733_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235733_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235733_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235733_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235733_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235733_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235731_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235731_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235731_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235760_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235760_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235760_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235760_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235760_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235760_total_iter = 0;
    ctx->futhark_mc_segmap_task_235758_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235758_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235758_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235758_total_time = 0;
    ctx->futhark_mc_segmap_task_235758_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235773_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235773_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235773_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235773_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235773_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235773_total_iter = 0;
    ctx->futhark_mc_segmap_task_235771_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235771_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235771_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235771_total_time = 0;
    ctx->futhark_mc_segmap_task_235771_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235777_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235777_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235777_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235777_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235777_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235777_total_iter = 0;
    ctx->futhark_mc_segmap_task_235775_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235775_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235775_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235775_total_time = 0;
    ctx->futhark_mc_segmap_task_235775_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235766_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235766_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235766_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235766_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235766_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235766_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235764_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235764_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235764_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_235794_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235794_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235794_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235794_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235794_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235794_total_iter = 0;
    ctx->futhark_mc_segmap_task_235792_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235792_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235792_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235792_total_time = 0;
    ctx->futhark_mc_segmap_task_235792_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235798_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235798_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235798_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235798_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235798_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235798_total_iter = 0;
    ctx->futhark_mc_segmap_task_235796_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235796_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235796_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235796_total_time = 0;
    ctx->futhark_mc_segmap_task_235796_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235787_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235787_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235787_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235787_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235787_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235787_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235785_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235785_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235785_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235802_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235802_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235802_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235802_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235802_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235802_total_iter = 0;
    ctx->futhark_mc_segmap_task_235800_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235800_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235800_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235800_total_time = 0;
    ctx->futhark_mc_segmap_task_235800_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235811_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235811_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235811_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235811_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235811_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235811_total_iter = 0;
    ctx->futhark_mc_segmap_task_235809_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235809_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235809_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235809_total_time = 0;
    ctx->futhark_mc_segmap_task_235809_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235806_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235806_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235806_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235806_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235806_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235806_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235804_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235804_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235804_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235815_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235815_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235815_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235815_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235815_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235815_total_iter = 0;
    ctx->futhark_mc_segmap_task_235813_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235813_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235813_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235813_total_time = 0;
    ctx->futhark_mc_segmap_task_235813_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235826_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235826_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235826_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235826_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235826_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235826_total_iter = 0;
    ctx->futhark_mc_segmap_task_235824_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235824_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235824_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235824_total_time = 0;
    ctx->futhark_mc_segmap_task_235824_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235837_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235837_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235837_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235837_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235837_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235837_total_iter = 0;
    ctx->futhark_mc_segmap_task_235835_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235835_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235835_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235835_total_time = 0;
    ctx->futhark_mc_segmap_task_235835_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235831_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235831_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235831_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235831_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235831_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235831_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235829_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235829_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235829_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_nested_task_235818_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235818_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235818_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235841_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235841_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235841_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235841_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235841_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235841_total_iter = 0;
    ctx->futhark_mc_segmap_task_235839_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235839_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235839_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235839_total_time = 0;
    ctx->futhark_mc_segmap_task_235839_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235850_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235850_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235850_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235850_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235850_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235850_total_iter = 0;
    ctx->futhark_mc_segmap_task_235848_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235848_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235848_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235848_total_time = 0;
    ctx->futhark_mc_segmap_task_235848_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235859_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235859_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235859_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235859_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235859_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235859_total_iter = 0;
    ctx->futhark_mc_segmap_task_235857_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235857_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235857_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235857_total_time = 0;
    ctx->futhark_mc_segmap_task_235857_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235867_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235867_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235867_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235867_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235867_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235867_total_iter = 0;
    ctx->futhark_mc_segred_task_235864_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235864_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235864_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235864_total_time = 0;
    ctx->futhark_mc_segred_task_235864_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235872_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235872_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235872_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235872_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235872_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235872_total_iter = 0;
    ctx->futhark_mc_segred_task_235869_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235869_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235869_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235869_total_time = 0;
    ctx->futhark_mc_segred_task_235869_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235862_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235862_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235862_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235862_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235862_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235862_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235860_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235860_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235860_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235854_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235854_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235854_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235854_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235854_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235854_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235852_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235852_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235852_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235845_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235845_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235845_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235845_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235845_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235845_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235843_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235843_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235843_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235876_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235876_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235876_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235876_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235876_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235876_total_iter = 0;
    ctx->futhark_mc_segmap_task_235874_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235874_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235874_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235874_total_time = 0;
    ctx->futhark_mc_segmap_task_235874_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235887_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235887_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235887_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235887_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235887_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235887_total_iter = 0;
    ctx->futhark_mc_segmap_task_235885_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235885_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235885_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235885_total_time = 0;
    ctx->futhark_mc_segmap_task_235885_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235898_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235898_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235898_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235898_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235898_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235898_total_iter = 0;
    ctx->futhark_mc_segmap_task_235896_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235896_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235896_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235896_total_time = 0;
    ctx->futhark_mc_segmap_task_235896_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235908_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235908_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235908_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235908_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235908_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235908_total_iter = 0;
    ctx->futhark_mc_segred_task_235903_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235903_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235903_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235903_total_time = 0;
    ctx->futhark_mc_segred_task_235903_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235914_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235914_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235914_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235914_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235914_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235914_total_iter = 0;
    ctx->futhark_mc_segred_task_235910_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235910_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235910_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235910_total_time = 0;
    ctx->futhark_mc_segred_task_235910_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235901_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235901_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235901_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235901_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235901_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235901_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235899_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235899_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235899_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235892_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235892_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235892_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235892_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235892_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235892_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235890_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235890_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235890_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235881_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235881_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235881_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235881_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235881_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235881_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235879_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235879_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235879_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235918_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235918_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235918_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235918_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235918_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235918_total_iter = 0;
    ctx->futhark_mc_segmap_task_235916_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235916_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235916_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235916_total_time = 0;
    ctx->futhark_mc_segmap_task_235916_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235929_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235929_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235929_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235929_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235929_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235929_total_iter = 0;
    ctx->futhark_mc_segmap_task_235927_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235927_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235927_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235927_total_time = 0;
    ctx->futhark_mc_segmap_task_235927_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235940_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235940_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235940_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235940_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235940_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235940_total_iter = 0;
    ctx->futhark_mc_segmap_task_235938_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235938_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235938_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235938_total_time = 0;
    ctx->futhark_mc_segmap_task_235938_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235952_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235952_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235952_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235952_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235952_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235952_total_iter = 0;
    ctx->futhark_mc_segred_task_235945_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235945_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235945_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235945_total_time = 0;
    ctx->futhark_mc_segred_task_235945_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235958_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235958_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235958_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235958_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235958_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235958_total_iter = 0;
    ctx->futhark_mc_segred_task_235954_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235954_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235954_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235954_total_time = 0;
    ctx->futhark_mc_segred_task_235954_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_nested_task_235941_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235941_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235941_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_nested_task_235932_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235932_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235932_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235923_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235923_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235923_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235923_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235923_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235923_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235921_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235921_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235921_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235962_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235962_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235962_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235962_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235962_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235962_total_iter = 0;
    ctx->futhark_mc_segmap_task_235960_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235960_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235960_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235960_total_time = 0;
    ctx->futhark_mc_segmap_task_235960_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_task_235970_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235970_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235970_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235970_total_time = 0;
    ctx->futhark_mc_segmap_task_235970_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235982_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235982_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235982_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235982_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235982_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235982_total_iter = 0;
    ctx->futhark_mc_segmap_task_235980_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235980_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235980_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235980_total_time = 0;
    ctx->futhark_mc_segmap_task_235980_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235992_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235992_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235992_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235992_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235992_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235992_total_iter = 0;
    ctx->futhark_mc_segred_task_235989_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235989_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235989_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235989_total_time = 0;
    ctx->futhark_mc_segred_task_235989_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235997_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235997_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235997_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_235997_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235997_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_235997_total_iter = 0;
    ctx->futhark_mc_segred_task_235994_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235994_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235994_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_235994_total_time = 0;
    ctx->futhark_mc_segred_task_235994_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_235986_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235986_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235986_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235986_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235986_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235986_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235984_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235984_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235984_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235977_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235977_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235977_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235977_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235977_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235977_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235975_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235975_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235975_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235967_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235967_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235967_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_235967_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_235967_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_235967_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_235965_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235965_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_235965_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236001_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236001_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236001_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236001_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236001_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236001_total_iter = 0;
    ctx->futhark_mc_segmap_task_235999_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235999_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235999_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_235999_total_time = 0;
    ctx->futhark_mc_segmap_task_235999_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236014_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236014_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236014_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236014_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236014_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236014_total_iter = 0;
    ctx->futhark_mc_segmap_task_236012_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236012_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236012_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236012_total_time = 0;
    ctx->futhark_mc_segmap_task_236012_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236027_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236027_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236027_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236027_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236027_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236027_total_iter = 0;
    ctx->futhark_mc_segmap_task_236025_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236025_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236025_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236025_total_time = 0;
    ctx->futhark_mc_segmap_task_236025_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236041_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236041_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236041_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236041_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236041_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236041_total_iter = 0;
    ctx->futhark_mc_segred_task_236036_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236036_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236036_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236036_total_time = 0;
    ctx->futhark_mc_segred_task_236036_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236047_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236047_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236047_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236047_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236047_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236047_total_iter = 0;
    ctx->futhark_mc_segred_task_236043_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236043_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236043_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236043_total_time = 0;
    ctx->futhark_mc_segred_task_236043_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236032_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236032_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236032_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236032_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236032_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236032_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236030_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236030_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236030_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236021_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236021_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236021_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236021_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236021_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236021_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236019_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236019_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236019_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236008_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236008_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236008_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236008_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236008_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236008_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236006_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236006_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236006_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236051_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236051_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236051_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236051_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236051_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236051_total_iter = 0;
    ctx->futhark_mc_segmap_task_236049_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236049_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236049_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236049_total_time = 0;
    ctx->futhark_mc_segmap_task_236049_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236066_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236066_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236066_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236066_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236066_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236066_total_iter = 0;
    ctx->futhark_mc_segmap_task_236064_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236064_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236064_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236064_total_time = 0;
    ctx->futhark_mc_segmap_task_236064_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236081_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236081_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236081_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236081_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236081_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236081_total_iter = 0;
    ctx->futhark_mc_segmap_task_236079_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236079_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236079_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236079_total_time = 0;
    ctx->futhark_mc_segmap_task_236079_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236096_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236096_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236096_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236096_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236096_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236096_total_iter = 0;
    ctx->futhark_mc_segmap_task_236094_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236094_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236094_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236094_total_time = 0;
    ctx->futhark_mc_segmap_task_236094_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236105_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236105_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236105_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236105_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236105_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236105_total_iter = 0;
    ctx->futhark_mc_segred_task_236098_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236098_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236098_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236098_total_time = 0;
    ctx->futhark_mc_segred_task_236098_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236111_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236111_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236111_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236111_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236111_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236111_total_iter = 0;
    ctx->futhark_mc_segred_task_236107_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236107_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236107_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236107_total_time = 0;
    ctx->futhark_mc_segred_task_236107_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236088_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236088_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236088_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236088_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236088_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236088_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236086_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236086_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236086_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236075_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236075_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236075_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236075_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236075_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236075_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236073_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236073_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236073_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236060_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236060_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236060_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236060_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236060_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236060_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236058_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236058_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236058_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_task_236113_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236113_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236113_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236113_total_time = 0;
    ctx->futhark_mc_segmap_task_236113_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_task_236122_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236122_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236122_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236122_total_time = 0;
    ctx->futhark_mc_segmap_task_236122_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236133_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236133_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236133_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236133_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236133_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236133_total_iter = 0;
    ctx->futhark_mc_segmap_task_236131_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236131_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236131_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236131_total_time = 0;
    ctx->futhark_mc_segmap_task_236131_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236128_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236128_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236128_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236128_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236128_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236128_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236126_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236126_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236126_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236119_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236119_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236119_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236119_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236119_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236119_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236117_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236117_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236117_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236137_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236137_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236137_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236137_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236137_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236137_total_iter = 0;
    ctx->futhark_mc_segmap_task_236135_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236135_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236135_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236135_total_time = 0;
    ctx->futhark_mc_segmap_task_236135_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236146_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236146_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236146_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236146_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236146_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236146_total_iter = 0;
    ctx->futhark_mc_segmap_task_236144_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236144_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236144_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236144_total_time = 0;
    ctx->futhark_mc_segmap_task_236144_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236141_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236141_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236141_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236141_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236141_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236141_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236139_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236139_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236139_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236150_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236150_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236150_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236150_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236150_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236150_total_iter = 0;
    ctx->futhark_mc_segmap_task_236148_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236148_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236148_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236148_total_time = 0;
    ctx->futhark_mc_segmap_task_236148_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236158_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236158_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236158_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236158_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236158_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236158_total_iter = 0;
    ctx->futhark_mc_segred_task_236155_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236155_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236155_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236155_total_time = 0;
    ctx->futhark_mc_segred_task_236155_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_nested_task_236151_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236151_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236151_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236162_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236162_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236162_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236162_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236162_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236162_total_iter = 0;
    ctx->futhark_mc_segmap_task_236160_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236160_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236160_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236160_total_time = 0;
    ctx->futhark_mc_segmap_task_236160_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236172_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236172_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236172_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236172_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236172_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236172_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236174_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236174_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236174_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236174_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236174_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236174_total_iter = 0;
    ctx->futhark_mc_segscan_task_236169_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236169_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236169_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236169_total_time = 0;
    ctx->futhark_mc_segscan_task_236169_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236166_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236166_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236166_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236166_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236166_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236166_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236164_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236164_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236164_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236178_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236178_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236178_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236178_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236178_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236178_total_iter = 0;
    ctx->futhark_mc_segmap_task_236176_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236176_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236176_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236176_total_time = 0;
    ctx->futhark_mc_segmap_task_236176_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236186_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236186_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236186_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236186_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236186_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236186_total_iter = 0;
    ctx->futhark_mc_segred_task_236183_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236183_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236183_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236183_total_time = 0;
    ctx->futhark_mc_segred_task_236183_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236181_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236181_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236181_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236181_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236181_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236181_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236179_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236179_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236179_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    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_task_236188_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236188_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236188_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236188_total_time = 0;
    ctx->futhark_mc_segmap_task_236188_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236200_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236200_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236200_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236200_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236200_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236200_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236202_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236202_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236202_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236202_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236202_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236202_total_iter = 0;
    ctx->futhark_mc_segscan_task_236197_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236197_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236197_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236197_total_time = 0;
    ctx->futhark_mc_segscan_task_236197_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236194_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236194_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236194_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236194_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236194_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236194_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236192_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236192_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236192_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236206_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236206_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236206_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236206_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236206_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236206_total_iter = 0;
    ctx->futhark_mc_segmap_task_236204_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236204_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236204_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236204_total_time = 0;
    ctx->futhark_mc_segmap_task_236204_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236214_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236214_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236214_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236214_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236214_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236214_total_iter = 0;
    ctx->futhark_mc_segred_task_236211_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236211_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236211_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236211_total_time = 0;
    ctx->futhark_mc_segred_task_236211_total_iter = 0;
    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_nested_task_236207_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236207_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236207_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_task_236216_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236216_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236216_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236216_total_time = 0;
    ctx->futhark_mc_segmap_task_236216_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236228_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236228_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236228_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236228_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236228_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236228_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236230_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236230_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236230_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236230_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236230_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236230_total_iter = 0;
    ctx->futhark_mc_segscan_task_236225_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236225_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236225_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236225_total_time = 0;
    ctx->futhark_mc_segscan_task_236225_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236222_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236222_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236222_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236222_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236222_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236222_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236220_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236220_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236220_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236234_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236234_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236234_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236234_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236234_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236234_total_iter = 0;
    ctx->futhark_mc_segmap_task_236232_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236232_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236232_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236232_total_time = 0;
    ctx->futhark_mc_segmap_task_236232_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236243_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236243_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236243_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236243_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236243_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236243_total_iter = 0;
    ctx->futhark_mc_segmap_task_236241_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236241_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236241_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236241_total_time = 0;
    ctx->futhark_mc_segmap_task_236241_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236251_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236251_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236251_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236251_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236251_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236251_total_iter = 0;
    ctx->futhark_mc_segred_task_236248_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236248_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236248_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236248_total_time = 0;
    ctx->futhark_mc_segred_task_236248_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236256_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236256_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236256_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236256_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236256_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236256_total_iter = 0;
    ctx->futhark_mc_segred_task_236253_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236253_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236253_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236253_total_time = 0;
    ctx->futhark_mc_segred_task_236253_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236246_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236246_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236246_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236246_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236246_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236246_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236244_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236244_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236244_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236238_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236238_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236238_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236238_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236238_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236238_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236236_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236236_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236236_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236260_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236260_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236260_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236260_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236260_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236260_total_iter = 0;
    ctx->futhark_mc_segmap_task_236258_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236258_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236258_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236258_total_time = 0;
    ctx->futhark_mc_segmap_task_236258_total_iter = 0;
    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_segred_stage_1_parloop_236281_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236281_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236281_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236281_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236281_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236281_total_iter = 0;
    ctx->futhark_mc_segred_task_236276_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236276_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236276_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236276_total_time = 0;
    ctx->futhark_mc_segred_task_236276_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236287_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236287_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236287_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236287_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236287_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236287_total_iter = 0;
    ctx->futhark_mc_segred_task_236283_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236283_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236283_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236283_total_time = 0;
    ctx->futhark_mc_segred_task_236283_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236274_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236274_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236274_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236274_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236274_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236274_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236272_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236272_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236272_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236265_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236265_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236265_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236265_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236265_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236265_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236263_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236263_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236263_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_task_236289_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236289_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236289_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236289_total_time = 0;
    ctx->futhark_mc_segmap_task_236289_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236302_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236302_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236302_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236302_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236302_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236302_total_iter = 0;
    ctx->futhark_mc_segmap_task_236300_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236300_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236300_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236300_total_time = 0;
    ctx->futhark_mc_segmap_task_236300_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236314_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236314_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236314_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236314_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236314_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236314_total_iter = 0;
    ctx->futhark_mc_segred_task_236307_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236307_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236307_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236307_total_time = 0;
    ctx->futhark_mc_segred_task_236307_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_236316_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236316_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236316_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236316_total_time = 0;
    ctx->futhark_mc_segred_task_236316_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236305_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236305_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236305_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236305_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236305_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236305_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236303_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236303_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236303_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236296_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236296_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236296_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236296_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236296_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236296_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236294_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236294_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236294_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_236334_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236334_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236334_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236334_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236334_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236334_total_iter = 0;
    ctx->futhark_mc_segmap_task_236332_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236332_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236332_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236332_total_time = 0;
    ctx->futhark_mc_segmap_task_236332_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236344_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236344_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236344_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236344_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236344_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236344_total_iter = 0;
    ctx->futhark_mc_segred_task_236341_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236341_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236341_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236341_total_time = 0;
    ctx->futhark_mc_segred_task_236341_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236349_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236349_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236349_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236349_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236349_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236349_total_iter = 0;
    ctx->futhark_mc_segred_task_236346_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236346_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236346_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236346_total_time = 0;
    ctx->futhark_mc_segred_task_236346_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236338_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236338_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236338_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236338_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236338_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236338_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236336_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236336_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236336_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236329_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236329_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236329_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236329_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236329_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236329_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236327_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236327_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236327_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236353_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236353_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236353_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236353_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236353_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236353_total_iter = 0;
    ctx->futhark_mc_segmap_task_236351_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236351_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236351_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236351_total_time = 0;
    ctx->futhark_mc_segmap_task_236351_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236366_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236366_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236366_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236366_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236366_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236366_total_iter = 0;
    ctx->futhark_mc_segmap_task_236364_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236364_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236364_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236364_total_time = 0;
    ctx->futhark_mc_segmap_task_236364_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236380_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236380_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236380_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236380_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236380_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236380_total_iter = 0;
    ctx->futhark_mc_segred_task_236375_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236375_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236375_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236375_total_time = 0;
    ctx->futhark_mc_segred_task_236375_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236386_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236386_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236386_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236386_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236386_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236386_total_iter = 0;
    ctx->futhark_mc_segred_task_236382_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236382_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236382_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236382_total_time = 0;
    ctx->futhark_mc_segred_task_236382_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236371_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236371_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236371_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236371_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236371_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236371_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236369_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236369_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236369_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236360_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236360_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236360_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236360_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236360_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236360_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236358_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236358_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236358_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    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_236405_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236405_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236405_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236405_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236405_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236405_total_iter = 0;
    ctx->futhark_mc_segmap_task_236403_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236403_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236403_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236403_total_time = 0;
    ctx->futhark_mc_segmap_task_236403_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236420_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236420_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236420_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236420_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236420_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236420_total_iter = 0;
    ctx->futhark_mc_segmap_task_236418_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236418_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236418_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236418_total_time = 0;
    ctx->futhark_mc_segmap_task_236418_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236429_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236429_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236429_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236429_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236429_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236429_total_iter = 0;
    ctx->futhark_mc_segred_task_236422_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236422_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236422_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236422_total_time = 0;
    ctx->futhark_mc_segred_task_236422_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236435_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236435_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236435_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236435_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236435_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236435_total_iter = 0;
    ctx->futhark_mc_segred_task_236431_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236431_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236431_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236431_total_time = 0;
    ctx->futhark_mc_segred_task_236431_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236412_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236412_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236412_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236412_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236412_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236412_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236410_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236410_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236410_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236399_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236399_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236399_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236399_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236399_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236399_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236397_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236397_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236397_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236439_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236439_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236439_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236439_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236439_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236439_total_iter = 0;
    ctx->futhark_mc_segmap_task_236437_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236437_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236437_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236437_total_time = 0;
    ctx->futhark_mc_segmap_task_236437_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236448_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236448_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236448_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236448_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236448_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236448_total_iter = 0;
    ctx->futhark_mc_segmap_task_236446_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236446_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236446_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236446_total_time = 0;
    ctx->futhark_mc_segmap_task_236446_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236443_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236443_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236443_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236443_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236443_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236443_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236441_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236441_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236441_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236452_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236452_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236452_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236452_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236452_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236452_total_iter = 0;
    ctx->futhark_mc_segmap_task_236450_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236450_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236450_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236450_total_time = 0;
    ctx->futhark_mc_segmap_task_236450_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236461_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236461_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236461_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236461_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236461_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236461_total_iter = 0;
    ctx->futhark_mc_segmap_task_236459_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236459_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236459_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236459_total_time = 0;
    ctx->futhark_mc_segmap_task_236459_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236456_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236456_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236456_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236456_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236456_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236456_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236454_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236454_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236454_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236465_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236465_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236465_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236465_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236465_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236465_total_iter = 0;
    ctx->futhark_mc_segmap_task_236463_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236463_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236463_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236463_total_time = 0;
    ctx->futhark_mc_segmap_task_236463_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236480_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236480_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236480_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236480_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236480_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236480_total_iter = 0;
    ctx->futhark_mc_segmap_task_236478_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236478_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236478_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236478_total_time = 0;
    ctx->futhark_mc_segmap_task_236478_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236484_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236484_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236484_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236484_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236484_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236484_total_iter = 0;
    ctx->futhark_mc_segmap_task_236482_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236482_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236482_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236482_total_time = 0;
    ctx->futhark_mc_segmap_task_236482_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236488_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236488_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236488_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236488_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236488_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236488_total_iter = 0;
    ctx->futhark_mc_segmap_task_236486_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236486_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236486_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236486_total_time = 0;
    ctx->futhark_mc_segmap_task_236486_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236496_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236496_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236496_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236496_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236496_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236496_total_iter = 0;
    ctx->futhark_mc_segred_task_236493_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236493_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236493_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236493_total_time = 0;
    ctx->futhark_mc_segred_task_236493_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236501_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236501_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236501_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236501_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236501_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236501_total_iter = 0;
    ctx->futhark_mc_segred_task_236498_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236498_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236498_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236498_total_time = 0;
    ctx->futhark_mc_segred_task_236498_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_236472_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236472_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236472_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236472_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236472_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236472_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236470_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236470_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236470_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236505_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236505_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236505_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236505_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236505_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236505_total_iter = 0;
    ctx->futhark_mc_segmap_task_236503_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236503_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236503_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236503_total_time = 0;
    ctx->futhark_mc_segmap_task_236503_total_iter = 0;
    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_task_236520_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236520_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236520_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236520_total_time = 0;
    ctx->futhark_mc_segmap_task_236520_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236526_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236526_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236526_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236526_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236526_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236526_total_iter = 0;
    ctx->futhark_mc_segmap_task_236524_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236524_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236524_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236524_total_time = 0;
    ctx->futhark_mc_segmap_task_236524_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236530_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236530_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236530_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236530_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236530_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236530_total_iter = 0;
    ctx->futhark_mc_segmap_task_236528_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236528_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236528_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236528_total_time = 0;
    ctx->futhark_mc_segmap_task_236528_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236540_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236540_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236540_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236540_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236540_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236540_total_iter = 0;
    ctx->futhark_mc_segred_task_236535_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236535_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236535_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236535_total_time = 0;
    ctx->futhark_mc_segred_task_236535_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236546_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236546_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236546_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236546_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236546_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236546_total_iter = 0;
    ctx->futhark_mc_segred_task_236542_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236542_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236542_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236542_total_time = 0;
    ctx->futhark_mc_segred_task_236542_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236533_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236533_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236533_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236533_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236533_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236533_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236531_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236531_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236531_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236513_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236513_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236513_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236513_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236513_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236513_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236511_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236511_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236511_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236550_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236550_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236550_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236550_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236550_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236550_total_iter = 0;
    ctx->futhark_mc_segmap_task_236548_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236548_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236548_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236548_total_time = 0;
    ctx->futhark_mc_segmap_task_236548_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236567_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236567_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236567_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236567_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236567_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236567_total_iter = 0;
    ctx->futhark_mc_segmap_task_236565_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236565_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236565_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236565_total_time = 0;
    ctx->futhark_mc_segmap_task_236565_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236571_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236571_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236571_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236571_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236571_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236571_total_iter = 0;
    ctx->futhark_mc_segmap_task_236569_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236569_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236569_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236569_total_time = 0;
    ctx->futhark_mc_segmap_task_236569_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236575_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236575_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236575_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236575_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236575_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236575_total_iter = 0;
    ctx->futhark_mc_segmap_task_236573_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236573_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236573_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236573_total_time = 0;
    ctx->futhark_mc_segmap_task_236573_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236587_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236587_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236587_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236587_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236587_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236587_total_iter = 0;
    ctx->futhark_mc_segred_task_236580_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236580_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236580_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236580_total_time = 0;
    ctx->futhark_mc_segred_task_236580_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236593_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236593_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236593_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236593_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236593_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236593_total_iter = 0;
    ctx->futhark_mc_segred_task_236589_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236589_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236589_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236589_total_time = 0;
    ctx->futhark_mc_segred_task_236589_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236578_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236578_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236578_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236578_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236578_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236578_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236576_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236576_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236576_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236558_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236558_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236558_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236558_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236558_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236558_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236556_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236556_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236556_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    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_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_task_236611_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236611_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236611_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236611_total_time = 0;
    ctx->futhark_mc_segmap_task_236611_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236617_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236617_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236617_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236617_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236617_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236617_total_iter = 0;
    ctx->futhark_mc_segmap_task_236615_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236615_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236615_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236615_total_time = 0;
    ctx->futhark_mc_segmap_task_236615_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236621_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236621_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236621_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236621_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236621_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236621_total_iter = 0;
    ctx->futhark_mc_segmap_task_236619_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236619_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236619_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236619_total_time = 0;
    ctx->futhark_mc_segmap_task_236619_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236631_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236631_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236631_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236631_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236631_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236631_total_iter = 0;
    ctx->futhark_mc_segred_task_236628_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236628_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236628_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236628_total_time = 0;
    ctx->futhark_mc_segred_task_236628_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236636_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236636_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236636_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236636_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236636_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236636_total_iter = 0;
    ctx->futhark_mc_segred_task_236633_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236633_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236633_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236633_total_time = 0;
    ctx->futhark_mc_segred_task_236633_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236625_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236625_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236625_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236625_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236625_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236625_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236623_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236623_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236623_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_nested_task_236603_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236603_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236603_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236640_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236640_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236640_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236640_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236640_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236640_total_iter = 0;
    ctx->futhark_mc_segmap_task_236638_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236638_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236638_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236638_total_time = 0;
    ctx->futhark_mc_segmap_task_236638_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236659_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236659_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236659_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236659_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236659_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236659_total_iter = 0;
    ctx->futhark_mc_segmap_task_236657_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236657_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236657_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236657_total_time = 0;
    ctx->futhark_mc_segmap_task_236657_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236663_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236663_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236663_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236663_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236663_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236663_total_iter = 0;
    ctx->futhark_mc_segmap_task_236661_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236661_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236661_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236661_total_time = 0;
    ctx->futhark_mc_segmap_task_236661_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236667_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236667_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236667_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236667_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236667_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236667_total_iter = 0;
    ctx->futhark_mc_segmap_task_236665_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236665_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236665_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236665_total_time = 0;
    ctx->futhark_mc_segmap_task_236665_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236681_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236681_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236681_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236681_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236681_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236681_total_iter = 0;
    ctx->futhark_mc_segred_task_236676_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236676_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236676_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236676_total_time = 0;
    ctx->futhark_mc_segred_task_236676_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236687_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236687_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236687_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236687_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236687_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236687_total_iter = 0;
    ctx->futhark_mc_segred_task_236683_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236683_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236683_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236683_total_time = 0;
    ctx->futhark_mc_segred_task_236683_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236672_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236672_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236672_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236672_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236672_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236672_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236670_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236670_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236670_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236650_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236650_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236650_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236650_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236650_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236650_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236648_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236648_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236648_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236691_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236691_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236691_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236691_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236691_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236691_total_iter = 0;
    ctx->futhark_mc_segmap_task_236689_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236689_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236689_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236689_total_time = 0;
    ctx->futhark_mc_segmap_task_236689_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236712_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236712_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236712_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236712_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236712_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236712_total_iter = 0;
    ctx->futhark_mc_segmap_task_236710_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236710_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236710_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236710_total_time = 0;
    ctx->futhark_mc_segmap_task_236710_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236716_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236716_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236716_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236716_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236716_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236716_total_iter = 0;
    ctx->futhark_mc_segmap_task_236714_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236714_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236714_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236714_total_time = 0;
    ctx->futhark_mc_segmap_task_236714_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236720_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236720_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236720_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236720_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236720_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236720_total_iter = 0;
    ctx->futhark_mc_segmap_task_236718_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236718_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236718_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236718_total_time = 0;
    ctx->futhark_mc_segmap_task_236718_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236735_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236735_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236735_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236735_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236735_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236735_total_iter = 0;
    ctx->futhark_mc_segmap_task_236733_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236733_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236733_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236733_total_time = 0;
    ctx->futhark_mc_segmap_task_236733_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236744_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236744_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236744_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236744_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236744_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236744_total_iter = 0;
    ctx->futhark_mc_segred_task_236737_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236737_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236737_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236737_total_time = 0;
    ctx->futhark_mc_segred_task_236737_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236750_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236750_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236750_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236750_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236750_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236750_total_iter = 0;
    ctx->futhark_mc_segred_task_236746_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236746_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236746_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236746_total_time = 0;
    ctx->futhark_mc_segred_task_236746_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236727_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236727_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236727_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236727_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236727_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236727_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236725_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236725_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236725_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236703_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236703_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236703_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236703_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236703_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236703_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236701_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236701_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236701_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236754_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236754_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236754_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236754_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236754_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236754_total_iter = 0;
    ctx->futhark_mc_segmap_task_236752_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236752_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236752_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236752_total_time = 0;
    ctx->futhark_mc_segmap_task_236752_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236763_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236763_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236763_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236763_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236763_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236763_total_iter = 0;
    ctx->futhark_mc_segmap_task_236761_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236761_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236761_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236761_total_time = 0;
    ctx->futhark_mc_segmap_task_236761_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236758_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236758_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236758_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236758_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236758_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236758_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236756_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236756_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236756_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236767_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236767_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236767_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236767_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236767_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236767_total_iter = 0;
    ctx->futhark_mc_segmap_task_236765_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236765_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236765_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236765_total_time = 0;
    ctx->futhark_mc_segmap_task_236765_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236778_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236778_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236778_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236778_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236778_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236778_total_iter = 0;
    ctx->futhark_mc_segmap_task_236776_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236776_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236776_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236776_total_time = 0;
    ctx->futhark_mc_segmap_task_236776_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236782_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236782_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236782_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236782_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236782_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236782_total_iter = 0;
    ctx->futhark_mc_segmap_task_236780_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236780_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236780_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236780_total_time = 0;
    ctx->futhark_mc_segmap_task_236780_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236772_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236772_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236772_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236772_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236772_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236772_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236770_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236770_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236770_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236786_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236786_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236786_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236786_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236786_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236786_total_iter = 0;
    ctx->futhark_mc_segmap_task_236784_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236784_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236784_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236784_total_time = 0;
    ctx->futhark_mc_segmap_task_236784_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236807_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236807_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236807_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_236807_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236807_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_236807_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236809_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236809_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236809_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_236809_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236809_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_236809_total_iter = 0;
    ctx->futhark_mc_segscan_task_236801_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236801_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236801_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_236801_total_time = 0;
    ctx->futhark_mc_segscan_task_236801_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236813_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236813_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236813_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236813_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236813_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236813_total_iter = 0;
    ctx->futhark_mc_segmap_task_236811_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236811_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236811_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236811_total_time = 0;
    ctx->futhark_mc_segmap_task_236811_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236794_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236794_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236794_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236794_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236794_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236794_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236792_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236792_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236792_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236817_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236817_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236817_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236817_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236817_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236817_total_iter = 0;
    ctx->futhark_mc_segmap_task_236815_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236815_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236815_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236815_total_time = 0;
    ctx->futhark_mc_segmap_task_236815_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236825_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236825_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236825_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_236825_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236825_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_236825_total_iter = 0;
    ctx->futhark_mc_segred_task_236822_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236822_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236822_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_236822_total_time = 0;
    ctx->futhark_mc_segred_task_236822_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236820_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236820_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236820_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236820_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236820_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236820_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236818_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236818_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236818_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236829_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236829_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236829_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236829_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236829_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236829_total_iter = 0;
    ctx->futhark_mc_segmap_task_236827_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236827_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236827_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236827_total_time = 0;
    ctx->futhark_mc_segmap_task_236827_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236838_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236838_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236838_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236838_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236838_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236838_total_iter = 0;
    ctx->futhark_mc_segmap_task_236836_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236836_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236836_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236836_total_time = 0;
    ctx->futhark_mc_segmap_task_236836_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236833_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236833_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236833_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236833_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236833_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236833_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_236831_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236831_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_236831_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236847_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236847_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236847_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236847_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236847_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236847_total_iter = 0;
    ctx->futhark_mc_segmap_task_236845_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236845_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236845_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236845_total_time = 0;
    ctx->futhark_mc_segmap_task_236845_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_236842_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236842_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236842_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_236842_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_236842_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_236842_total_iter = 0;
    ctx->futhark_mc_segmap_task_236840_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236840_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236840_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_236840_total_time = 0;
    ctx->futhark_mc_segmap_task_236840_total_iter = 0;
    init_constants(ctx);
    return ctx;
}
void futhark_context_free(struct futhark_context *ctx)
{
    free(ctx->futhark_mc_segred_stage_1_parloop_235583_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235583_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235583_iter);
    free(ctx->futhark_mc_segred_task_235580_total_runtime);
    free(ctx->futhark_mc_segred_task_235580_runs);
    free(ctx->futhark_mc_segred_task_235580_iter);
    free(ctx->futhark_mc_segmap_parloop_235593_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235593_runs);
    free(ctx->futhark_mc_segmap_parloop_235593_iter);
    free(ctx->futhark_mc_segmap_task_235591_total_runtime);
    free(ctx->futhark_mc_segmap_task_235591_runs);
    free(ctx->futhark_mc_segmap_task_235591_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235598_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235598_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235598_iter);
    free(ctx->futhark_mc_segred_task_235595_total_runtime);
    free(ctx->futhark_mc_segred_task_235595_runs);
    free(ctx->futhark_mc_segred_task_235595_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235588_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235588_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235588_iter);
    free(ctx->futhark_mc_segred_nested_task_235585_total_runtime);
    free(ctx->futhark_mc_segred_nested_task_235585_runs);
    free(ctx->futhark_mc_segred_nested_task_235585_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_235578_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_235578_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_235578_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235603_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235603_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235603_iter);
    free(ctx->futhark_mc_segred_task_235600_total_runtime);
    free(ctx->futhark_mc_segred_task_235600_runs);
    free(ctx->futhark_mc_segred_task_235600_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_segred_stage_1_parloop_235618_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235618_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235618_iter);
    free(ctx->futhark_mc_segred_task_235615_total_runtime);
    free(ctx->futhark_mc_segred_task_235615_runs);
    free(ctx->futhark_mc_segred_task_235615_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235608_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235608_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235608_iter);
    free(ctx->futhark_mc_segred_nested_task_235605_total_runtime);
    free(ctx->futhark_mc_segred_nested_task_235605_runs);
    free(ctx->futhark_mc_segred_nested_task_235605_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235625_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235625_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235625_iter);
    free(ctx->futhark_mc_segred_task_235622_total_runtime);
    free(ctx->futhark_mc_segred_task_235622_runs);
    free(ctx->futhark_mc_segred_task_235622_iter);
    free(ctx->futhark_mc_segmap_parloop_235635_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235635_runs);
    free(ctx->futhark_mc_segmap_parloop_235635_iter);
    free(ctx->futhark_mc_segmap_task_235633_total_runtime);
    free(ctx->futhark_mc_segmap_task_235633_runs);
    free(ctx->futhark_mc_segmap_task_235633_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235640_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235640_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235640_iter);
    free(ctx->futhark_mc_segred_task_235637_total_runtime);
    free(ctx->futhark_mc_segred_task_235637_runs);
    free(ctx->futhark_mc_segred_task_235637_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235630_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235630_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235630_iter);
    free(ctx->futhark_mc_segred_nested_task_235627_total_runtime);
    free(ctx->futhark_mc_segred_nested_task_235627_runs);
    free(ctx->futhark_mc_segred_nested_task_235627_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_235620_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_235620_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_235620_iter);
    free(ctx->futhark_mc_segscan_task_235575_total_runtime);
    free(ctx->futhark_mc_segscan_task_235575_runs);
    free(ctx->futhark_mc_segscan_task_235575_iter);
    free(ctx->futhark_mc_segmap_parloop_235644_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235644_runs);
    free(ctx->futhark_mc_segmap_parloop_235644_iter);
    free(ctx->futhark_mc_segmap_task_235642_total_runtime);
    free(ctx->futhark_mc_segmap_task_235642_runs);
    free(ctx->futhark_mc_segmap_task_235642_iter);
    free(ctx->futhark_mc_segmap_parloop_235648_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235648_runs);
    free(ctx->futhark_mc_segmap_parloop_235648_iter);
    free(ctx->futhark_mc_segmap_task_235646_total_runtime);
    free(ctx->futhark_mc_segmap_task_235646_runs);
    free(ctx->futhark_mc_segmap_task_235646_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_235660_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_235660_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_235660_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_235662_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_235662_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_235662_iter);
    free(ctx->futhark_mc_segscan_task_235657_total_runtime);
    free(ctx->futhark_mc_segscan_task_235657_runs);
    free(ctx->futhark_mc_segscan_task_235657_iter);
    free(ctx->futhark_mc_segmap_parloop_235666_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235666_runs);
    free(ctx->futhark_mc_segmap_parloop_235666_iter);
    free(ctx->futhark_mc_segmap_task_235664_total_runtime);
    free(ctx->futhark_mc_segmap_task_235664_runs);
    free(ctx->futhark_mc_segmap_task_235664_iter);
    free(ctx->futhark_mc_segmap_parloop_235653_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235653_runs);
    free(ctx->futhark_mc_segmap_parloop_235653_iter);
    free(ctx->futhark_mc_segmap_nested_task_235651_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235651_runs);
    free(ctx->futhark_mc_segmap_nested_task_235651_iter);
    free(ctx->futhark_mc_segmap_parloop_235670_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235670_runs);
    free(ctx->futhark_mc_segmap_parloop_235670_iter);
    free(ctx->futhark_mc_segmap_task_235668_total_runtime);
    free(ctx->futhark_mc_segmap_task_235668_runs);
    free(ctx->futhark_mc_segmap_task_235668_iter);
    free(ctx->futhark_mc_segmap_parloop_235679_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235679_runs);
    free(ctx->futhark_mc_segmap_parloop_235679_iter);
    free(ctx->futhark_mc_segmap_task_235677_total_runtime);
    free(ctx->futhark_mc_segmap_task_235677_runs);
    free(ctx->futhark_mc_segmap_task_235677_iter);
    free(ctx->futhark_mc_segmap_parloop_235688_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235688_runs);
    free(ctx->futhark_mc_segmap_parloop_235688_iter);
    free(ctx->futhark_mc_segmap_task_235686_total_runtime);
    free(ctx->futhark_mc_segmap_task_235686_runs);
    free(ctx->futhark_mc_segmap_task_235686_iter);
    free(ctx->futhark_mc_segmap_parloop_235683_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235683_runs);
    free(ctx->futhark_mc_segmap_parloop_235683_iter);
    free(ctx->futhark_mc_segmap_nested_task_235681_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235681_runs);
    free(ctx->futhark_mc_segmap_nested_task_235681_iter);
    free(ctx->futhark_mc_segmap_parloop_235674_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235674_runs);
    free(ctx->futhark_mc_segmap_parloop_235674_iter);
    free(ctx->futhark_mc_segmap_nested_task_235672_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235672_runs);
    free(ctx->futhark_mc_segmap_nested_task_235672_iter);
    free(ctx->futhark_mc_segmap_parloop_235692_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235692_runs);
    free(ctx->futhark_mc_segmap_parloop_235692_iter);
    free(ctx->futhark_mc_segmap_task_235690_total_runtime);
    free(ctx->futhark_mc_segmap_task_235690_runs);
    free(ctx->futhark_mc_segmap_task_235690_iter);
    free(ctx->futhark_mc_segmap_parloop_235705_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235705_runs);
    free(ctx->futhark_mc_segmap_parloop_235705_iter);
    free(ctx->futhark_mc_segmap_task_235703_total_runtime);
    free(ctx->futhark_mc_segmap_task_235703_runs);
    free(ctx->futhark_mc_segmap_task_235703_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_235717_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_235717_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_235717_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_235719_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_235719_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_235719_iter);
    free(ctx->futhark_mc_segscan_task_235714_total_runtime);
    free(ctx->futhark_mc_segscan_task_235714_runs);
    free(ctx->futhark_mc_segscan_task_235714_iter);
    free(ctx->futhark_mc_segmap_parloop_235723_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235723_runs);
    free(ctx->futhark_mc_segmap_parloop_235723_iter);
    free(ctx->futhark_mc_segmap_task_235721_total_runtime);
    free(ctx->futhark_mc_segmap_task_235721_runs);
    free(ctx->futhark_mc_segmap_task_235721_iter);
    free(ctx->futhark_mc_segmap_parloop_235710_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235710_runs);
    free(ctx->futhark_mc_segmap_parloop_235710_iter);
    free(ctx->futhark_mc_segmap_nested_task_235708_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235708_runs);
    free(ctx->futhark_mc_segmap_nested_task_235708_iter);
    free(ctx->futhark_mc_segmap_parloop_235699_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235699_runs);
    free(ctx->futhark_mc_segmap_parloop_235699_iter);
    free(ctx->futhark_mc_segmap_nested_task_235697_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235697_runs);
    free(ctx->futhark_mc_segmap_nested_task_235697_iter);
    free(ctx->futhark_mc_segmap_parloop_235727_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235727_runs);
    free(ctx->futhark_mc_segmap_parloop_235727_iter);
    free(ctx->futhark_mc_segmap_task_235725_total_runtime);
    free(ctx->futhark_mc_segmap_task_235725_runs);
    free(ctx->futhark_mc_segmap_task_235725_iter);
    free(ctx->futhark_mc_segmap_parloop_235739_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235739_runs);
    free(ctx->futhark_mc_segmap_parloop_235739_iter);
    free(ctx->futhark_mc_segmap_task_235737_total_runtime);
    free(ctx->futhark_mc_segmap_task_235737_runs);
    free(ctx->futhark_mc_segmap_task_235737_iter);
    free(ctx->futhark_mc_segmap_parloop_235752_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235752_runs);
    free(ctx->futhark_mc_segmap_parloop_235752_iter);
    free(ctx->futhark_mc_segmap_task_235750_total_runtime);
    free(ctx->futhark_mc_segmap_task_235750_runs);
    free(ctx->futhark_mc_segmap_task_235750_iter);
    free(ctx->futhark_mc_segmap_parloop_235756_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235756_runs);
    free(ctx->futhark_mc_segmap_parloop_235756_iter);
    free(ctx->futhark_mc_segmap_task_235754_total_runtime);
    free(ctx->futhark_mc_segmap_task_235754_runs);
    free(ctx->futhark_mc_segmap_task_235754_iter);
    free(ctx->futhark_mc_segmap_parloop_235745_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235745_runs);
    free(ctx->futhark_mc_segmap_parloop_235745_iter);
    free(ctx->futhark_mc_segmap_nested_task_235743_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235743_runs);
    free(ctx->futhark_mc_segmap_nested_task_235743_iter);
    free(ctx->futhark_mc_segmap_parloop_235733_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235733_runs);
    free(ctx->futhark_mc_segmap_parloop_235733_iter);
    free(ctx->futhark_mc_segmap_nested_task_235731_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235731_runs);
    free(ctx->futhark_mc_segmap_nested_task_235731_iter);
    free(ctx->futhark_mc_segmap_parloop_235760_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235760_runs);
    free(ctx->futhark_mc_segmap_parloop_235760_iter);
    free(ctx->futhark_mc_segmap_task_235758_total_runtime);
    free(ctx->futhark_mc_segmap_task_235758_runs);
    free(ctx->futhark_mc_segmap_task_235758_iter);
    free(ctx->futhark_mc_segmap_parloop_235773_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235773_runs);
    free(ctx->futhark_mc_segmap_parloop_235773_iter);
    free(ctx->futhark_mc_segmap_task_235771_total_runtime);
    free(ctx->futhark_mc_segmap_task_235771_runs);
    free(ctx->futhark_mc_segmap_task_235771_iter);
    free(ctx->futhark_mc_segmap_parloop_235777_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235777_runs);
    free(ctx->futhark_mc_segmap_parloop_235777_iter);
    free(ctx->futhark_mc_segmap_task_235775_total_runtime);
    free(ctx->futhark_mc_segmap_task_235775_runs);
    free(ctx->futhark_mc_segmap_task_235775_iter);
    free(ctx->futhark_mc_segmap_parloop_235766_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235766_runs);
    free(ctx->futhark_mc_segmap_parloop_235766_iter);
    free(ctx->futhark_mc_segmap_nested_task_235764_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235764_runs);
    free(ctx->futhark_mc_segmap_nested_task_235764_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_235794_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235794_runs);
    free(ctx->futhark_mc_segmap_parloop_235794_iter);
    free(ctx->futhark_mc_segmap_task_235792_total_runtime);
    free(ctx->futhark_mc_segmap_task_235792_runs);
    free(ctx->futhark_mc_segmap_task_235792_iter);
    free(ctx->futhark_mc_segmap_parloop_235798_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235798_runs);
    free(ctx->futhark_mc_segmap_parloop_235798_iter);
    free(ctx->futhark_mc_segmap_task_235796_total_runtime);
    free(ctx->futhark_mc_segmap_task_235796_runs);
    free(ctx->futhark_mc_segmap_task_235796_iter);
    free(ctx->futhark_mc_segmap_parloop_235787_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235787_runs);
    free(ctx->futhark_mc_segmap_parloop_235787_iter);
    free(ctx->futhark_mc_segmap_nested_task_235785_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235785_runs);
    free(ctx->futhark_mc_segmap_nested_task_235785_iter);
    free(ctx->futhark_mc_segmap_parloop_235802_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235802_runs);
    free(ctx->futhark_mc_segmap_parloop_235802_iter);
    free(ctx->futhark_mc_segmap_task_235800_total_runtime);
    free(ctx->futhark_mc_segmap_task_235800_runs);
    free(ctx->futhark_mc_segmap_task_235800_iter);
    free(ctx->futhark_mc_segmap_parloop_235811_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235811_runs);
    free(ctx->futhark_mc_segmap_parloop_235811_iter);
    free(ctx->futhark_mc_segmap_task_235809_total_runtime);
    free(ctx->futhark_mc_segmap_task_235809_runs);
    free(ctx->futhark_mc_segmap_task_235809_iter);
    free(ctx->futhark_mc_segmap_parloop_235806_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235806_runs);
    free(ctx->futhark_mc_segmap_parloop_235806_iter);
    free(ctx->futhark_mc_segmap_nested_task_235804_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235804_runs);
    free(ctx->futhark_mc_segmap_nested_task_235804_iter);
    free(ctx->futhark_mc_segmap_parloop_235815_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235815_runs);
    free(ctx->futhark_mc_segmap_parloop_235815_iter);
    free(ctx->futhark_mc_segmap_task_235813_total_runtime);
    free(ctx->futhark_mc_segmap_task_235813_runs);
    free(ctx->futhark_mc_segmap_task_235813_iter);
    free(ctx->futhark_mc_segmap_parloop_235826_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235826_runs);
    free(ctx->futhark_mc_segmap_parloop_235826_iter);
    free(ctx->futhark_mc_segmap_task_235824_total_runtime);
    free(ctx->futhark_mc_segmap_task_235824_runs);
    free(ctx->futhark_mc_segmap_task_235824_iter);
    free(ctx->futhark_mc_segmap_parloop_235837_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235837_runs);
    free(ctx->futhark_mc_segmap_parloop_235837_iter);
    free(ctx->futhark_mc_segmap_task_235835_total_runtime);
    free(ctx->futhark_mc_segmap_task_235835_runs);
    free(ctx->futhark_mc_segmap_task_235835_iter);
    free(ctx->futhark_mc_segmap_parloop_235831_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235831_runs);
    free(ctx->futhark_mc_segmap_parloop_235831_iter);
    free(ctx->futhark_mc_segmap_nested_task_235829_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235829_runs);
    free(ctx->futhark_mc_segmap_nested_task_235829_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_nested_task_235818_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235818_runs);
    free(ctx->futhark_mc_segmap_nested_task_235818_iter);
    free(ctx->futhark_mc_segmap_parloop_235841_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235841_runs);
    free(ctx->futhark_mc_segmap_parloop_235841_iter);
    free(ctx->futhark_mc_segmap_task_235839_total_runtime);
    free(ctx->futhark_mc_segmap_task_235839_runs);
    free(ctx->futhark_mc_segmap_task_235839_iter);
    free(ctx->futhark_mc_segmap_parloop_235850_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235850_runs);
    free(ctx->futhark_mc_segmap_parloop_235850_iter);
    free(ctx->futhark_mc_segmap_task_235848_total_runtime);
    free(ctx->futhark_mc_segmap_task_235848_runs);
    free(ctx->futhark_mc_segmap_task_235848_iter);
    free(ctx->futhark_mc_segmap_parloop_235859_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235859_runs);
    free(ctx->futhark_mc_segmap_parloop_235859_iter);
    free(ctx->futhark_mc_segmap_task_235857_total_runtime);
    free(ctx->futhark_mc_segmap_task_235857_runs);
    free(ctx->futhark_mc_segmap_task_235857_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235867_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235867_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235867_iter);
    free(ctx->futhark_mc_segred_task_235864_total_runtime);
    free(ctx->futhark_mc_segred_task_235864_runs);
    free(ctx->futhark_mc_segred_task_235864_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235872_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235872_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235872_iter);
    free(ctx->futhark_mc_segred_task_235869_total_runtime);
    free(ctx->futhark_mc_segred_task_235869_runs);
    free(ctx->futhark_mc_segred_task_235869_iter);
    free(ctx->futhark_mc_segmap_parloop_235862_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235862_runs);
    free(ctx->futhark_mc_segmap_parloop_235862_iter);
    free(ctx->futhark_mc_segmap_nested_task_235860_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235860_runs);
    free(ctx->futhark_mc_segmap_nested_task_235860_iter);
    free(ctx->futhark_mc_segmap_parloop_235854_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235854_runs);
    free(ctx->futhark_mc_segmap_parloop_235854_iter);
    free(ctx->futhark_mc_segmap_nested_task_235852_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235852_runs);
    free(ctx->futhark_mc_segmap_nested_task_235852_iter);
    free(ctx->futhark_mc_segmap_parloop_235845_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235845_runs);
    free(ctx->futhark_mc_segmap_parloop_235845_iter);
    free(ctx->futhark_mc_segmap_nested_task_235843_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235843_runs);
    free(ctx->futhark_mc_segmap_nested_task_235843_iter);
    free(ctx->futhark_mc_segmap_parloop_235876_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235876_runs);
    free(ctx->futhark_mc_segmap_parloop_235876_iter);
    free(ctx->futhark_mc_segmap_task_235874_total_runtime);
    free(ctx->futhark_mc_segmap_task_235874_runs);
    free(ctx->futhark_mc_segmap_task_235874_iter);
    free(ctx->futhark_mc_segmap_parloop_235887_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235887_runs);
    free(ctx->futhark_mc_segmap_parloop_235887_iter);
    free(ctx->futhark_mc_segmap_task_235885_total_runtime);
    free(ctx->futhark_mc_segmap_task_235885_runs);
    free(ctx->futhark_mc_segmap_task_235885_iter);
    free(ctx->futhark_mc_segmap_parloop_235898_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235898_runs);
    free(ctx->futhark_mc_segmap_parloop_235898_iter);
    free(ctx->futhark_mc_segmap_task_235896_total_runtime);
    free(ctx->futhark_mc_segmap_task_235896_runs);
    free(ctx->futhark_mc_segmap_task_235896_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235908_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235908_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235908_iter);
    free(ctx->futhark_mc_segred_task_235903_total_runtime);
    free(ctx->futhark_mc_segred_task_235903_runs);
    free(ctx->futhark_mc_segred_task_235903_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235914_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235914_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235914_iter);
    free(ctx->futhark_mc_segred_task_235910_total_runtime);
    free(ctx->futhark_mc_segred_task_235910_runs);
    free(ctx->futhark_mc_segred_task_235910_iter);
    free(ctx->futhark_mc_segmap_parloop_235901_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235901_runs);
    free(ctx->futhark_mc_segmap_parloop_235901_iter);
    free(ctx->futhark_mc_segmap_nested_task_235899_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235899_runs);
    free(ctx->futhark_mc_segmap_nested_task_235899_iter);
    free(ctx->futhark_mc_segmap_parloop_235892_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235892_runs);
    free(ctx->futhark_mc_segmap_parloop_235892_iter);
    free(ctx->futhark_mc_segmap_nested_task_235890_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235890_runs);
    free(ctx->futhark_mc_segmap_nested_task_235890_iter);
    free(ctx->futhark_mc_segmap_parloop_235881_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235881_runs);
    free(ctx->futhark_mc_segmap_parloop_235881_iter);
    free(ctx->futhark_mc_segmap_nested_task_235879_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235879_runs);
    free(ctx->futhark_mc_segmap_nested_task_235879_iter);
    free(ctx->futhark_mc_segmap_parloop_235918_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235918_runs);
    free(ctx->futhark_mc_segmap_parloop_235918_iter);
    free(ctx->futhark_mc_segmap_task_235916_total_runtime);
    free(ctx->futhark_mc_segmap_task_235916_runs);
    free(ctx->futhark_mc_segmap_task_235916_iter);
    free(ctx->futhark_mc_segmap_parloop_235929_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235929_runs);
    free(ctx->futhark_mc_segmap_parloop_235929_iter);
    free(ctx->futhark_mc_segmap_task_235927_total_runtime);
    free(ctx->futhark_mc_segmap_task_235927_runs);
    free(ctx->futhark_mc_segmap_task_235927_iter);
    free(ctx->futhark_mc_segmap_parloop_235940_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235940_runs);
    free(ctx->futhark_mc_segmap_parloop_235940_iter);
    free(ctx->futhark_mc_segmap_task_235938_total_runtime);
    free(ctx->futhark_mc_segmap_task_235938_runs);
    free(ctx->futhark_mc_segmap_task_235938_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235952_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235952_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235952_iter);
    free(ctx->futhark_mc_segred_task_235945_total_runtime);
    free(ctx->futhark_mc_segred_task_235945_runs);
    free(ctx->futhark_mc_segred_task_235945_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235958_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235958_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235958_iter);
    free(ctx->futhark_mc_segred_task_235954_total_runtime);
    free(ctx->futhark_mc_segred_task_235954_runs);
    free(ctx->futhark_mc_segred_task_235954_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_nested_task_235941_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235941_runs);
    free(ctx->futhark_mc_segmap_nested_task_235941_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_nested_task_235932_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235932_runs);
    free(ctx->futhark_mc_segmap_nested_task_235932_iter);
    free(ctx->futhark_mc_segmap_parloop_235923_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235923_runs);
    free(ctx->futhark_mc_segmap_parloop_235923_iter);
    free(ctx->futhark_mc_segmap_nested_task_235921_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235921_runs);
    free(ctx->futhark_mc_segmap_nested_task_235921_iter);
    free(ctx->futhark_mc_segmap_parloop_235962_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235962_runs);
    free(ctx->futhark_mc_segmap_parloop_235962_iter);
    free(ctx->futhark_mc_segmap_task_235960_total_runtime);
    free(ctx->futhark_mc_segmap_task_235960_runs);
    free(ctx->futhark_mc_segmap_task_235960_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_task_235970_total_runtime);
    free(ctx->futhark_mc_segmap_task_235970_runs);
    free(ctx->futhark_mc_segmap_task_235970_iter);
    free(ctx->futhark_mc_segmap_parloop_235982_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235982_runs);
    free(ctx->futhark_mc_segmap_parloop_235982_iter);
    free(ctx->futhark_mc_segmap_task_235980_total_runtime);
    free(ctx->futhark_mc_segmap_task_235980_runs);
    free(ctx->futhark_mc_segmap_task_235980_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235992_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235992_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235992_iter);
    free(ctx->futhark_mc_segred_task_235989_total_runtime);
    free(ctx->futhark_mc_segred_task_235989_runs);
    free(ctx->futhark_mc_segred_task_235989_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_235997_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_235997_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_235997_iter);
    free(ctx->futhark_mc_segred_task_235994_total_runtime);
    free(ctx->futhark_mc_segred_task_235994_runs);
    free(ctx->futhark_mc_segred_task_235994_iter);
    free(ctx->futhark_mc_segmap_parloop_235986_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235986_runs);
    free(ctx->futhark_mc_segmap_parloop_235986_iter);
    free(ctx->futhark_mc_segmap_nested_task_235984_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235984_runs);
    free(ctx->futhark_mc_segmap_nested_task_235984_iter);
    free(ctx->futhark_mc_segmap_parloop_235977_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235977_runs);
    free(ctx->futhark_mc_segmap_parloop_235977_iter);
    free(ctx->futhark_mc_segmap_nested_task_235975_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235975_runs);
    free(ctx->futhark_mc_segmap_nested_task_235975_iter);
    free(ctx->futhark_mc_segmap_parloop_235967_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_235967_runs);
    free(ctx->futhark_mc_segmap_parloop_235967_iter);
    free(ctx->futhark_mc_segmap_nested_task_235965_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_235965_runs);
    free(ctx->futhark_mc_segmap_nested_task_235965_iter);
    free(ctx->futhark_mc_segmap_parloop_236001_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236001_runs);
    free(ctx->futhark_mc_segmap_parloop_236001_iter);
    free(ctx->futhark_mc_segmap_task_235999_total_runtime);
    free(ctx->futhark_mc_segmap_task_235999_runs);
    free(ctx->futhark_mc_segmap_task_235999_iter);
    free(ctx->futhark_mc_segmap_parloop_236014_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236014_runs);
    free(ctx->futhark_mc_segmap_parloop_236014_iter);
    free(ctx->futhark_mc_segmap_task_236012_total_runtime);
    free(ctx->futhark_mc_segmap_task_236012_runs);
    free(ctx->futhark_mc_segmap_task_236012_iter);
    free(ctx->futhark_mc_segmap_parloop_236027_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236027_runs);
    free(ctx->futhark_mc_segmap_parloop_236027_iter);
    free(ctx->futhark_mc_segmap_task_236025_total_runtime);
    free(ctx->futhark_mc_segmap_task_236025_runs);
    free(ctx->futhark_mc_segmap_task_236025_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236041_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236041_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236041_iter);
    free(ctx->futhark_mc_segred_task_236036_total_runtime);
    free(ctx->futhark_mc_segred_task_236036_runs);
    free(ctx->futhark_mc_segred_task_236036_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236047_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236047_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236047_iter);
    free(ctx->futhark_mc_segred_task_236043_total_runtime);
    free(ctx->futhark_mc_segred_task_236043_runs);
    free(ctx->futhark_mc_segred_task_236043_iter);
    free(ctx->futhark_mc_segmap_parloop_236032_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236032_runs);
    free(ctx->futhark_mc_segmap_parloop_236032_iter);
    free(ctx->futhark_mc_segmap_nested_task_236030_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236030_runs);
    free(ctx->futhark_mc_segmap_nested_task_236030_iter);
    free(ctx->futhark_mc_segmap_parloop_236021_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236021_runs);
    free(ctx->futhark_mc_segmap_parloop_236021_iter);
    free(ctx->futhark_mc_segmap_nested_task_236019_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236019_runs);
    free(ctx->futhark_mc_segmap_nested_task_236019_iter);
    free(ctx->futhark_mc_segmap_parloop_236008_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236008_runs);
    free(ctx->futhark_mc_segmap_parloop_236008_iter);
    free(ctx->futhark_mc_segmap_nested_task_236006_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236006_runs);
    free(ctx->futhark_mc_segmap_nested_task_236006_iter);
    free(ctx->futhark_mc_segmap_parloop_236051_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236051_runs);
    free(ctx->futhark_mc_segmap_parloop_236051_iter);
    free(ctx->futhark_mc_segmap_task_236049_total_runtime);
    free(ctx->futhark_mc_segmap_task_236049_runs);
    free(ctx->futhark_mc_segmap_task_236049_iter);
    free(ctx->futhark_mc_segmap_parloop_236066_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236066_runs);
    free(ctx->futhark_mc_segmap_parloop_236066_iter);
    free(ctx->futhark_mc_segmap_task_236064_total_runtime);
    free(ctx->futhark_mc_segmap_task_236064_runs);
    free(ctx->futhark_mc_segmap_task_236064_iter);
    free(ctx->futhark_mc_segmap_parloop_236081_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236081_runs);
    free(ctx->futhark_mc_segmap_parloop_236081_iter);
    free(ctx->futhark_mc_segmap_task_236079_total_runtime);
    free(ctx->futhark_mc_segmap_task_236079_runs);
    free(ctx->futhark_mc_segmap_task_236079_iter);
    free(ctx->futhark_mc_segmap_parloop_236096_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236096_runs);
    free(ctx->futhark_mc_segmap_parloop_236096_iter);
    free(ctx->futhark_mc_segmap_task_236094_total_runtime);
    free(ctx->futhark_mc_segmap_task_236094_runs);
    free(ctx->futhark_mc_segmap_task_236094_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236105_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236105_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236105_iter);
    free(ctx->futhark_mc_segred_task_236098_total_runtime);
    free(ctx->futhark_mc_segred_task_236098_runs);
    free(ctx->futhark_mc_segred_task_236098_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236111_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236111_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236111_iter);
    free(ctx->futhark_mc_segred_task_236107_total_runtime);
    free(ctx->futhark_mc_segred_task_236107_runs);
    free(ctx->futhark_mc_segred_task_236107_iter);
    free(ctx->futhark_mc_segmap_parloop_236088_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236088_runs);
    free(ctx->futhark_mc_segmap_parloop_236088_iter);
    free(ctx->futhark_mc_segmap_nested_task_236086_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236086_runs);
    free(ctx->futhark_mc_segmap_nested_task_236086_iter);
    free(ctx->futhark_mc_segmap_parloop_236075_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236075_runs);
    free(ctx->futhark_mc_segmap_parloop_236075_iter);
    free(ctx->futhark_mc_segmap_nested_task_236073_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236073_runs);
    free(ctx->futhark_mc_segmap_nested_task_236073_iter);
    free(ctx->futhark_mc_segmap_parloop_236060_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236060_runs);
    free(ctx->futhark_mc_segmap_parloop_236060_iter);
    free(ctx->futhark_mc_segmap_nested_task_236058_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236058_runs);
    free(ctx->futhark_mc_segmap_nested_task_236058_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_task_236113_total_runtime);
    free(ctx->futhark_mc_segmap_task_236113_runs);
    free(ctx->futhark_mc_segmap_task_236113_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_task_236122_total_runtime);
    free(ctx->futhark_mc_segmap_task_236122_runs);
    free(ctx->futhark_mc_segmap_task_236122_iter);
    free(ctx->futhark_mc_segmap_parloop_236133_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236133_runs);
    free(ctx->futhark_mc_segmap_parloop_236133_iter);
    free(ctx->futhark_mc_segmap_task_236131_total_runtime);
    free(ctx->futhark_mc_segmap_task_236131_runs);
    free(ctx->futhark_mc_segmap_task_236131_iter);
    free(ctx->futhark_mc_segmap_parloop_236128_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236128_runs);
    free(ctx->futhark_mc_segmap_parloop_236128_iter);
    free(ctx->futhark_mc_segmap_nested_task_236126_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236126_runs);
    free(ctx->futhark_mc_segmap_nested_task_236126_iter);
    free(ctx->futhark_mc_segmap_parloop_236119_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236119_runs);
    free(ctx->futhark_mc_segmap_parloop_236119_iter);
    free(ctx->futhark_mc_segmap_nested_task_236117_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236117_runs);
    free(ctx->futhark_mc_segmap_nested_task_236117_iter);
    free(ctx->futhark_mc_segmap_parloop_236137_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236137_runs);
    free(ctx->futhark_mc_segmap_parloop_236137_iter);
    free(ctx->futhark_mc_segmap_task_236135_total_runtime);
    free(ctx->futhark_mc_segmap_task_236135_runs);
    free(ctx->futhark_mc_segmap_task_236135_iter);
    free(ctx->futhark_mc_segmap_parloop_236146_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236146_runs);
    free(ctx->futhark_mc_segmap_parloop_236146_iter);
    free(ctx->futhark_mc_segmap_task_236144_total_runtime);
    free(ctx->futhark_mc_segmap_task_236144_runs);
    free(ctx->futhark_mc_segmap_task_236144_iter);
    free(ctx->futhark_mc_segmap_parloop_236141_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236141_runs);
    free(ctx->futhark_mc_segmap_parloop_236141_iter);
    free(ctx->futhark_mc_segmap_nested_task_236139_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236139_runs);
    free(ctx->futhark_mc_segmap_nested_task_236139_iter);
    free(ctx->futhark_mc_segmap_parloop_236150_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236150_runs);
    free(ctx->futhark_mc_segmap_parloop_236150_iter);
    free(ctx->futhark_mc_segmap_task_236148_total_runtime);
    free(ctx->futhark_mc_segmap_task_236148_runs);
    free(ctx->futhark_mc_segmap_task_236148_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236158_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236158_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236158_iter);
    free(ctx->futhark_mc_segred_task_236155_total_runtime);
    free(ctx->futhark_mc_segred_task_236155_runs);
    free(ctx->futhark_mc_segred_task_236155_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_nested_task_236151_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236151_runs);
    free(ctx->futhark_mc_segmap_nested_task_236151_iter);
    free(ctx->futhark_mc_segmap_parloop_236162_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236162_runs);
    free(ctx->futhark_mc_segmap_parloop_236162_iter);
    free(ctx->futhark_mc_segmap_task_236160_total_runtime);
    free(ctx->futhark_mc_segmap_task_236160_runs);
    free(ctx->futhark_mc_segmap_task_236160_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_236172_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_236172_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_236172_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_236174_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_236174_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_236174_iter);
    free(ctx->futhark_mc_segscan_task_236169_total_runtime);
    free(ctx->futhark_mc_segscan_task_236169_runs);
    free(ctx->futhark_mc_segscan_task_236169_iter);
    free(ctx->futhark_mc_segmap_parloop_236166_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236166_runs);
    free(ctx->futhark_mc_segmap_parloop_236166_iter);
    free(ctx->futhark_mc_segmap_nested_task_236164_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236164_runs);
    free(ctx->futhark_mc_segmap_nested_task_236164_iter);
    free(ctx->futhark_mc_segmap_parloop_236178_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236178_runs);
    free(ctx->futhark_mc_segmap_parloop_236178_iter);
    free(ctx->futhark_mc_segmap_task_236176_total_runtime);
    free(ctx->futhark_mc_segmap_task_236176_runs);
    free(ctx->futhark_mc_segmap_task_236176_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236186_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236186_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236186_iter);
    free(ctx->futhark_mc_segred_task_236183_total_runtime);
    free(ctx->futhark_mc_segred_task_236183_runs);
    free(ctx->futhark_mc_segred_task_236183_iter);
    free(ctx->futhark_mc_segmap_parloop_236181_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236181_runs);
    free(ctx->futhark_mc_segmap_parloop_236181_iter);
    free(ctx->futhark_mc_segmap_nested_task_236179_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236179_runs);
    free(ctx->futhark_mc_segmap_nested_task_236179_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_task_236188_total_runtime);
    free(ctx->futhark_mc_segmap_task_236188_runs);
    free(ctx->futhark_mc_segmap_task_236188_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_236200_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_236200_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_236200_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_236202_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_236202_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_236202_iter);
    free(ctx->futhark_mc_segscan_task_236197_total_runtime);
    free(ctx->futhark_mc_segscan_task_236197_runs);
    free(ctx->futhark_mc_segscan_task_236197_iter);
    free(ctx->futhark_mc_segmap_parloop_236194_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236194_runs);
    free(ctx->futhark_mc_segmap_parloop_236194_iter);
    free(ctx->futhark_mc_segmap_nested_task_236192_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236192_runs);
    free(ctx->futhark_mc_segmap_nested_task_236192_iter);
    free(ctx->futhark_mc_segmap_parloop_236206_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236206_runs);
    free(ctx->futhark_mc_segmap_parloop_236206_iter);
    free(ctx->futhark_mc_segmap_task_236204_total_runtime);
    free(ctx->futhark_mc_segmap_task_236204_runs);
    free(ctx->futhark_mc_segmap_task_236204_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236214_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236214_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236214_iter);
    free(ctx->futhark_mc_segred_task_236211_total_runtime);
    free(ctx->futhark_mc_segred_task_236211_runs);
    free(ctx->futhark_mc_segred_task_236211_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_nested_task_236207_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236207_runs);
    free(ctx->futhark_mc_segmap_nested_task_236207_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_task_236216_total_runtime);
    free(ctx->futhark_mc_segmap_task_236216_runs);
    free(ctx->futhark_mc_segmap_task_236216_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_236228_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_236228_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_236228_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_236230_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_236230_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_236230_iter);
    free(ctx->futhark_mc_segscan_task_236225_total_runtime);
    free(ctx->futhark_mc_segscan_task_236225_runs);
    free(ctx->futhark_mc_segscan_task_236225_iter);
    free(ctx->futhark_mc_segmap_parloop_236222_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236222_runs);
    free(ctx->futhark_mc_segmap_parloop_236222_iter);
    free(ctx->futhark_mc_segmap_nested_task_236220_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236220_runs);
    free(ctx->futhark_mc_segmap_nested_task_236220_iter);
    free(ctx->futhark_mc_segmap_parloop_236234_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236234_runs);
    free(ctx->futhark_mc_segmap_parloop_236234_iter);
    free(ctx->futhark_mc_segmap_task_236232_total_runtime);
    free(ctx->futhark_mc_segmap_task_236232_runs);
    free(ctx->futhark_mc_segmap_task_236232_iter);
    free(ctx->futhark_mc_segmap_parloop_236243_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236243_runs);
    free(ctx->futhark_mc_segmap_parloop_236243_iter);
    free(ctx->futhark_mc_segmap_task_236241_total_runtime);
    free(ctx->futhark_mc_segmap_task_236241_runs);
    free(ctx->futhark_mc_segmap_task_236241_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236251_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236251_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236251_iter);
    free(ctx->futhark_mc_segred_task_236248_total_runtime);
    free(ctx->futhark_mc_segred_task_236248_runs);
    free(ctx->futhark_mc_segred_task_236248_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236256_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236256_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236256_iter);
    free(ctx->futhark_mc_segred_task_236253_total_runtime);
    free(ctx->futhark_mc_segred_task_236253_runs);
    free(ctx->futhark_mc_segred_task_236253_iter);
    free(ctx->futhark_mc_segmap_parloop_236246_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236246_runs);
    free(ctx->futhark_mc_segmap_parloop_236246_iter);
    free(ctx->futhark_mc_segmap_nested_task_236244_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236244_runs);
    free(ctx->futhark_mc_segmap_nested_task_236244_iter);
    free(ctx->futhark_mc_segmap_parloop_236238_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236238_runs);
    free(ctx->futhark_mc_segmap_parloop_236238_iter);
    free(ctx->futhark_mc_segmap_nested_task_236236_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236236_runs);
    free(ctx->futhark_mc_segmap_nested_task_236236_iter);
    free(ctx->futhark_mc_segmap_parloop_236260_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236260_runs);
    free(ctx->futhark_mc_segmap_parloop_236260_iter);
    free(ctx->futhark_mc_segmap_task_236258_total_runtime);
    free(ctx->futhark_mc_segmap_task_236258_runs);
    free(ctx->futhark_mc_segmap_task_236258_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_segred_stage_1_parloop_236281_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236281_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236281_iter);
    free(ctx->futhark_mc_segred_task_236276_total_runtime);
    free(ctx->futhark_mc_segred_task_236276_runs);
    free(ctx->futhark_mc_segred_task_236276_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236287_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236287_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236287_iter);
    free(ctx->futhark_mc_segred_task_236283_total_runtime);
    free(ctx->futhark_mc_segred_task_236283_runs);
    free(ctx->futhark_mc_segred_task_236283_iter);
    free(ctx->futhark_mc_segmap_parloop_236274_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236274_runs);
    free(ctx->futhark_mc_segmap_parloop_236274_iter);
    free(ctx->futhark_mc_segmap_nested_task_236272_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236272_runs);
    free(ctx->futhark_mc_segmap_nested_task_236272_iter);
    free(ctx->futhark_mc_segmap_parloop_236265_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236265_runs);
    free(ctx->futhark_mc_segmap_parloop_236265_iter);
    free(ctx->futhark_mc_segmap_nested_task_236263_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236263_runs);
    free(ctx->futhark_mc_segmap_nested_task_236263_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_task_236289_total_runtime);
    free(ctx->futhark_mc_segmap_task_236289_runs);
    free(ctx->futhark_mc_segmap_task_236289_iter);
    free(ctx->futhark_mc_segmap_parloop_236302_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236302_runs);
    free(ctx->futhark_mc_segmap_parloop_236302_iter);
    free(ctx->futhark_mc_segmap_task_236300_total_runtime);
    free(ctx->futhark_mc_segmap_task_236300_runs);
    free(ctx->futhark_mc_segmap_task_236300_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236314_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236314_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236314_iter);
    free(ctx->futhark_mc_segred_task_236307_total_runtime);
    free(ctx->futhark_mc_segred_task_236307_runs);
    free(ctx->futhark_mc_segred_task_236307_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_236316_total_runtime);
    free(ctx->futhark_mc_segred_task_236316_runs);
    free(ctx->futhark_mc_segred_task_236316_iter);
    free(ctx->futhark_mc_segmap_parloop_236305_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236305_runs);
    free(ctx->futhark_mc_segmap_parloop_236305_iter);
    free(ctx->futhark_mc_segmap_nested_task_236303_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236303_runs);
    free(ctx->futhark_mc_segmap_nested_task_236303_iter);
    free(ctx->futhark_mc_segmap_parloop_236296_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236296_runs);
    free(ctx->futhark_mc_segmap_parloop_236296_iter);
    free(ctx->futhark_mc_segmap_nested_task_236294_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236294_runs);
    free(ctx->futhark_mc_segmap_nested_task_236294_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_236334_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236334_runs);
    free(ctx->futhark_mc_segmap_parloop_236334_iter);
    free(ctx->futhark_mc_segmap_task_236332_total_runtime);
    free(ctx->futhark_mc_segmap_task_236332_runs);
    free(ctx->futhark_mc_segmap_task_236332_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236344_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236344_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236344_iter);
    free(ctx->futhark_mc_segred_task_236341_total_runtime);
    free(ctx->futhark_mc_segred_task_236341_runs);
    free(ctx->futhark_mc_segred_task_236341_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236349_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236349_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236349_iter);
    free(ctx->futhark_mc_segred_task_236346_total_runtime);
    free(ctx->futhark_mc_segred_task_236346_runs);
    free(ctx->futhark_mc_segred_task_236346_iter);
    free(ctx->futhark_mc_segmap_parloop_236338_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236338_runs);
    free(ctx->futhark_mc_segmap_parloop_236338_iter);
    free(ctx->futhark_mc_segmap_nested_task_236336_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236336_runs);
    free(ctx->futhark_mc_segmap_nested_task_236336_iter);
    free(ctx->futhark_mc_segmap_parloop_236329_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236329_runs);
    free(ctx->futhark_mc_segmap_parloop_236329_iter);
    free(ctx->futhark_mc_segmap_nested_task_236327_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236327_runs);
    free(ctx->futhark_mc_segmap_nested_task_236327_iter);
    free(ctx->futhark_mc_segmap_parloop_236353_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236353_runs);
    free(ctx->futhark_mc_segmap_parloop_236353_iter);
    free(ctx->futhark_mc_segmap_task_236351_total_runtime);
    free(ctx->futhark_mc_segmap_task_236351_runs);
    free(ctx->futhark_mc_segmap_task_236351_iter);
    free(ctx->futhark_mc_segmap_parloop_236366_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236366_runs);
    free(ctx->futhark_mc_segmap_parloop_236366_iter);
    free(ctx->futhark_mc_segmap_task_236364_total_runtime);
    free(ctx->futhark_mc_segmap_task_236364_runs);
    free(ctx->futhark_mc_segmap_task_236364_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236380_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236380_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236380_iter);
    free(ctx->futhark_mc_segred_task_236375_total_runtime);
    free(ctx->futhark_mc_segred_task_236375_runs);
    free(ctx->futhark_mc_segred_task_236375_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236386_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236386_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236386_iter);
    free(ctx->futhark_mc_segred_task_236382_total_runtime);
    free(ctx->futhark_mc_segred_task_236382_runs);
    free(ctx->futhark_mc_segred_task_236382_iter);
    free(ctx->futhark_mc_segmap_parloop_236371_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236371_runs);
    free(ctx->futhark_mc_segmap_parloop_236371_iter);
    free(ctx->futhark_mc_segmap_nested_task_236369_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236369_runs);
    free(ctx->futhark_mc_segmap_nested_task_236369_iter);
    free(ctx->futhark_mc_segmap_parloop_236360_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236360_runs);
    free(ctx->futhark_mc_segmap_parloop_236360_iter);
    free(ctx->futhark_mc_segmap_nested_task_236358_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236358_runs);
    free(ctx->futhark_mc_segmap_nested_task_236358_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_236405_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236405_runs);
    free(ctx->futhark_mc_segmap_parloop_236405_iter);
    free(ctx->futhark_mc_segmap_task_236403_total_runtime);
    free(ctx->futhark_mc_segmap_task_236403_runs);
    free(ctx->futhark_mc_segmap_task_236403_iter);
    free(ctx->futhark_mc_segmap_parloop_236420_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236420_runs);
    free(ctx->futhark_mc_segmap_parloop_236420_iter);
    free(ctx->futhark_mc_segmap_task_236418_total_runtime);
    free(ctx->futhark_mc_segmap_task_236418_runs);
    free(ctx->futhark_mc_segmap_task_236418_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236429_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236429_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236429_iter);
    free(ctx->futhark_mc_segred_task_236422_total_runtime);
    free(ctx->futhark_mc_segred_task_236422_runs);
    free(ctx->futhark_mc_segred_task_236422_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236435_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236435_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236435_iter);
    free(ctx->futhark_mc_segred_task_236431_total_runtime);
    free(ctx->futhark_mc_segred_task_236431_runs);
    free(ctx->futhark_mc_segred_task_236431_iter);
    free(ctx->futhark_mc_segmap_parloop_236412_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236412_runs);
    free(ctx->futhark_mc_segmap_parloop_236412_iter);
    free(ctx->futhark_mc_segmap_nested_task_236410_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236410_runs);
    free(ctx->futhark_mc_segmap_nested_task_236410_iter);
    free(ctx->futhark_mc_segmap_parloop_236399_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236399_runs);
    free(ctx->futhark_mc_segmap_parloop_236399_iter);
    free(ctx->futhark_mc_segmap_nested_task_236397_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236397_runs);
    free(ctx->futhark_mc_segmap_nested_task_236397_iter);
    free(ctx->futhark_mc_segmap_parloop_236439_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236439_runs);
    free(ctx->futhark_mc_segmap_parloop_236439_iter);
    free(ctx->futhark_mc_segmap_task_236437_total_runtime);
    free(ctx->futhark_mc_segmap_task_236437_runs);
    free(ctx->futhark_mc_segmap_task_236437_iter);
    free(ctx->futhark_mc_segmap_parloop_236448_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236448_runs);
    free(ctx->futhark_mc_segmap_parloop_236448_iter);
    free(ctx->futhark_mc_segmap_task_236446_total_runtime);
    free(ctx->futhark_mc_segmap_task_236446_runs);
    free(ctx->futhark_mc_segmap_task_236446_iter);
    free(ctx->futhark_mc_segmap_parloop_236443_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236443_runs);
    free(ctx->futhark_mc_segmap_parloop_236443_iter);
    free(ctx->futhark_mc_segmap_nested_task_236441_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236441_runs);
    free(ctx->futhark_mc_segmap_nested_task_236441_iter);
    free(ctx->futhark_mc_segmap_parloop_236452_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236452_runs);
    free(ctx->futhark_mc_segmap_parloop_236452_iter);
    free(ctx->futhark_mc_segmap_task_236450_total_runtime);
    free(ctx->futhark_mc_segmap_task_236450_runs);
    free(ctx->futhark_mc_segmap_task_236450_iter);
    free(ctx->futhark_mc_segmap_parloop_236461_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236461_runs);
    free(ctx->futhark_mc_segmap_parloop_236461_iter);
    free(ctx->futhark_mc_segmap_task_236459_total_runtime);
    free(ctx->futhark_mc_segmap_task_236459_runs);
    free(ctx->futhark_mc_segmap_task_236459_iter);
    free(ctx->futhark_mc_segmap_parloop_236456_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236456_runs);
    free(ctx->futhark_mc_segmap_parloop_236456_iter);
    free(ctx->futhark_mc_segmap_nested_task_236454_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236454_runs);
    free(ctx->futhark_mc_segmap_nested_task_236454_iter);
    free(ctx->futhark_mc_segmap_parloop_236465_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236465_runs);
    free(ctx->futhark_mc_segmap_parloop_236465_iter);
    free(ctx->futhark_mc_segmap_task_236463_total_runtime);
    free(ctx->futhark_mc_segmap_task_236463_runs);
    free(ctx->futhark_mc_segmap_task_236463_iter);
    free(ctx->futhark_mc_segmap_parloop_236480_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236480_runs);
    free(ctx->futhark_mc_segmap_parloop_236480_iter);
    free(ctx->futhark_mc_segmap_task_236478_total_runtime);
    free(ctx->futhark_mc_segmap_task_236478_runs);
    free(ctx->futhark_mc_segmap_task_236478_iter);
    free(ctx->futhark_mc_segmap_parloop_236484_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236484_runs);
    free(ctx->futhark_mc_segmap_parloop_236484_iter);
    free(ctx->futhark_mc_segmap_task_236482_total_runtime);
    free(ctx->futhark_mc_segmap_task_236482_runs);
    free(ctx->futhark_mc_segmap_task_236482_iter);
    free(ctx->futhark_mc_segmap_parloop_236488_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236488_runs);
    free(ctx->futhark_mc_segmap_parloop_236488_iter);
    free(ctx->futhark_mc_segmap_task_236486_total_runtime);
    free(ctx->futhark_mc_segmap_task_236486_runs);
    free(ctx->futhark_mc_segmap_task_236486_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236496_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236496_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236496_iter);
    free(ctx->futhark_mc_segred_task_236493_total_runtime);
    free(ctx->futhark_mc_segred_task_236493_runs);
    free(ctx->futhark_mc_segred_task_236493_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236501_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236501_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236501_iter);
    free(ctx->futhark_mc_segred_task_236498_total_runtime);
    free(ctx->futhark_mc_segred_task_236498_runs);
    free(ctx->futhark_mc_segred_task_236498_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_236472_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236472_runs);
    free(ctx->futhark_mc_segmap_parloop_236472_iter);
    free(ctx->futhark_mc_segmap_nested_task_236470_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236470_runs);
    free(ctx->futhark_mc_segmap_nested_task_236470_iter);
    free(ctx->futhark_mc_segmap_parloop_236505_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236505_runs);
    free(ctx->futhark_mc_segmap_parloop_236505_iter);
    free(ctx->futhark_mc_segmap_task_236503_total_runtime);
    free(ctx->futhark_mc_segmap_task_236503_runs);
    free(ctx->futhark_mc_segmap_task_236503_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_task_236520_total_runtime);
    free(ctx->futhark_mc_segmap_task_236520_runs);
    free(ctx->futhark_mc_segmap_task_236520_iter);
    free(ctx->futhark_mc_segmap_parloop_236526_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236526_runs);
    free(ctx->futhark_mc_segmap_parloop_236526_iter);
    free(ctx->futhark_mc_segmap_task_236524_total_runtime);
    free(ctx->futhark_mc_segmap_task_236524_runs);
    free(ctx->futhark_mc_segmap_task_236524_iter);
    free(ctx->futhark_mc_segmap_parloop_236530_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236530_runs);
    free(ctx->futhark_mc_segmap_parloop_236530_iter);
    free(ctx->futhark_mc_segmap_task_236528_total_runtime);
    free(ctx->futhark_mc_segmap_task_236528_runs);
    free(ctx->futhark_mc_segmap_task_236528_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236540_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236540_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236540_iter);
    free(ctx->futhark_mc_segred_task_236535_total_runtime);
    free(ctx->futhark_mc_segred_task_236535_runs);
    free(ctx->futhark_mc_segred_task_236535_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236546_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236546_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236546_iter);
    free(ctx->futhark_mc_segred_task_236542_total_runtime);
    free(ctx->futhark_mc_segred_task_236542_runs);
    free(ctx->futhark_mc_segred_task_236542_iter);
    free(ctx->futhark_mc_segmap_parloop_236533_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236533_runs);
    free(ctx->futhark_mc_segmap_parloop_236533_iter);
    free(ctx->futhark_mc_segmap_nested_task_236531_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236531_runs);
    free(ctx->futhark_mc_segmap_nested_task_236531_iter);
    free(ctx->futhark_mc_segmap_parloop_236513_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236513_runs);
    free(ctx->futhark_mc_segmap_parloop_236513_iter);
    free(ctx->futhark_mc_segmap_nested_task_236511_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236511_runs);
    free(ctx->futhark_mc_segmap_nested_task_236511_iter);
    free(ctx->futhark_mc_segmap_parloop_236550_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236550_runs);
    free(ctx->futhark_mc_segmap_parloop_236550_iter);
    free(ctx->futhark_mc_segmap_task_236548_total_runtime);
    free(ctx->futhark_mc_segmap_task_236548_runs);
    free(ctx->futhark_mc_segmap_task_236548_iter);
    free(ctx->futhark_mc_segmap_parloop_236567_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236567_runs);
    free(ctx->futhark_mc_segmap_parloop_236567_iter);
    free(ctx->futhark_mc_segmap_task_236565_total_runtime);
    free(ctx->futhark_mc_segmap_task_236565_runs);
    free(ctx->futhark_mc_segmap_task_236565_iter);
    free(ctx->futhark_mc_segmap_parloop_236571_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236571_runs);
    free(ctx->futhark_mc_segmap_parloop_236571_iter);
    free(ctx->futhark_mc_segmap_task_236569_total_runtime);
    free(ctx->futhark_mc_segmap_task_236569_runs);
    free(ctx->futhark_mc_segmap_task_236569_iter);
    free(ctx->futhark_mc_segmap_parloop_236575_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236575_runs);
    free(ctx->futhark_mc_segmap_parloop_236575_iter);
    free(ctx->futhark_mc_segmap_task_236573_total_runtime);
    free(ctx->futhark_mc_segmap_task_236573_runs);
    free(ctx->futhark_mc_segmap_task_236573_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236587_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236587_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236587_iter);
    free(ctx->futhark_mc_segred_task_236580_total_runtime);
    free(ctx->futhark_mc_segred_task_236580_runs);
    free(ctx->futhark_mc_segred_task_236580_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236593_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236593_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236593_iter);
    free(ctx->futhark_mc_segred_task_236589_total_runtime);
    free(ctx->futhark_mc_segred_task_236589_runs);
    free(ctx->futhark_mc_segred_task_236589_iter);
    free(ctx->futhark_mc_segmap_parloop_236578_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236578_runs);
    free(ctx->futhark_mc_segmap_parloop_236578_iter);
    free(ctx->futhark_mc_segmap_nested_task_236576_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236576_runs);
    free(ctx->futhark_mc_segmap_nested_task_236576_iter);
    free(ctx->futhark_mc_segmap_parloop_236558_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236558_runs);
    free(ctx->futhark_mc_segmap_parloop_236558_iter);
    free(ctx->futhark_mc_segmap_nested_task_236556_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236556_runs);
    free(ctx->futhark_mc_segmap_nested_task_236556_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_236613_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236613_runs);
    free(ctx->futhark_mc_segmap_parloop_236613_iter);
    free(ctx->futhark_mc_segmap_task_236611_total_runtime);
    free(ctx->futhark_mc_segmap_task_236611_runs);
    free(ctx->futhark_mc_segmap_task_236611_iter);
    free(ctx->futhark_mc_segmap_parloop_236617_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236617_runs);
    free(ctx->futhark_mc_segmap_parloop_236617_iter);
    free(ctx->futhark_mc_segmap_task_236615_total_runtime);
    free(ctx->futhark_mc_segmap_task_236615_runs);
    free(ctx->futhark_mc_segmap_task_236615_iter);
    free(ctx->futhark_mc_segmap_parloop_236621_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236621_runs);
    free(ctx->futhark_mc_segmap_parloop_236621_iter);
    free(ctx->futhark_mc_segmap_task_236619_total_runtime);
    free(ctx->futhark_mc_segmap_task_236619_runs);
    free(ctx->futhark_mc_segmap_task_236619_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236631_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236631_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236631_iter);
    free(ctx->futhark_mc_segred_task_236628_total_runtime);
    free(ctx->futhark_mc_segred_task_236628_runs);
    free(ctx->futhark_mc_segred_task_236628_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236636_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236636_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236636_iter);
    free(ctx->futhark_mc_segred_task_236633_total_runtime);
    free(ctx->futhark_mc_segred_task_236633_runs);
    free(ctx->futhark_mc_segred_task_236633_iter);
    free(ctx->futhark_mc_segmap_parloop_236625_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236625_runs);
    free(ctx->futhark_mc_segmap_parloop_236625_iter);
    free(ctx->futhark_mc_segmap_nested_task_236623_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236623_runs);
    free(ctx->futhark_mc_segmap_nested_task_236623_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_nested_task_236603_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236603_runs);
    free(ctx->futhark_mc_segmap_nested_task_236603_iter);
    free(ctx->futhark_mc_segmap_parloop_236640_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236640_runs);
    free(ctx->futhark_mc_segmap_parloop_236640_iter);
    free(ctx->futhark_mc_segmap_task_236638_total_runtime);
    free(ctx->futhark_mc_segmap_task_236638_runs);
    free(ctx->futhark_mc_segmap_task_236638_iter);
    free(ctx->futhark_mc_segmap_parloop_236659_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236659_runs);
    free(ctx->futhark_mc_segmap_parloop_236659_iter);
    free(ctx->futhark_mc_segmap_task_236657_total_runtime);
    free(ctx->futhark_mc_segmap_task_236657_runs);
    free(ctx->futhark_mc_segmap_task_236657_iter);
    free(ctx->futhark_mc_segmap_parloop_236663_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236663_runs);
    free(ctx->futhark_mc_segmap_parloop_236663_iter);
    free(ctx->futhark_mc_segmap_task_236661_total_runtime);
    free(ctx->futhark_mc_segmap_task_236661_runs);
    free(ctx->futhark_mc_segmap_task_236661_iter);
    free(ctx->futhark_mc_segmap_parloop_236667_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236667_runs);
    free(ctx->futhark_mc_segmap_parloop_236667_iter);
    free(ctx->futhark_mc_segmap_task_236665_total_runtime);
    free(ctx->futhark_mc_segmap_task_236665_runs);
    free(ctx->futhark_mc_segmap_task_236665_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236681_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236681_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236681_iter);
    free(ctx->futhark_mc_segred_task_236676_total_runtime);
    free(ctx->futhark_mc_segred_task_236676_runs);
    free(ctx->futhark_mc_segred_task_236676_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236687_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236687_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236687_iter);
    free(ctx->futhark_mc_segred_task_236683_total_runtime);
    free(ctx->futhark_mc_segred_task_236683_runs);
    free(ctx->futhark_mc_segred_task_236683_iter);
    free(ctx->futhark_mc_segmap_parloop_236672_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236672_runs);
    free(ctx->futhark_mc_segmap_parloop_236672_iter);
    free(ctx->futhark_mc_segmap_nested_task_236670_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236670_runs);
    free(ctx->futhark_mc_segmap_nested_task_236670_iter);
    free(ctx->futhark_mc_segmap_parloop_236650_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236650_runs);
    free(ctx->futhark_mc_segmap_parloop_236650_iter);
    free(ctx->futhark_mc_segmap_nested_task_236648_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236648_runs);
    free(ctx->futhark_mc_segmap_nested_task_236648_iter);
    free(ctx->futhark_mc_segmap_parloop_236691_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236691_runs);
    free(ctx->futhark_mc_segmap_parloop_236691_iter);
    free(ctx->futhark_mc_segmap_task_236689_total_runtime);
    free(ctx->futhark_mc_segmap_task_236689_runs);
    free(ctx->futhark_mc_segmap_task_236689_iter);
    free(ctx->futhark_mc_segmap_parloop_236712_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236712_runs);
    free(ctx->futhark_mc_segmap_parloop_236712_iter);
    free(ctx->futhark_mc_segmap_task_236710_total_runtime);
    free(ctx->futhark_mc_segmap_task_236710_runs);
    free(ctx->futhark_mc_segmap_task_236710_iter);
    free(ctx->futhark_mc_segmap_parloop_236716_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236716_runs);
    free(ctx->futhark_mc_segmap_parloop_236716_iter);
    free(ctx->futhark_mc_segmap_task_236714_total_runtime);
    free(ctx->futhark_mc_segmap_task_236714_runs);
    free(ctx->futhark_mc_segmap_task_236714_iter);
    free(ctx->futhark_mc_segmap_parloop_236720_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236720_runs);
    free(ctx->futhark_mc_segmap_parloop_236720_iter);
    free(ctx->futhark_mc_segmap_task_236718_total_runtime);
    free(ctx->futhark_mc_segmap_task_236718_runs);
    free(ctx->futhark_mc_segmap_task_236718_iter);
    free(ctx->futhark_mc_segmap_parloop_236735_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236735_runs);
    free(ctx->futhark_mc_segmap_parloop_236735_iter);
    free(ctx->futhark_mc_segmap_task_236733_total_runtime);
    free(ctx->futhark_mc_segmap_task_236733_runs);
    free(ctx->futhark_mc_segmap_task_236733_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236744_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236744_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236744_iter);
    free(ctx->futhark_mc_segred_task_236737_total_runtime);
    free(ctx->futhark_mc_segred_task_236737_runs);
    free(ctx->futhark_mc_segred_task_236737_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236750_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236750_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236750_iter);
    free(ctx->futhark_mc_segred_task_236746_total_runtime);
    free(ctx->futhark_mc_segred_task_236746_runs);
    free(ctx->futhark_mc_segred_task_236746_iter);
    free(ctx->futhark_mc_segmap_parloop_236727_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236727_runs);
    free(ctx->futhark_mc_segmap_parloop_236727_iter);
    free(ctx->futhark_mc_segmap_nested_task_236725_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236725_runs);
    free(ctx->futhark_mc_segmap_nested_task_236725_iter);
    free(ctx->futhark_mc_segmap_parloop_236703_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236703_runs);
    free(ctx->futhark_mc_segmap_parloop_236703_iter);
    free(ctx->futhark_mc_segmap_nested_task_236701_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236701_runs);
    free(ctx->futhark_mc_segmap_nested_task_236701_iter);
    free(ctx->futhark_mc_segmap_parloop_236754_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236754_runs);
    free(ctx->futhark_mc_segmap_parloop_236754_iter);
    free(ctx->futhark_mc_segmap_task_236752_total_runtime);
    free(ctx->futhark_mc_segmap_task_236752_runs);
    free(ctx->futhark_mc_segmap_task_236752_iter);
    free(ctx->futhark_mc_segmap_parloop_236763_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236763_runs);
    free(ctx->futhark_mc_segmap_parloop_236763_iter);
    free(ctx->futhark_mc_segmap_task_236761_total_runtime);
    free(ctx->futhark_mc_segmap_task_236761_runs);
    free(ctx->futhark_mc_segmap_task_236761_iter);
    free(ctx->futhark_mc_segmap_parloop_236758_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236758_runs);
    free(ctx->futhark_mc_segmap_parloop_236758_iter);
    free(ctx->futhark_mc_segmap_nested_task_236756_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236756_runs);
    free(ctx->futhark_mc_segmap_nested_task_236756_iter);
    free(ctx->futhark_mc_segmap_parloop_236767_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236767_runs);
    free(ctx->futhark_mc_segmap_parloop_236767_iter);
    free(ctx->futhark_mc_segmap_task_236765_total_runtime);
    free(ctx->futhark_mc_segmap_task_236765_runs);
    free(ctx->futhark_mc_segmap_task_236765_iter);
    free(ctx->futhark_mc_segmap_parloop_236778_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236778_runs);
    free(ctx->futhark_mc_segmap_parloop_236778_iter);
    free(ctx->futhark_mc_segmap_task_236776_total_runtime);
    free(ctx->futhark_mc_segmap_task_236776_runs);
    free(ctx->futhark_mc_segmap_task_236776_iter);
    free(ctx->futhark_mc_segmap_parloop_236782_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236782_runs);
    free(ctx->futhark_mc_segmap_parloop_236782_iter);
    free(ctx->futhark_mc_segmap_task_236780_total_runtime);
    free(ctx->futhark_mc_segmap_task_236780_runs);
    free(ctx->futhark_mc_segmap_task_236780_iter);
    free(ctx->futhark_mc_segmap_parloop_236772_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236772_runs);
    free(ctx->futhark_mc_segmap_parloop_236772_iter);
    free(ctx->futhark_mc_segmap_nested_task_236770_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236770_runs);
    free(ctx->futhark_mc_segmap_nested_task_236770_iter);
    free(ctx->futhark_mc_segmap_parloop_236786_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236786_runs);
    free(ctx->futhark_mc_segmap_parloop_236786_iter);
    free(ctx->futhark_mc_segmap_task_236784_total_runtime);
    free(ctx->futhark_mc_segmap_task_236784_runs);
    free(ctx->futhark_mc_segmap_task_236784_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_236807_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_236807_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_236807_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_236809_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_236809_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_236809_iter);
    free(ctx->futhark_mc_segscan_task_236801_total_runtime);
    free(ctx->futhark_mc_segscan_task_236801_runs);
    free(ctx->futhark_mc_segscan_task_236801_iter);
    free(ctx->futhark_mc_segmap_parloop_236813_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236813_runs);
    free(ctx->futhark_mc_segmap_parloop_236813_iter);
    free(ctx->futhark_mc_segmap_task_236811_total_runtime);
    free(ctx->futhark_mc_segmap_task_236811_runs);
    free(ctx->futhark_mc_segmap_task_236811_iter);
    free(ctx->futhark_mc_segmap_parloop_236794_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236794_runs);
    free(ctx->futhark_mc_segmap_parloop_236794_iter);
    free(ctx->futhark_mc_segmap_nested_task_236792_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236792_runs);
    free(ctx->futhark_mc_segmap_nested_task_236792_iter);
    free(ctx->futhark_mc_segmap_parloop_236817_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236817_runs);
    free(ctx->futhark_mc_segmap_parloop_236817_iter);
    free(ctx->futhark_mc_segmap_task_236815_total_runtime);
    free(ctx->futhark_mc_segmap_task_236815_runs);
    free(ctx->futhark_mc_segmap_task_236815_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_236825_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_236825_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_236825_iter);
    free(ctx->futhark_mc_segred_task_236822_total_runtime);
    free(ctx->futhark_mc_segred_task_236822_runs);
    free(ctx->futhark_mc_segred_task_236822_iter);
    free(ctx->futhark_mc_segmap_parloop_236820_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236820_runs);
    free(ctx->futhark_mc_segmap_parloop_236820_iter);
    free(ctx->futhark_mc_segmap_nested_task_236818_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236818_runs);
    free(ctx->futhark_mc_segmap_nested_task_236818_iter);
    free(ctx->futhark_mc_segmap_parloop_236829_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236829_runs);
    free(ctx->futhark_mc_segmap_parloop_236829_iter);
    free(ctx->futhark_mc_segmap_task_236827_total_runtime);
    free(ctx->futhark_mc_segmap_task_236827_runs);
    free(ctx->futhark_mc_segmap_task_236827_iter);
    free(ctx->futhark_mc_segmap_parloop_236838_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236838_runs);
    free(ctx->futhark_mc_segmap_parloop_236838_iter);
    free(ctx->futhark_mc_segmap_task_236836_total_runtime);
    free(ctx->futhark_mc_segmap_task_236836_runs);
    free(ctx->futhark_mc_segmap_task_236836_iter);
    free(ctx->futhark_mc_segmap_parloop_236833_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236833_runs);
    free(ctx->futhark_mc_segmap_parloop_236833_iter);
    free(ctx->futhark_mc_segmap_nested_task_236831_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_236831_runs);
    free(ctx->futhark_mc_segmap_nested_task_236831_iter);
    free(ctx->futhark_mc_segmap_parloop_236847_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236847_runs);
    free(ctx->futhark_mc_segmap_parloop_236847_iter);
    free(ctx->futhark_mc_segmap_task_236845_total_runtime);
    free(ctx->futhark_mc_segmap_task_236845_runs);
    free(ctx->futhark_mc_segmap_task_236845_iter);
    free(ctx->futhark_mc_segmap_parloop_236842_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_236842_runs);
    free(ctx->futhark_mc_segmap_parloop_236842_iter);
    free(ctx->futhark_mc_segmap_task_236840_total_runtime);
    free(ctx->futhark_mc_segmap_task_236840_runs);
    free(ctx->futhark_mc_segmap_task_236840_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_235583 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_235583_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235583_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235583_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235583_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235583_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235583_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235583_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235583_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235583_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235583_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235583_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235583_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235583_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_235583_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235583_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235583_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235583_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235583_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235583_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235583_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235583_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235583_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235583_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235583_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235583_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235583_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235583_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235593         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235593_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235593_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235593_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235593_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235593_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235593_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235593_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235593_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235593_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235593_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235593_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235593_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235593_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235593_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235593_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235593_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235593_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235593_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235593_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235593_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235593_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235593_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235593_total_iter /
                (ctx->futhark_mc_segmap_parloop_235593_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235593_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235593_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235593_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235591            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235591_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235591_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235591_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235591_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235591_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235591_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235591_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235591_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235591_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235591_iter[i] /
                    (ctx->futhark_mc_segmap_task_235591_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235591_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235598 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_235598_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235598_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235598_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235598_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235598_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235598_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235598_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235598_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235598_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235598_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235598_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235598_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235598_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_235598_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235598_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235598_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235598_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235598_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235598_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235598_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235598_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235598_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235598_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235598_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235598_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235598_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235598_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235595            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235595_runs[i],
                    (long) ctx->futhark_mc_segred_task_235595_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235595_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235595_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235595_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235595_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235595_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235595_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235595_iter[i],
                    (long) ctx->futhark_mc_segred_task_235595_iter[i] /
                    (ctx->futhark_mc_segred_task_235595_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235595_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235588 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_235588_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235588_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235588_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235588_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235588_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235588_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235588_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235588_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235588_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235588_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235588_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235588_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235588_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_235588_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235588_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235588_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235588_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235588_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235588_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235588_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235588_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235588_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235588_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235588_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235588_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235588_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235588_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235580            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235580_runs[i],
                    (long) ctx->futhark_mc_segred_task_235580_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235580_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235580_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235580_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235580_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235580_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235580_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235580_iter[i],
                    (long) ctx->futhark_mc_segred_task_235580_iter[i] /
                    (ctx->futhark_mc_segred_task_235580_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235580_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_nested_task_235585     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_nested_task_235585_runs[i],
                    (long) ctx->futhark_mc_segred_nested_task_235585_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235585_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235585_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_nested_task_235585_total_runtime[i],
                    (double) ctx->futhark_mc_segred_nested_task_235585_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235585_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_nested_task_235585_iter[i]),
                    (long) ctx->futhark_mc_segred_nested_task_235585_iter[i],
                    (long) ctx->futhark_mc_segred_nested_task_235585_iter[i] /
                    (ctx->futhark_mc_segred_nested_task_235585_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235585_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_235578   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_235578_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235578_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235578_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235578_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235578_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_235578_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235578_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235578_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235578_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235578_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235578_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235578_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_235578_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_235578_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235578_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235578_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235578_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235578_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_235578_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235578_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235578_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235578_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235578_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_235578_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235578_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_235578_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_235578_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235603 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_235603_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235603_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235603_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235603_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235603_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235603_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235603_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235603_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235603_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235603_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235603_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235603_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235603_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_235603_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235603_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235603_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235603_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235603_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235603_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235603_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235603_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235603_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235603_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235603_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235603_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235603_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235603_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_segred_stage_1_parloop_235618 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_235618_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235618_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235618_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235618_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235618_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235618_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235618_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235618_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235618_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235618_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235618_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235618_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235618_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_235618_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235618_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235618_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235618_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235618_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235618_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235618_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235618_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235618_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235618_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235618_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235618_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235618_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235618_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235615            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235615_runs[i],
                    (long) ctx->futhark_mc_segred_task_235615_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235615_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235615_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235615_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235615_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235615_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235615_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235615_iter[i],
                    (long) ctx->futhark_mc_segred_task_235615_iter[i] /
                    (ctx->futhark_mc_segred_task_235615_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235615_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235608 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_235608_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235608_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235608_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235608_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235608_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235608_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235608_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235608_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235608_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235608_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235608_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235608_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235608_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_235608_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235608_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235608_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235608_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235608_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235608_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235608_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235608_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235608_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235608_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235608_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235608_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235608_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235608_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235600            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235600_runs[i],
                    (long) ctx->futhark_mc_segred_task_235600_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235600_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235600_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235600_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235600_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235600_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235600_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235600_iter[i],
                    (long) ctx->futhark_mc_segred_task_235600_iter[i] /
                    (ctx->futhark_mc_segred_task_235600_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235600_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_nested_task_235605     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_nested_task_235605_runs[i],
                    (long) ctx->futhark_mc_segred_nested_task_235605_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235605_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235605_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_nested_task_235605_total_runtime[i],
                    (double) ctx->futhark_mc_segred_nested_task_235605_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235605_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_nested_task_235605_iter[i]),
                    (long) ctx->futhark_mc_segred_nested_task_235605_iter[i],
                    (long) ctx->futhark_mc_segred_nested_task_235605_iter[i] /
                    (ctx->futhark_mc_segred_nested_task_235605_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235605_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235625 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_235625_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235625_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235625_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235625_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235625_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235625_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235625_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235625_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235625_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235625_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235625_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235625_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235625_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_235625_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235625_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235625_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235625_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235625_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235625_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235625_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235625_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235625_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235625_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235625_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235625_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235625_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235625_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235635         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235635_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235635_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235635_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235635_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235635_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235635_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235635_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235635_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235635_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235635_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235635_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235635_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235635_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235635_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235635_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235635_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235635_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235635_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235635_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235635_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235635_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235635_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235635_total_iter /
                (ctx->futhark_mc_segmap_parloop_235635_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235635_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235635_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235635_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235633            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235633_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235633_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235633_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235633_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235633_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235633_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235633_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235633_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235633_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235633_iter[i] /
                    (ctx->futhark_mc_segmap_task_235633_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235633_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235640 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_235640_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235640_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235640_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235640_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235640_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235640_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235640_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235640_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235640_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235640_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235640_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235640_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235640_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_235640_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235640_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235640_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235640_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235640_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235640_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235640_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235640_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235640_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235640_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235640_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235640_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235640_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235640_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235637            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235637_runs[i],
                    (long) ctx->futhark_mc_segred_task_235637_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235637_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235637_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235637_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235637_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235637_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235637_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235637_iter[i],
                    (long) ctx->futhark_mc_segred_task_235637_iter[i] /
                    (ctx->futhark_mc_segred_task_235637_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235637_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235630 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_235630_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235630_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235630_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235630_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235630_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235630_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235630_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235630_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235630_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235630_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235630_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235630_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235630_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_235630_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235630_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235630_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235630_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235630_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235630_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235630_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235630_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235630_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235630_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235630_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235630_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235630_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235630_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235622            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235622_runs[i],
                    (long) ctx->futhark_mc_segred_task_235622_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235622_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235622_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235622_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235622_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235622_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235622_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235622_iter[i],
                    (long) ctx->futhark_mc_segred_task_235622_iter[i] /
                    (ctx->futhark_mc_segred_task_235622_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235622_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_nested_task_235627     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_nested_task_235627_runs[i],
                    (long) ctx->futhark_mc_segred_nested_task_235627_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235627_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235627_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_nested_task_235627_total_runtime[i],
                    (double) ctx->futhark_mc_segred_nested_task_235627_total_runtime[i] /
                    (ctx->futhark_mc_segred_nested_task_235627_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_nested_task_235627_iter[i]),
                    (long) ctx->futhark_mc_segred_nested_task_235627_iter[i],
                    (long) ctx->futhark_mc_segred_nested_task_235627_iter[i] /
                    (ctx->futhark_mc_segred_nested_task_235627_runs[i] !=
                     0 ? ctx->futhark_mc_segred_nested_task_235627_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_235620   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_235620_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235620_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235620_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235620_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235620_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_235620_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235620_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235620_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235620_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235620_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235620_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235620_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_235620_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_235620_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235620_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235620_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235620_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235620_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_235620_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235620_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235620_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235620_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235620_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_235620_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235620_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_235620_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_235620_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_235575           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_235575_runs[i],
                    (long) ctx->futhark_mc_segscan_task_235575_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235575_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235575_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_235575_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_235575_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235575_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_235575_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_235575_iter[i],
                    (long) ctx->futhark_mc_segscan_task_235575_iter[i] /
                    (ctx->futhark_mc_segscan_task_235575_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235575_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235644         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235644_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235644_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235644_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235644_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235644_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235644_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235644_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235644_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235644_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235644_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235644_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235644_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235644_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235644_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235644_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235644_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235644_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235644_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235644_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235644_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235644_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235644_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235644_total_iter /
                (ctx->futhark_mc_segmap_parloop_235644_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235644_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235644_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235644_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235642            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235642_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235642_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235642_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235642_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235642_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235642_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235642_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235642_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235642_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235642_iter[i] /
                    (ctx->futhark_mc_segmap_task_235642_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235642_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235648         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235648_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235648_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235648_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235648_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235648_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235648_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235648_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235648_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235648_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235648_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235648_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235648_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235648_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235648_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235648_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235648_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235648_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235648_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235648_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235648_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235648_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235648_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235648_total_iter /
                (ctx->futhark_mc_segmap_parloop_235648_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235648_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235648_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235648_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_235660   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_235660_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235660_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235660_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235660_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235660_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_235660_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235660_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235660_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235660_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235660_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235660_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235660_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_235660_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_235660_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235660_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235660_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235660_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235660_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_235660_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235660_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235660_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235660_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235660_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_235660_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235660_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_235660_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_235660_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_235662   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_235662_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235662_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235662_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235662_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235662_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_235662_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235662_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235662_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235662_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235662_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235662_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235662_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_235662_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_235662_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235662_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235662_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235662_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235662_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_235662_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235662_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235662_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235662_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235662_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_235662_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235662_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_235662_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_235662_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_235657           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_235657_runs[i],
                    (long) ctx->futhark_mc_segscan_task_235657_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235657_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235657_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_235657_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_235657_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235657_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_235657_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_235657_iter[i],
                    (long) ctx->futhark_mc_segscan_task_235657_iter[i] /
                    (ctx->futhark_mc_segscan_task_235657_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235657_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235666         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235666_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235666_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235666_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235666_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235666_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235666_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235666_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235666_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235666_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235666_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235666_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235666_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235666_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235666_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235666_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235666_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235666_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235666_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235666_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235666_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235666_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235666_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235666_total_iter /
                (ctx->futhark_mc_segmap_parloop_235666_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235666_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235666_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235666_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235664            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235664_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235664_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235664_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235664_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235664_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235664_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235664_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235664_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235664_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235664_iter[i] /
                    (ctx->futhark_mc_segmap_task_235664_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235664_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235653         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235653_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235653_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235653_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235653_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235653_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235653_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235653_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235653_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235653_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235653_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235653_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235653_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235653_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235653_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235653_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235653_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235653_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235653_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235653_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235653_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235653_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235653_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235653_total_iter /
                (ctx->futhark_mc_segmap_parloop_235653_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235653_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235653_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235653_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235646            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235646_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235646_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235646_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235646_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235646_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235646_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235646_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235646_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235646_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235646_iter[i] /
                    (ctx->futhark_mc_segmap_task_235646_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235646_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235651     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235651_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235651_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235651_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235651_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235651_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235651_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235651_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235651_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235651_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235651_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235651_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235651_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235670         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235670_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235670_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235670_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235670_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235670_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235670_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235670_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235670_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235670_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235670_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235670_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235670_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235670_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235670_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235670_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235670_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235670_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235670_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235670_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235670_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235670_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235670_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235670_total_iter /
                (ctx->futhark_mc_segmap_parloop_235670_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235670_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235670_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235670_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235679         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235679_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235679_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235679_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235679_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235679_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235679_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235679_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235679_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235679_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235679_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235679_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235679_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235679_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235679_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235679_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235679_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235679_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235679_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235679_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235679_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235679_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235679_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235679_total_iter /
                (ctx->futhark_mc_segmap_parloop_235679_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235679_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235679_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235679_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235688         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235688_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235688_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235688_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235688_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235688_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235688_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235688_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235688_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235688_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235688_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235688_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235688_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235688_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235688_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235688_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235688_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235688_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235688_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235688_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235688_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235688_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235688_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235688_total_iter /
                (ctx->futhark_mc_segmap_parloop_235688_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235688_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235688_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235688_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235686            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235686_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235686_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235686_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235686_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235686_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235686_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235686_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235686_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235686_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235686_iter[i] /
                    (ctx->futhark_mc_segmap_task_235686_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235686_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235683         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235683_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235683_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235683_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235683_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235683_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235683_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235683_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235683_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235683_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235683_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235683_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235683_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235683_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235683_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235683_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235683_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235683_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235683_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235683_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235683_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235683_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235683_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235683_total_iter /
                (ctx->futhark_mc_segmap_parloop_235683_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235683_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235683_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235683_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235677            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235677_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235677_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235677_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235677_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235677_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235677_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235677_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235677_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235677_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235677_iter[i] /
                    (ctx->futhark_mc_segmap_task_235677_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235677_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235681     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235681_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235681_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235681_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235681_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235681_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235681_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235681_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235681_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235681_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235681_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235681_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235681_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235674         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235674_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235674_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235674_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235674_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235674_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235674_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235674_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235674_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235674_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235674_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235674_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235674_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235674_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235674_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235674_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235674_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235674_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235674_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235674_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235674_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235674_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235674_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235674_total_iter /
                (ctx->futhark_mc_segmap_parloop_235674_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235674_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235674_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235674_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235668            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235668_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235668_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235668_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235668_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235668_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235668_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235668_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235668_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235668_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235668_iter[i] /
                    (ctx->futhark_mc_segmap_task_235668_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235668_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235672     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235672_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235672_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235672_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235672_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235672_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235672_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235672_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235672_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235672_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235672_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235672_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235672_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235692         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235692_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235692_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235692_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235692_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235692_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235692_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235692_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235692_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235692_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235692_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235692_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235692_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235692_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235692_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235692_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235692_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235692_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235692_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235692_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235692_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235692_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235692_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235692_total_iter /
                (ctx->futhark_mc_segmap_parloop_235692_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235692_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235692_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235692_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235705         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235705_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235705_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235705_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235705_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235705_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235705_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235705_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235705_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235705_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235705_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235705_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235705_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235705_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235705_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235705_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235705_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235705_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235705_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235705_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235705_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235705_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235705_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235705_total_iter /
                (ctx->futhark_mc_segmap_parloop_235705_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235705_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235705_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235705_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_235717   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_235717_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235717_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235717_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235717_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235717_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_235717_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235717_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235717_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235717_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_235717_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_235717_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_235717_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_235717_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_235717_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235717_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235717_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235717_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235717_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_235717_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_235717_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_235717_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_235717_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_235717_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_235717_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_235717_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_235717_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_235717_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_235719   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_235719_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235719_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235719_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235719_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235719_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_235719_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235719_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235719_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235719_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_235719_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_235719_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_235719_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_235719_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_235719_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235719_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235719_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235719_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235719_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_235719_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_235719_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_235719_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_235719_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_235719_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_235719_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_235719_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_235719_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_235719_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_235714           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_235714_runs[i],
                    (long) ctx->futhark_mc_segscan_task_235714_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235714_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235714_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_235714_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_235714_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_235714_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_235714_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_235714_iter[i],
                    (long) ctx->futhark_mc_segscan_task_235714_iter[i] /
                    (ctx->futhark_mc_segscan_task_235714_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_235714_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235723         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235723_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235723_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235723_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235723_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235723_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235723_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235723_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235723_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235723_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235723_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235723_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235723_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235723_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235723_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235723_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235723_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235723_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235723_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235723_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235723_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235723_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235723_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235723_total_iter /
                (ctx->futhark_mc_segmap_parloop_235723_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235723_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235723_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235723_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235721            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235721_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235721_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235721_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235721_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235721_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235721_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235721_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235721_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235721_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235721_iter[i] /
                    (ctx->futhark_mc_segmap_task_235721_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235721_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235710         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235710_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235710_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235710_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235710_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235710_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235710_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235710_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235710_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235710_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235710_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235710_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235710_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235710_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235710_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235710_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235710_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235710_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235710_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235710_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235710_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235710_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235710_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235710_total_iter /
                (ctx->futhark_mc_segmap_parloop_235710_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235710_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235710_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235710_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235703            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235703_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235703_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235703_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235703_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235703_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235703_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235703_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235703_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235703_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235703_iter[i] /
                    (ctx->futhark_mc_segmap_task_235703_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235703_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235708     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235708_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235708_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235708_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235708_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235708_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235708_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235708_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235708_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235708_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235708_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235708_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235708_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235699         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235699_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235699_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235699_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235699_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235699_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235699_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235699_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235699_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235699_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235699_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235699_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235699_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235699_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235699_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235699_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235699_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235699_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235699_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235699_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235699_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235699_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235699_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235699_total_iter /
                (ctx->futhark_mc_segmap_parloop_235699_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235699_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235699_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235699_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235690            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235690_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235690_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235690_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235690_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235690_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235690_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235690_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235690_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235690_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235690_iter[i] /
                    (ctx->futhark_mc_segmap_task_235690_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235690_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235697     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235697_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235697_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235697_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235697_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235697_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235697_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235697_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235697_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235697_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235697_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235697_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235697_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235727         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235727_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235727_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235727_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235727_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235727_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235727_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235727_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235727_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235727_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235727_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235727_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235727_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235727_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235727_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235727_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235727_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235727_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235727_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235727_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235727_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235727_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235727_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235727_total_iter /
                (ctx->futhark_mc_segmap_parloop_235727_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235727_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235727_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235727_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235739         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235739_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235739_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235739_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235739_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235739_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235739_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235739_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235739_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235739_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235739_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235739_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235739_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235739_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235739_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235739_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235739_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235739_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235739_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235739_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235739_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235739_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235739_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235739_total_iter /
                (ctx->futhark_mc_segmap_parloop_235739_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235739_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235739_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235739_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235752         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235752_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235752_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235752_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235752_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235752_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235752_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235752_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235752_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235752_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235752_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235752_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235752_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235752_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235752_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235752_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235752_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235752_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235752_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235752_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235752_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235752_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235752_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235752_total_iter /
                (ctx->futhark_mc_segmap_parloop_235752_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235752_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235752_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235752_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235750            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235750_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235750_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235750_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235750_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235750_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235750_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235750_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235750_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235750_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235750_iter[i] /
                    (ctx->futhark_mc_segmap_task_235750_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235750_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235756         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235756_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235756_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235756_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235756_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235756_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235756_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235756_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235756_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235756_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235756_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235756_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235756_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235756_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235756_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235756_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235756_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235756_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235756_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235756_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235756_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235756_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235756_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235756_total_iter /
                (ctx->futhark_mc_segmap_parloop_235756_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235756_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235756_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235756_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235754            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235754_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235754_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235754_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235754_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235754_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235754_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235754_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235754_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235754_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235754_iter[i] /
                    (ctx->futhark_mc_segmap_task_235754_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235754_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235745         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235745_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235745_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235745_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235745_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235745_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235745_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235745_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235745_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235745_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235745_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235745_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235745_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235745_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235745_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235745_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235745_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235745_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235745_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235745_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235745_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235745_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235745_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235745_total_iter /
                (ctx->futhark_mc_segmap_parloop_235745_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235745_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235745_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235745_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235737            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235737_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235737_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235737_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235737_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235737_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235737_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235737_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235737_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235737_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235737_iter[i] /
                    (ctx->futhark_mc_segmap_task_235737_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235737_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235743     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235743_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235743_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235743_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235743_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235743_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235743_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235743_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235743_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235743_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235743_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235743_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235743_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235733         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235733_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235733_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235733_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235733_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235733_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235733_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235733_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235733_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235733_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235733_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235733_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235733_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235733_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235733_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235733_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235733_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235733_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235733_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235733_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235733_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235733_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235733_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235733_total_iter /
                (ctx->futhark_mc_segmap_parloop_235733_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235733_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235733_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235733_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235725            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235725_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235725_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235725_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235725_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235725_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235725_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235725_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235725_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235725_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235725_iter[i] /
                    (ctx->futhark_mc_segmap_task_235725_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235725_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235731     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235731_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235731_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235731_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235731_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235731_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235731_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235731_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235731_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235731_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235731_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235731_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235731_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235760         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235760_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235760_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235760_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235760_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235760_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235760_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235760_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235760_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235760_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235760_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235760_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235760_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235760_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235760_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235760_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235760_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235760_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235760_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235760_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235760_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235760_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235760_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235760_total_iter /
                (ctx->futhark_mc_segmap_parloop_235760_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235760_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235760_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235760_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235773         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235773_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235773_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235773_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235773_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235773_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235773_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235773_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235773_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235773_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235773_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235773_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235773_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235773_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235773_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235773_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235773_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235773_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235773_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235773_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235773_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235773_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235773_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235773_total_iter /
                (ctx->futhark_mc_segmap_parloop_235773_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235773_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235773_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235773_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235771            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235771_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235771_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235771_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235771_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235771_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235771_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235771_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235771_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235771_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235771_iter[i] /
                    (ctx->futhark_mc_segmap_task_235771_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235771_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235777         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235777_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235777_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235777_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235777_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235777_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235777_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235777_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235777_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235777_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235777_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235777_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235777_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235777_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235777_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235777_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235777_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235777_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235777_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235777_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235777_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235777_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235777_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235777_total_iter /
                (ctx->futhark_mc_segmap_parloop_235777_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235777_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235777_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235777_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235775            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235775_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235775_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235775_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235775_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235775_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235775_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235775_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235775_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235775_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235775_iter[i] /
                    (ctx->futhark_mc_segmap_task_235775_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235775_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235766         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235766_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235766_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235766_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235766_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235766_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235766_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235766_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235766_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235766_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235766_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235766_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235766_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235766_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235766_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235766_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235766_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235766_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235766_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235766_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235766_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235766_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235766_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235766_total_iter /
                (ctx->futhark_mc_segmap_parloop_235766_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235766_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235766_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235766_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235758            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235758_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235758_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235758_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235758_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235758_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235758_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235758_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235758_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235758_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235758_iter[i] /
                    (ctx->futhark_mc_segmap_task_235758_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235758_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235764     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235764_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235764_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235764_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235764_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235764_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235764_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235764_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235764_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235764_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235764_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235764_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235764_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_235794         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235794_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235794_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235794_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235794_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235794_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235794_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235794_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235794_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235794_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235794_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235794_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235794_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235794_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235794_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235794_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235794_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235794_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235794_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235794_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235794_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235794_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235794_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235794_total_iter /
                (ctx->futhark_mc_segmap_parloop_235794_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235794_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235794_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235794_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235792            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235792_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235792_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235792_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235792_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235792_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235792_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235792_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235792_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235792_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235792_iter[i] /
                    (ctx->futhark_mc_segmap_task_235792_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235792_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235798         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235798_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235798_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235798_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235798_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235798_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235798_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235798_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235798_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235798_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235798_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235798_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235798_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235798_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235798_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235798_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235798_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235798_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235798_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235798_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235798_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235798_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235798_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235798_total_iter /
                (ctx->futhark_mc_segmap_parloop_235798_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235798_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235798_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235798_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235796            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235796_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235796_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235796_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235796_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235796_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235796_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235796_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235796_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235796_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235796_iter[i] /
                    (ctx->futhark_mc_segmap_task_235796_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235796_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235787         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235787_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235787_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235787_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235787_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235787_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235787_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235787_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235787_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235787_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235787_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235787_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235787_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235787_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235787_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235787_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235787_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235787_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235787_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235787_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235787_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235787_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235787_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235787_total_iter /
                (ctx->futhark_mc_segmap_parloop_235787_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235787_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235787_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235787_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_235785     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235785_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235785_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235785_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235785_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235785_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235785_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235785_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235785_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235785_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235785_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235785_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235785_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235802         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235802_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235802_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235802_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235802_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235802_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235802_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235802_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235802_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235802_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235802_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235802_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235802_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235802_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235802_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235802_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235802_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235802_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235802_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235802_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235802_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235802_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235802_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235802_total_iter /
                (ctx->futhark_mc_segmap_parloop_235802_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235802_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235802_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235802_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235811         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235811_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235811_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235811_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235811_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235811_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235811_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235811_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235811_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235811_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235811_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235811_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235811_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235811_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235811_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235811_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235811_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235811_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235811_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235811_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235811_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235811_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235811_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235811_total_iter /
                (ctx->futhark_mc_segmap_parloop_235811_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235811_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235811_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235811_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235809            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235809_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235809_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235809_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235809_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235809_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235809_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235809_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235809_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235809_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235809_iter[i] /
                    (ctx->futhark_mc_segmap_task_235809_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235809_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235806         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235806_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235806_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235806_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235806_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235806_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235806_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235806_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235806_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235806_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235806_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235806_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235806_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235806_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235806_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235806_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235806_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235806_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235806_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235806_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235806_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235806_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235806_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235806_total_iter /
                (ctx->futhark_mc_segmap_parloop_235806_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235806_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235806_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235806_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235800            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235800_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235800_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235800_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235800_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235800_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235800_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235800_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235800_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235800_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235800_iter[i] /
                    (ctx->futhark_mc_segmap_task_235800_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235800_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235804     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235804_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235804_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235804_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235804_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235804_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235804_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235804_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235804_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235804_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235804_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235804_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235804_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235815         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235815_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235815_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235815_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235815_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235815_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235815_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235815_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235815_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235815_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235815_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235815_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235815_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235815_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235815_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235815_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235815_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235815_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235815_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235815_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235815_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235815_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235815_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235815_total_iter /
                (ctx->futhark_mc_segmap_parloop_235815_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235815_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235815_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235815_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235826         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235826_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235826_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235826_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235826_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235826_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235826_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235826_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235826_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235826_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235826_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235826_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235826_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235826_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235826_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235826_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235826_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235826_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235826_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235826_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235826_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235826_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235826_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235826_total_iter /
                (ctx->futhark_mc_segmap_parloop_235826_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235826_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235826_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235826_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235837         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235837_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235837_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235837_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235837_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235837_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235837_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235837_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235837_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235837_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235837_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235837_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235837_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235837_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235837_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235837_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235837_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235837_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235837_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235837_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235837_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235837_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235837_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235837_total_iter /
                (ctx->futhark_mc_segmap_parloop_235837_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235837_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235837_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235837_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235835            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235835_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235835_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235835_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235835_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235835_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235835_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235835_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235835_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235835_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235835_iter[i] /
                    (ctx->futhark_mc_segmap_task_235835_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235835_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235831         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235831_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235831_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235831_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235831_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235831_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235831_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235831_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235831_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235831_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235831_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235831_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235831_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235831_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235831_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235831_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235831_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235831_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235831_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235831_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235831_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235831_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235831_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235831_total_iter /
                (ctx->futhark_mc_segmap_parloop_235831_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235831_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235831_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235831_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235824            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235824_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235824_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235824_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235824_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235824_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235824_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235824_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235824_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235824_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235824_iter[i] /
                    (ctx->futhark_mc_segmap_task_235824_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235824_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235829     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235829_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235829_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235829_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235829_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235829_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235829_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235829_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235829_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235829_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235829_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235829_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235829_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_task_235813            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235813_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235813_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235813_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235813_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235813_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235813_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235813_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235813_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235813_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235813_iter[i] /
                    (ctx->futhark_mc_segmap_task_235813_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235813_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235818     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235818_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235818_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235818_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235818_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235818_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235818_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235818_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235818_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235818_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235818_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235818_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235818_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235841         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235841_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235841_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235841_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235841_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235841_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235841_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235841_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235841_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235841_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235841_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235841_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235841_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235841_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235841_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235841_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235841_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235841_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235841_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235841_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235841_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235841_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235841_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235841_total_iter /
                (ctx->futhark_mc_segmap_parloop_235841_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235841_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235841_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235841_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235850         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235850_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235850_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235850_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235850_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235850_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235850_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235850_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235850_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235850_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235850_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235850_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235850_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235850_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235850_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235850_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235850_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235850_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235850_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235850_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235850_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235850_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235850_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235850_total_iter /
                (ctx->futhark_mc_segmap_parloop_235850_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235850_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235850_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235850_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235859         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235859_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235859_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235859_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235859_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235859_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235859_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235859_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235859_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235859_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235859_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235859_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235859_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235859_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235859_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235859_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235859_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235859_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235859_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235859_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235859_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235859_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235859_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235859_total_iter /
                (ctx->futhark_mc_segmap_parloop_235859_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235859_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235859_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235859_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235867 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_235867_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235867_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235867_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235867_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235867_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235867_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235867_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235867_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235867_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235867_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235867_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235867_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235867_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_235867_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235867_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235867_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235867_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235867_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235867_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235867_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235867_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235867_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235867_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235867_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235867_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235867_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235867_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235864            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235864_runs[i],
                    (long) ctx->futhark_mc_segred_task_235864_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235864_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235864_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235864_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235864_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235864_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235864_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235864_iter[i],
                    (long) ctx->futhark_mc_segred_task_235864_iter[i] /
                    (ctx->futhark_mc_segred_task_235864_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235864_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235872 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_235872_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235872_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235872_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235872_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235872_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235872_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235872_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235872_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235872_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235872_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235872_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235872_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235872_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_235872_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235872_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235872_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235872_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235872_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235872_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235872_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235872_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235872_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235872_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235872_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235872_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235872_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235872_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235869            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235869_runs[i],
                    (long) ctx->futhark_mc_segred_task_235869_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235869_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235869_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235869_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235869_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235869_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235869_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235869_iter[i],
                    (long) ctx->futhark_mc_segred_task_235869_iter[i] /
                    (ctx->futhark_mc_segred_task_235869_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235869_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235862         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235862_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235862_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235862_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235862_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235862_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235862_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235862_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235862_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235862_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235862_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235862_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235862_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235862_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235862_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235862_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235862_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235862_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235862_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235862_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235862_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235862_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235862_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235862_total_iter /
                (ctx->futhark_mc_segmap_parloop_235862_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235862_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235862_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235862_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235857            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235857_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235857_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235857_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235857_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235857_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235857_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235857_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235857_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235857_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235857_iter[i] /
                    (ctx->futhark_mc_segmap_task_235857_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235857_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235860     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235860_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235860_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235860_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235860_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235860_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235860_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235860_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235860_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235860_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235860_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235860_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235860_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235854         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235854_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235854_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235854_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235854_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235854_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235854_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235854_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235854_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235854_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235854_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235854_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235854_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235854_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235854_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235854_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235854_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235854_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235854_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235854_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235854_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235854_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235854_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235854_total_iter /
                (ctx->futhark_mc_segmap_parloop_235854_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235854_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235854_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235854_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235848            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235848_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235848_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235848_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235848_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235848_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235848_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235848_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235848_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235848_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235848_iter[i] /
                    (ctx->futhark_mc_segmap_task_235848_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235848_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235852     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235852_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235852_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235852_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235852_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235852_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235852_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235852_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235852_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235852_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235852_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235852_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235852_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235845         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235845_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235845_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235845_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235845_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235845_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235845_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235845_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235845_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235845_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235845_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235845_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235845_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235845_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235845_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235845_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235845_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235845_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235845_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235845_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235845_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235845_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235845_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235845_total_iter /
                (ctx->futhark_mc_segmap_parloop_235845_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235845_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235845_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235845_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235839            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235839_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235839_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235839_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235839_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235839_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235839_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235839_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235839_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235839_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235839_iter[i] /
                    (ctx->futhark_mc_segmap_task_235839_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235839_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235843     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235843_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235843_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235843_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235843_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235843_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235843_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235843_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235843_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235843_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235843_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235843_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235843_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235876         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235876_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235876_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235876_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235876_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235876_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235876_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235876_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235876_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235876_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235876_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235876_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235876_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235876_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235876_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235876_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235876_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235876_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235876_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235876_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235876_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235876_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235876_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235876_total_iter /
                (ctx->futhark_mc_segmap_parloop_235876_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235876_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235876_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235876_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235887         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235887_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235887_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235887_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235887_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235887_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235887_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235887_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235887_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235887_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235887_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235887_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235887_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235887_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235887_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235887_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235887_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235887_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235887_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235887_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235887_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235887_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235887_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235887_total_iter /
                (ctx->futhark_mc_segmap_parloop_235887_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235887_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235887_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235887_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235898         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235898_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235898_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235898_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235898_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235898_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235898_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235898_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235898_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235898_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235898_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235898_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235898_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235898_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235898_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235898_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235898_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235898_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235898_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235898_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235898_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235898_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235898_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235898_total_iter /
                (ctx->futhark_mc_segmap_parloop_235898_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235898_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235898_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235898_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235908 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_235908_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235908_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235908_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235908_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235908_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235908_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235908_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235908_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235908_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235908_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235908_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235908_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235908_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_235908_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235908_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235908_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235908_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235908_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235908_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235908_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235908_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235908_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235908_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235908_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235908_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235908_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235908_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235903            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235903_runs[i],
                    (long) ctx->futhark_mc_segred_task_235903_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235903_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235903_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235903_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235903_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235903_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235903_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235903_iter[i],
                    (long) ctx->futhark_mc_segred_task_235903_iter[i] /
                    (ctx->futhark_mc_segred_task_235903_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235903_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235914 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_235914_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235914_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235914_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235914_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235914_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235914_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235914_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235914_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235914_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235914_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235914_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235914_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235914_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_235914_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235914_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235914_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235914_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235914_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235914_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235914_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235914_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235914_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235914_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235914_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235914_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235914_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235914_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235910            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235910_runs[i],
                    (long) ctx->futhark_mc_segred_task_235910_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235910_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235910_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235910_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235910_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235910_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235910_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235910_iter[i],
                    (long) ctx->futhark_mc_segred_task_235910_iter[i] /
                    (ctx->futhark_mc_segred_task_235910_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235910_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235901         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235901_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235901_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235901_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235901_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235901_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235901_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235901_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235901_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235901_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235901_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235901_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235901_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235901_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235901_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235901_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235901_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235901_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235901_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235901_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235901_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235901_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235901_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235901_total_iter /
                (ctx->futhark_mc_segmap_parloop_235901_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235901_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235901_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235901_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235896            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235896_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235896_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235896_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235896_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235896_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235896_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235896_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235896_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235896_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235896_iter[i] /
                    (ctx->futhark_mc_segmap_task_235896_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235896_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235899     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235899_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235899_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235899_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235899_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235899_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235899_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235899_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235899_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235899_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235899_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235899_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235899_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235892         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235892_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235892_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235892_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235892_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235892_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235892_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235892_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235892_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235892_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235892_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235892_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235892_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235892_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235892_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235892_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235892_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235892_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235892_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235892_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235892_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235892_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235892_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235892_total_iter /
                (ctx->futhark_mc_segmap_parloop_235892_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235892_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235892_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235892_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235885            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235885_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235885_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235885_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235885_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235885_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235885_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235885_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235885_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235885_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235885_iter[i] /
                    (ctx->futhark_mc_segmap_task_235885_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235885_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235890     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235890_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235890_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235890_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235890_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235890_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235890_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235890_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235890_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235890_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235890_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235890_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235890_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235881         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235881_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235881_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235881_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235881_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235881_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235881_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235881_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235881_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235881_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235881_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235881_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235881_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235881_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235881_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235881_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235881_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235881_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235881_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235881_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235881_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235881_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235881_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235881_total_iter /
                (ctx->futhark_mc_segmap_parloop_235881_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235881_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235881_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235881_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235874            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235874_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235874_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235874_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235874_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235874_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235874_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235874_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235874_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235874_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235874_iter[i] /
                    (ctx->futhark_mc_segmap_task_235874_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235874_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235879     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235879_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235879_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235879_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235879_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235879_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235879_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235879_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235879_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235879_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235879_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235879_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235879_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235918         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235918_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235918_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235918_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235918_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235918_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235918_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235918_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235918_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235918_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235918_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235918_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235918_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235918_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235918_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235918_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235918_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235918_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235918_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235918_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235918_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235918_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235918_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235918_total_iter /
                (ctx->futhark_mc_segmap_parloop_235918_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235918_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235918_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235918_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235929         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235929_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235929_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235929_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235929_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235929_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235929_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235929_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235929_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235929_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235929_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235929_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235929_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235929_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235929_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235929_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235929_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235929_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235929_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235929_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235929_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235929_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235929_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235929_total_iter /
                (ctx->futhark_mc_segmap_parloop_235929_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235929_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235929_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235929_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235940         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235940_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235940_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235940_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235940_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235940_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235940_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235940_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235940_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235940_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235940_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235940_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235940_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235940_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235940_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235940_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235940_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235940_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235940_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235940_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235940_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235940_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235940_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235940_total_iter /
                (ctx->futhark_mc_segmap_parloop_235940_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235940_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235940_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235940_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235952 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_235952_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235952_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235952_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235952_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235952_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235952_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235952_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235952_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235952_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235952_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235952_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235952_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235952_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_235952_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235952_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235952_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235952_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235952_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235952_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235952_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235952_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235952_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235952_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235952_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235952_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235952_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235952_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235945            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235945_runs[i],
                    (long) ctx->futhark_mc_segred_task_235945_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235945_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235945_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235945_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235945_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235945_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235945_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235945_iter[i],
                    (long) ctx->futhark_mc_segred_task_235945_iter[i] /
                    (ctx->futhark_mc_segred_task_235945_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235945_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235958 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_235958_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235958_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235958_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235958_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235958_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235958_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235958_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235958_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235958_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235958_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235958_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235958_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235958_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_235958_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235958_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235958_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235958_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235958_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235958_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235958_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235958_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235958_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235958_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235958_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235958_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235958_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235958_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235954            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235954_runs[i],
                    (long) ctx->futhark_mc_segred_task_235954_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235954_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235954_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235954_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235954_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235954_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235954_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235954_iter[i],
                    (long) ctx->futhark_mc_segred_task_235954_iter[i] /
                    (ctx->futhark_mc_segred_task_235954_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235954_runs[i] : 1));
        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_task_235938            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235938_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235938_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235938_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235938_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235938_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235938_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235938_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235938_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235938_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235938_iter[i] /
                    (ctx->futhark_mc_segmap_task_235938_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235938_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235941     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235941_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235941_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235941_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235941_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235941_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235941_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235941_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235941_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235941_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235941_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235941_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235941_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_task_235927            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235927_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235927_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235927_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235927_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235927_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235927_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235927_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235927_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235927_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235927_iter[i] /
                    (ctx->futhark_mc_segmap_task_235927_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235927_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235932     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235932_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235932_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235932_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235932_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235932_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235932_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235932_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235932_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235932_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235932_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235932_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235932_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235923         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235923_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235923_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235923_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235923_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235923_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235923_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235923_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235923_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235923_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235923_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235923_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235923_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235923_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235923_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235923_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235923_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235923_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235923_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235923_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235923_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235923_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235923_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235923_total_iter /
                (ctx->futhark_mc_segmap_parloop_235923_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235923_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235923_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235923_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235916            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235916_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235916_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235916_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235916_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235916_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235916_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235916_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235916_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235916_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235916_iter[i] /
                    (ctx->futhark_mc_segmap_task_235916_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235916_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235921     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235921_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235921_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235921_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235921_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235921_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235921_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235921_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235921_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235921_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235921_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235921_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235921_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235962         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235962_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235962_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235962_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235962_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235962_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235962_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235962_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235962_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235962_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235962_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235962_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235962_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235962_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235962_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235962_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235962_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235962_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235962_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235962_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235962_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235962_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235962_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235962_total_iter /
                (ctx->futhark_mc_segmap_parloop_235962_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235962_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235962_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235962_total_runs;
        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_parloop_235982         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235982_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235982_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235982_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235982_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235982_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235982_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235982_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235982_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235982_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235982_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235982_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235982_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235982_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235982_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235982_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235982_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235982_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235982_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235982_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235982_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235982_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235982_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235982_total_iter /
                (ctx->futhark_mc_segmap_parloop_235982_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235982_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235982_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235982_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235992 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_235992_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235992_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235992_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235992_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235992_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235992_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235992_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235992_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235992_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235992_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235992_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235992_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235992_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_235992_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235992_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235992_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235992_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235992_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235992_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235992_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235992_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235992_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235992_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235992_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235992_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235992_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235992_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235989            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235989_runs[i],
                    (long) ctx->futhark_mc_segred_task_235989_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235989_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235989_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235989_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235989_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235989_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235989_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235989_iter[i],
                    (long) ctx->futhark_mc_segred_task_235989_iter[i] /
                    (ctx->futhark_mc_segred_task_235989_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235989_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_235997 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_235997_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235997_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235997_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235997_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235997_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_235997_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235997_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235997_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235997_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_235997_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_235997_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_235997_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_235997_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_235997_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235997_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235997_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235997_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235997_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_235997_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_235997_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_235997_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_235997_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_235997_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_235997_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_235997_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_235997_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_235997_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_235994            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_235994_runs[i],
                    (long) ctx->futhark_mc_segred_task_235994_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235994_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235994_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_235994_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_235994_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_235994_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_235994_iter[i]),
                    (long) ctx->futhark_mc_segred_task_235994_iter[i],
                    (long) ctx->futhark_mc_segred_task_235994_iter[i] /
                    (ctx->futhark_mc_segred_task_235994_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_235994_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235986         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235986_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235986_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235986_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235986_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235986_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235986_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235986_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235986_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235986_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235986_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235986_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235986_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235986_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235986_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235986_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235986_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235986_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235986_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235986_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235986_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235986_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235986_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235986_total_iter /
                (ctx->futhark_mc_segmap_parloop_235986_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235986_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235986_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235986_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235980            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235980_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235980_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235980_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235980_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235980_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235980_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235980_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235980_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235980_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235980_iter[i] /
                    (ctx->futhark_mc_segmap_task_235980_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235980_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235984     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235984_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235984_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235984_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235984_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235984_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235984_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235984_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235984_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235984_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235984_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235984_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235984_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235977         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235977_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235977_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235977_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235977_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235977_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235977_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235977_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235977_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235977_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235977_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235977_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235977_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235977_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235977_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235977_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235977_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235977_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235977_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235977_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235977_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235977_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235977_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235977_total_iter /
                (ctx->futhark_mc_segmap_parloop_235977_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235977_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235977_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235977_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235970            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235970_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235970_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235970_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235970_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235970_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235970_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235970_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235970_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235970_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235970_iter[i] /
                    (ctx->futhark_mc_segmap_task_235970_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235970_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235975     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235975_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235975_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235975_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235975_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235975_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235975_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235975_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235975_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235975_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235975_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235975_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235975_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_235967         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_235967_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_235967_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235967_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235967_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_235967_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_235967_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_235967_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235967_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_235967_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_235967_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_235967_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_235967_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_235967_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_235967_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_235967_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235967_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235967_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_235967_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_235967_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_235967_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_235967_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_235967_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_235967_total_iter /
                (ctx->futhark_mc_segmap_parloop_235967_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_235967_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_235967_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_235967_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235960            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235960_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235960_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235960_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235960_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235960_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235960_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235960_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235960_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235960_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235960_iter[i] /
                    (ctx->futhark_mc_segmap_task_235960_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235960_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_235965     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_235965_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235965_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235965_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235965_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_235965_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_235965_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_235965_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_235965_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_235965_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_235965_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_235965_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_235965_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236001         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236001_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236001_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236001_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236001_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236001_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236001_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236001_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236001_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236001_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236001_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236001_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236001_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236001_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236001_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236001_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236001_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236001_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236001_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236001_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236001_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236001_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236001_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236001_total_iter /
                (ctx->futhark_mc_segmap_parloop_236001_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236001_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236001_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236001_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236014         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236014_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236014_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236014_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236014_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236014_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236014_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236014_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236014_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236014_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236014_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236014_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236014_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236014_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236014_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236014_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236014_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236014_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236014_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236014_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236014_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236014_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236014_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236014_total_iter /
                (ctx->futhark_mc_segmap_parloop_236014_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236014_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236014_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236014_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236027         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236027_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236027_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236027_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236027_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236027_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236027_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236027_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236027_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236027_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236027_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236027_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236027_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236027_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236027_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236027_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236027_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236027_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236027_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236027_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236027_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236027_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236027_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236027_total_iter /
                (ctx->futhark_mc_segmap_parloop_236027_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236027_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236027_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236027_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236041 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_236041_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236041_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236041_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236041_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236041_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236041_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236041_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236041_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236041_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236041_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236041_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236041_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236041_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_236041_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236041_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236041_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236041_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236041_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236041_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236041_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236041_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236041_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236041_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236041_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236041_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236041_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236041_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236036            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236036_runs[i],
                    (long) ctx->futhark_mc_segred_task_236036_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236036_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236036_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236036_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236036_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236036_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236036_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236036_iter[i],
                    (long) ctx->futhark_mc_segred_task_236036_iter[i] /
                    (ctx->futhark_mc_segred_task_236036_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236036_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_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_segred_stage_1_parloop_236047_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236047_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236047_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236047_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236047_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236047_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236047_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236047_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236047_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236047_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236047_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236047_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_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_segred_stage_1_parloop_236047_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236047_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236047_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236047_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236047_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236047_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236047_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236047_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236047_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236047_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236047_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236047_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236047_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236047_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236043            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236043_runs[i],
                    (long) ctx->futhark_mc_segred_task_236043_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236043_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236043_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236043_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236043_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236043_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236043_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236043_iter[i],
                    (long) ctx->futhark_mc_segred_task_236043_iter[i] /
                    (ctx->futhark_mc_segred_task_236043_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236043_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236032         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236032_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236032_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236032_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236032_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236032_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236032_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236032_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236032_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236032_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236032_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236032_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236032_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236032_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236032_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236032_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236032_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236032_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236032_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236032_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236032_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236032_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236032_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236032_total_iter /
                (ctx->futhark_mc_segmap_parloop_236032_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236032_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236032_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236032_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236025            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236025_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236025_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236025_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236025_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236025_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236025_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236025_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236025_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236025_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236025_iter[i] /
                    (ctx->futhark_mc_segmap_task_236025_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236025_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236030     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236030_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236030_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236030_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236030_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236030_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236030_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236030_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236030_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236030_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236030_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236030_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236030_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236021         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236021_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236021_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236021_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236021_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236021_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236021_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236021_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236021_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236021_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236021_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236021_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236021_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236021_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236021_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236021_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236021_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236021_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236021_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236021_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236021_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236021_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236021_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236021_total_iter /
                (ctx->futhark_mc_segmap_parloop_236021_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236021_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236021_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236021_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236012            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236012_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236012_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236012_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236012_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236012_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236012_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236012_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236012_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236012_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236012_iter[i] /
                    (ctx->futhark_mc_segmap_task_236012_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236012_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236019     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236019_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236019_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236019_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236019_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236019_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236019_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236019_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236019_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236019_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236019_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236019_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236019_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236008         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236008_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236008_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236008_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236008_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236008_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236008_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236008_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236008_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236008_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236008_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236008_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236008_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236008_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236008_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236008_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236008_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236008_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236008_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236008_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236008_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236008_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236008_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236008_total_iter /
                (ctx->futhark_mc_segmap_parloop_236008_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236008_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236008_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236008_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_235999            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_235999_runs[i],
                    (long) ctx->futhark_mc_segmap_task_235999_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235999_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235999_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_235999_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_235999_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_235999_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_235999_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_235999_iter[i],
                    (long) ctx->futhark_mc_segmap_task_235999_iter[i] /
                    (ctx->futhark_mc_segmap_task_235999_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_235999_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236006     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236006_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236006_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236006_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236006_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236006_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236006_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236006_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236006_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236006_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236006_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236006_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236006_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236051         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236051_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236051_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236051_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236051_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236051_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236051_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236051_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236051_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236051_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236051_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236051_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236051_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236051_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236051_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236051_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236051_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236051_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236051_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236051_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236051_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236051_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236051_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236051_total_iter /
                (ctx->futhark_mc_segmap_parloop_236051_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236051_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236051_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236051_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236066         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236066_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236066_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236066_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236066_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236066_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236066_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236066_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236066_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236066_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236066_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236066_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236066_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236066_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236066_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236066_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236066_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236066_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236066_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236066_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236066_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236066_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236066_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236066_total_iter /
                (ctx->futhark_mc_segmap_parloop_236066_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236066_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236066_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236066_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236081         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236081_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236081_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236081_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236081_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236081_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236081_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236081_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236081_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236081_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236081_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236081_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236081_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236081_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236081_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236081_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236081_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236081_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236081_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236081_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236081_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236081_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236081_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236081_total_iter /
                (ctx->futhark_mc_segmap_parloop_236081_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236081_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236081_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236081_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236096         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236096_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236096_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236096_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236096_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236096_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236096_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236096_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236096_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236096_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236096_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236096_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236096_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236096_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236096_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236096_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236096_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236096_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236096_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236096_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236096_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236096_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236096_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236096_total_iter /
                (ctx->futhark_mc_segmap_parloop_236096_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236096_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236096_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236096_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236094            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236094_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236094_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236094_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236094_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236094_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236094_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236094_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236094_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236094_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236094_iter[i] /
                    (ctx->futhark_mc_segmap_task_236094_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236094_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236105 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_236105_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236105_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236105_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236105_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236105_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236105_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236105_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236105_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236105_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236105_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236105_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236105_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236105_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_236105_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236105_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236105_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236105_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236105_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236105_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236105_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236105_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236105_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236105_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236105_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236105_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236105_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236105_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236098            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236098_runs[i],
                    (long) ctx->futhark_mc_segred_task_236098_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236098_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236098_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236098_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236098_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236098_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236098_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236098_iter[i],
                    (long) ctx->futhark_mc_segred_task_236098_iter[i] /
                    (ctx->futhark_mc_segred_task_236098_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236098_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236111 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_236111_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236111_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236111_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236111_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236111_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236111_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236111_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236111_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236111_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236111_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236111_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236111_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236111_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_236111_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236111_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236111_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236111_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236111_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236111_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236111_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236111_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236111_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236111_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236111_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236111_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236111_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236111_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236107            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236107_runs[i],
                    (long) ctx->futhark_mc_segred_task_236107_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236107_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236107_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236107_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236107_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236107_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236107_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236107_iter[i],
                    (long) ctx->futhark_mc_segred_task_236107_iter[i] /
                    (ctx->futhark_mc_segred_task_236107_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236107_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236088         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236088_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236088_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236088_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236088_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236088_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236088_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236088_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236088_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236088_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236088_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236088_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236088_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236088_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236088_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236088_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236088_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236088_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236088_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236088_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236088_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236088_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236088_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236088_total_iter /
                (ctx->futhark_mc_segmap_parloop_236088_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236088_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236088_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236088_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236079            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236079_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236079_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236079_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236079_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236079_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236079_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236079_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236079_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236079_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236079_iter[i] /
                    (ctx->futhark_mc_segmap_task_236079_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236079_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236086     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236086_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236086_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236086_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236086_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236086_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236086_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236086_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236086_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236086_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236086_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236086_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236086_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236075         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236075_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236075_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236075_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236075_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236075_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236075_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236075_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236075_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236075_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236075_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236075_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236075_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236075_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236075_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236075_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236075_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236075_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236075_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236075_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236075_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236075_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236075_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236075_total_iter /
                (ctx->futhark_mc_segmap_parloop_236075_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236075_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236075_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236075_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236064            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236064_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236064_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236064_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236064_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236064_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236064_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236064_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236064_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236064_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236064_iter[i] /
                    (ctx->futhark_mc_segmap_task_236064_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236064_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236073     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236073_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236073_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236073_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236073_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236073_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236073_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236073_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236073_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236073_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236073_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236073_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236073_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236060         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236060_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236060_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236060_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236060_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236060_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236060_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236060_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236060_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236060_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236060_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236060_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236060_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236060_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236060_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236060_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236060_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236060_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236060_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236060_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236060_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236060_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236060_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236060_total_iter /
                (ctx->futhark_mc_segmap_parloop_236060_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236060_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236060_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236060_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236049            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236049_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236049_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236049_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236049_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236049_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236049_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236049_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236049_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236049_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236049_iter[i] /
                    (ctx->futhark_mc_segmap_task_236049_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236049_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236058     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236058_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236058_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236058_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236058_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236058_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236058_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236058_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236058_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236058_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236058_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236058_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236058_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_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_parloop_236133         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236133_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236133_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236133_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236133_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236133_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236133_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236133_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236133_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236133_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236133_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236133_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236133_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236133_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236133_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236133_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236133_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236133_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236133_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236133_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236133_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236133_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236133_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236133_total_iter /
                (ctx->futhark_mc_segmap_parloop_236133_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236133_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236133_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236133_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236131            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236131_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236131_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236131_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236131_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236131_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236131_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236131_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236131_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236131_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236131_iter[i] /
                    (ctx->futhark_mc_segmap_task_236131_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236131_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236128         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236128_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236128_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236128_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236128_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236128_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236128_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236128_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236128_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236128_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236128_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236128_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236128_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236128_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236128_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236128_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236128_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236128_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236128_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236128_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236128_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236128_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236128_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236128_total_iter /
                (ctx->futhark_mc_segmap_parloop_236128_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236128_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236128_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236128_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236122            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236122_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236122_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236122_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236122_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236122_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236122_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236122_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236122_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236122_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236122_iter[i] /
                    (ctx->futhark_mc_segmap_task_236122_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236122_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236126     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236126_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236126_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236126_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236126_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236126_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236126_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236126_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236126_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236126_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236126_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236126_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236126_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236119         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236119_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236119_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236119_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236119_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236119_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236119_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236119_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236119_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236119_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236119_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236119_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236119_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236119_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236119_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236119_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236119_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236119_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236119_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236119_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236119_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236119_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236119_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236119_total_iter /
                (ctx->futhark_mc_segmap_parloop_236119_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236119_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236119_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236119_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236113            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236113_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236113_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236113_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236113_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236113_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236113_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236113_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236113_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236113_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236113_iter[i] /
                    (ctx->futhark_mc_segmap_task_236113_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236113_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236117     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236117_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236117_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236117_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236117_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236117_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236117_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236117_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236117_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236117_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236117_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236117_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236117_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236137         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236137_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236137_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236137_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236137_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236137_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236137_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236137_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236137_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236137_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236137_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236137_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236137_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236137_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236137_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236137_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236137_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236137_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236137_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236137_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236137_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236137_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236137_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236137_total_iter /
                (ctx->futhark_mc_segmap_parloop_236137_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236137_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236137_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236137_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236146         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236146_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236146_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236146_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236146_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236146_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236146_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236146_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236146_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236146_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236146_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236146_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236146_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236146_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236146_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236146_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236146_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236146_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236146_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236146_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236146_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236146_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236146_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236146_total_iter /
                (ctx->futhark_mc_segmap_parloop_236146_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236146_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236146_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236146_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236144            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236144_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236144_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236144_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236144_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236144_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236144_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236144_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236144_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236144_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236144_iter[i] /
                    (ctx->futhark_mc_segmap_task_236144_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236144_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236141         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236141_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236141_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236141_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236141_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236141_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236141_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236141_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236141_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236141_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236141_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236141_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236141_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236141_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236141_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236141_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236141_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236141_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236141_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236141_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236141_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236141_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236141_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236141_total_iter /
                (ctx->futhark_mc_segmap_parloop_236141_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236141_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236141_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236141_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236135            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236135_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236135_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236135_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236135_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236135_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236135_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236135_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236135_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236135_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236135_iter[i] /
                    (ctx->futhark_mc_segmap_task_236135_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236135_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236139     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236139_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236139_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236139_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236139_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236139_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236139_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236139_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236139_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236139_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236139_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236139_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236139_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236150         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236150_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236150_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236150_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236150_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236150_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236150_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236150_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236150_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236150_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236150_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236150_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236150_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236150_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236150_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236150_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236150_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236150_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236150_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236150_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236150_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236150_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236150_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236150_total_iter /
                (ctx->futhark_mc_segmap_parloop_236150_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236150_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236150_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236150_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236158 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_236158_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236158_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236158_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236158_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236158_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236158_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236158_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236158_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236158_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236158_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236158_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236158_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236158_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_236158_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236158_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236158_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236158_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236158_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236158_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236158_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236158_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236158_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236158_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236158_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236158_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236158_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236158_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236155            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236155_runs[i],
                    (long) ctx->futhark_mc_segred_task_236155_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236155_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236155_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236155_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236155_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236155_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236155_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236155_iter[i],
                    (long) ctx->futhark_mc_segred_task_236155_iter[i] /
                    (ctx->futhark_mc_segred_task_236155_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236155_runs[i] : 1));
        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_segmap_task_236148            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236148_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236148_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236148_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236148_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236148_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236148_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236148_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236148_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236148_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236148_iter[i] /
                    (ctx->futhark_mc_segmap_task_236148_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236148_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236151     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236151_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236151_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236151_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236151_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236151_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236151_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236151_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236151_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236151_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236151_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236151_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236151_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236162         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236162_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236162_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236162_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236162_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236162_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236162_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236162_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236162_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236162_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236162_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236162_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236162_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236162_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236162_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236162_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236162_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236162_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236162_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236162_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236162_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236162_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236162_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236162_total_iter /
                (ctx->futhark_mc_segmap_parloop_236162_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236162_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236162_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236162_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_236172   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_236172_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236172_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236172_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236172_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236172_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_236172_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236172_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236172_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236172_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236172_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236172_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236172_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_236172_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_236172_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236172_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236172_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236172_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236172_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_236172_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236172_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236172_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236172_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236172_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_236172_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236172_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_236172_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_236172_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_236174   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_236174_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236174_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236174_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236174_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236174_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_236174_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236174_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236174_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236174_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236174_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236174_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236174_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_236174_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_236174_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236174_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236174_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236174_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236174_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_236174_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236174_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236174_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236174_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236174_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_236174_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236174_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_236174_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_236174_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_236169           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_236169_runs[i],
                    (long) ctx->futhark_mc_segscan_task_236169_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236169_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236169_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_236169_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_236169_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236169_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_236169_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_236169_iter[i],
                    (long) ctx->futhark_mc_segscan_task_236169_iter[i] /
                    (ctx->futhark_mc_segscan_task_236169_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236169_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236166         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236166_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236166_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236166_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236166_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236166_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236166_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236166_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236166_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236166_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236166_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236166_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236166_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236166_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236166_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236166_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236166_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236166_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236166_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236166_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236166_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236166_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236166_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236166_total_iter /
                (ctx->futhark_mc_segmap_parloop_236166_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236166_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236166_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236166_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236160            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236160_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236160_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236160_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236160_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236160_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236160_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236160_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236160_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236160_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236160_iter[i] /
                    (ctx->futhark_mc_segmap_task_236160_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236160_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236164     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236164_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236164_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236164_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236164_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236164_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236164_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236164_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236164_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236164_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236164_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236164_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236164_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236178         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236178_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236178_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236178_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236178_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236178_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236178_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236178_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236178_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236178_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236178_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236178_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236178_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236178_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236178_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236178_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236178_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236178_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236178_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236178_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236178_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236178_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236178_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236178_total_iter /
                (ctx->futhark_mc_segmap_parloop_236178_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236178_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236178_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236178_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236186 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_236186_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236186_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236186_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236186_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236186_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236186_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236186_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236186_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236186_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236186_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236186_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236186_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236186_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_236186_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236186_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236186_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236186_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236186_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236186_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236186_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236186_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236186_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236186_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236186_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236186_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236186_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236186_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236183            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236183_runs[i],
                    (long) ctx->futhark_mc_segred_task_236183_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236183_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236183_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236183_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236183_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236183_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236183_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236183_iter[i],
                    (long) ctx->futhark_mc_segred_task_236183_iter[i] /
                    (ctx->futhark_mc_segred_task_236183_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236183_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236181         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236181_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236181_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236181_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236181_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236181_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236181_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236181_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236181_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236181_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236181_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236181_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236181_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236181_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236181_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236181_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236181_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236181_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236181_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236181_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236181_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236181_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236181_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236181_total_iter /
                (ctx->futhark_mc_segmap_parloop_236181_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236181_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236181_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236181_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236176            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236176_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236176_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236176_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236176_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236176_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236176_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236176_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236176_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236176_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236176_iter[i] /
                    (ctx->futhark_mc_segmap_task_236176_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236176_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236179     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236179_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236179_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236179_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236179_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236179_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236179_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236179_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236179_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236179_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236179_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236179_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236179_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_scan_stage_1_parloop_236200   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_236200_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236200_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236200_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236200_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236200_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_236200_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236200_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236200_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236200_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236200_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236200_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236200_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_236200_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_236200_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236200_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236200_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236200_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236200_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_236200_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236200_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236200_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236200_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236200_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_236200_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236200_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_236200_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_236200_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_236202   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_236202_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236202_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236202_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236202_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236202_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_236202_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236202_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236202_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236202_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236202_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236202_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236202_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_236202_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_236202_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236202_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236202_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236202_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236202_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_236202_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236202_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236202_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236202_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236202_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_236202_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236202_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_236202_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_236202_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_236197           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_236197_runs[i],
                    (long) ctx->futhark_mc_segscan_task_236197_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236197_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236197_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_236197_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_236197_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236197_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_236197_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_236197_iter[i],
                    (long) ctx->futhark_mc_segscan_task_236197_iter[i] /
                    (ctx->futhark_mc_segscan_task_236197_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236197_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236194         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236194_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236194_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236194_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236194_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236194_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236194_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236194_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236194_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236194_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236194_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236194_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236194_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236194_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236194_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236194_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236194_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236194_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236194_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236194_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236194_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236194_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236194_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236194_total_iter /
                (ctx->futhark_mc_segmap_parloop_236194_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236194_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236194_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236194_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236188            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236188_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236188_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236188_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236188_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236188_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236188_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236188_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236188_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236188_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236188_iter[i] /
                    (ctx->futhark_mc_segmap_task_236188_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236188_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236192     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236192_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236192_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236192_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236192_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236192_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236192_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236192_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236192_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236192_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236192_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236192_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236192_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236206         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236206_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236206_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236206_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236206_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236206_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236206_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236206_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236206_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236206_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236206_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236206_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236206_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236206_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236206_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236206_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236206_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236206_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236206_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236206_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236206_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236206_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236206_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236206_total_iter /
                (ctx->futhark_mc_segmap_parloop_236206_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236206_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236206_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236206_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236214 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_236214_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236214_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236214_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236214_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236214_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236214_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236214_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236214_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236214_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236214_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236214_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236214_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236214_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_236214_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236214_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236214_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236214_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236214_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236214_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236214_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236214_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236214_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236214_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236214_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236214_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236214_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236214_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236211            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236211_runs[i],
                    (long) ctx->futhark_mc_segred_task_236211_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236211_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236211_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236211_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236211_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236211_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236211_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236211_iter[i],
                    (long) ctx->futhark_mc_segred_task_236211_iter[i] /
                    (ctx->futhark_mc_segred_task_236211_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236211_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_task_236204            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236204_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236204_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236204_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236204_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236204_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236204_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236204_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236204_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236204_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236204_iter[i] /
                    (ctx->futhark_mc_segmap_task_236204_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236204_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236207     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236207_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236207_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236207_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236207_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236207_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236207_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236207_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236207_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236207_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236207_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236207_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236207_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_scan_stage_1_parloop_236228   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_236228_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236228_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236228_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236228_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236228_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_236228_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236228_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236228_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236228_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236228_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236228_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236228_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_236228_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_236228_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236228_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236228_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236228_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236228_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_236228_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236228_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236228_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236228_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236228_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_236228_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236228_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_236228_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_236228_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_236230   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_236230_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236230_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236230_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236230_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236230_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_236230_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236230_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236230_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236230_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236230_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236230_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236230_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_236230_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_236230_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236230_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236230_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236230_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236230_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_236230_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236230_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236230_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236230_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236230_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_236230_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236230_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_236230_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_236230_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_236225           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_236225_runs[i],
                    (long) ctx->futhark_mc_segscan_task_236225_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236225_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236225_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_236225_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_236225_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236225_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_236225_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_236225_iter[i],
                    (long) ctx->futhark_mc_segscan_task_236225_iter[i] /
                    (ctx->futhark_mc_segscan_task_236225_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236225_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236222         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236222_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236222_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236222_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236222_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236222_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236222_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236222_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236222_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236222_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236222_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236222_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236222_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236222_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236222_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236222_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236222_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236222_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236222_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236222_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236222_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236222_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236222_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236222_total_iter /
                (ctx->futhark_mc_segmap_parloop_236222_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236222_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236222_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236222_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236216            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236216_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236216_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236216_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236216_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236216_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236216_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236216_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236216_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236216_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236216_iter[i] /
                    (ctx->futhark_mc_segmap_task_236216_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236216_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236220     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236220_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236220_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236220_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236220_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236220_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236220_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236220_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236220_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236220_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236220_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236220_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236220_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236234         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236234_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236234_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236234_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236234_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236234_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236234_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236234_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236234_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236234_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236234_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236234_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236234_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236234_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236234_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236234_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236234_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236234_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236234_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236234_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236234_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236234_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236234_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236234_total_iter /
                (ctx->futhark_mc_segmap_parloop_236234_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236234_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236234_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236234_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236243         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236243_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236243_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236243_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236243_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236243_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236243_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236243_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236243_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236243_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236243_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236243_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236243_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236243_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236243_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236243_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236243_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236243_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236243_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236243_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236243_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236243_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236243_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236243_total_iter /
                (ctx->futhark_mc_segmap_parloop_236243_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236243_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236243_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236243_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236251 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_236251_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236251_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236251_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236251_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236251_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236251_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236251_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236251_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236251_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236251_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236251_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236251_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236251_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_236251_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236251_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236251_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236251_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236251_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236251_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236251_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236251_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236251_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236251_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236251_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236251_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236251_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236251_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236248            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236248_runs[i],
                    (long) ctx->futhark_mc_segred_task_236248_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236248_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236248_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236248_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236248_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236248_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236248_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236248_iter[i],
                    (long) ctx->futhark_mc_segred_task_236248_iter[i] /
                    (ctx->futhark_mc_segred_task_236248_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236248_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236256 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_236256_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236256_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236256_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236256_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236256_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236256_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236256_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236256_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236256_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236256_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236256_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236256_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236256_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_236256_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236256_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236256_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236256_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236256_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236256_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236256_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236256_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236256_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236256_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236256_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236256_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236256_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236256_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236253            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236253_runs[i],
                    (long) ctx->futhark_mc_segred_task_236253_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236253_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236253_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236253_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236253_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236253_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236253_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236253_iter[i],
                    (long) ctx->futhark_mc_segred_task_236253_iter[i] /
                    (ctx->futhark_mc_segred_task_236253_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236253_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236246         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236246_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236246_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236246_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236246_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236246_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236246_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236246_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236246_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236246_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236246_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236246_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236246_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236246_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236246_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236246_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236246_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236246_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236246_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236246_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236246_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236246_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236246_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236246_total_iter /
                (ctx->futhark_mc_segmap_parloop_236246_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236246_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236246_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236246_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236241            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236241_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236241_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236241_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236241_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236241_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236241_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236241_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236241_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236241_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236241_iter[i] /
                    (ctx->futhark_mc_segmap_task_236241_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236241_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236244     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236244_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236244_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236244_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236244_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236244_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236244_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236244_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236244_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236244_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236244_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236244_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236244_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236238         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236238_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236238_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236238_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236238_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236238_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236238_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236238_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236238_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236238_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236238_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236238_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236238_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236238_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236238_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236238_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236238_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236238_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236238_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236238_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236238_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236238_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236238_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236238_total_iter /
                (ctx->futhark_mc_segmap_parloop_236238_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236238_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236238_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236238_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236232            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236232_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236232_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236232_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236232_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236232_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236232_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236232_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236232_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236232_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236232_iter[i] /
                    (ctx->futhark_mc_segmap_task_236232_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236232_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236236     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236236_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236236_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236236_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236236_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236236_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236236_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236236_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236236_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236236_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236236_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236236_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236236_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236260         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236260_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236260_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236260_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236260_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236260_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236260_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236260_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236260_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236260_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236260_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236260_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236260_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236260_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236260_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236260_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236260_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236260_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236260_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236260_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236260_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236260_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236260_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236260_total_iter /
                (ctx->futhark_mc_segmap_parloop_236260_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236260_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236260_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236260_total_runs;
        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_segred_stage_1_parloop_236281 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_236281_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236281_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236281_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236281_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236281_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236281_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236281_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236281_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236281_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236281_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236281_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236281_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236281_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_236281_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236281_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236281_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236281_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236281_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236281_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236281_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236281_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236281_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236281_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236281_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236281_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236281_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236281_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236276            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236276_runs[i],
                    (long) ctx->futhark_mc_segred_task_236276_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236276_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236276_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236276_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236276_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236276_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236276_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236276_iter[i],
                    (long) ctx->futhark_mc_segred_task_236276_iter[i] /
                    (ctx->futhark_mc_segred_task_236276_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236276_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236287 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_236287_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236287_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236287_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236287_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236287_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236287_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236287_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236287_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236287_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236287_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236287_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236287_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236287_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_236287_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236287_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236287_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236287_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236287_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236287_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236287_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236287_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236287_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236287_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236287_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236287_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236287_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236287_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236283            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236283_runs[i],
                    (long) ctx->futhark_mc_segred_task_236283_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236283_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236283_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236283_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236283_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236283_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236283_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236283_iter[i],
                    (long) ctx->futhark_mc_segred_task_236283_iter[i] /
                    (ctx->futhark_mc_segred_task_236283_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236283_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236274         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236274_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236274_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236274_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236274_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236274_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236274_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236274_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236274_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236274_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236274_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236274_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236274_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236274_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236274_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236274_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236274_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236274_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236274_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236274_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236274_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236274_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236274_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236274_total_iter /
                (ctx->futhark_mc_segmap_parloop_236274_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236274_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236274_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236274_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_236272     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236272_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236272_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236272_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236272_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236272_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236272_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236272_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236272_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236272_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236272_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236272_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236272_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236265         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236265_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236265_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236265_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236265_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236265_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236265_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236265_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236265_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236265_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236265_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236265_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236265_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236265_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236265_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236265_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236265_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236265_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236265_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236265_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236265_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236265_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236265_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236265_total_iter /
                (ctx->futhark_mc_segmap_parloop_236265_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236265_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236265_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236265_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236258            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236258_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236258_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236258_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236258_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236258_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236258_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236258_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236258_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236258_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236258_iter[i] /
                    (ctx->futhark_mc_segmap_task_236258_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236258_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236263     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236263_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236263_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236263_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236263_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236263_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236263_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236263_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236263_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236263_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236263_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236263_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236263_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_parloop_236302         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236302_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236302_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236302_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236302_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236302_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236302_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236302_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236302_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236302_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236302_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236302_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236302_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236302_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236302_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236302_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236302_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236302_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236302_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236302_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236302_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236302_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236302_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236302_total_iter /
                (ctx->futhark_mc_segmap_parloop_236302_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236302_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236302_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236302_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236314 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_236314_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236314_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236314_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236314_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236314_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236314_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236314_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236314_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236314_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236314_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236314_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236314_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236314_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_236314_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236314_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236314_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236314_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236314_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236314_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236314_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236314_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236314_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236314_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236314_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236314_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236314_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236314_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236307            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236307_runs[i],
                    (long) ctx->futhark_mc_segred_task_236307_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236307_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236307_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236307_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236307_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236307_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236307_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236307_iter[i],
                    (long) ctx->futhark_mc_segred_task_236307_iter[i] /
                    (ctx->futhark_mc_segred_task_236307_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236307_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_236316            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236316_runs[i],
                    (long) ctx->futhark_mc_segred_task_236316_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236316_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236316_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236316_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236316_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236316_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236316_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236316_iter[i],
                    (long) ctx->futhark_mc_segred_task_236316_iter[i] /
                    (ctx->futhark_mc_segred_task_236316_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236316_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236305         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236305_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236305_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236305_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236305_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236305_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236305_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236305_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236305_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236305_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236305_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236305_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236305_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236305_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236305_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236305_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236305_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236305_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236305_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236305_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236305_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236305_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236305_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236305_total_iter /
                (ctx->futhark_mc_segmap_parloop_236305_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236305_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236305_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236305_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236300            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236300_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236300_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236300_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236300_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236300_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236300_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236300_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236300_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236300_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236300_iter[i] /
                    (ctx->futhark_mc_segmap_task_236300_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236300_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236303     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236303_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236303_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236303_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236303_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236303_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236303_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236303_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236303_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236303_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236303_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236303_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236303_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236296         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236296_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236296_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236296_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236296_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236296_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236296_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236296_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236296_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236296_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236296_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236296_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236296_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236296_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236296_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236296_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236296_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236296_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236296_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236296_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236296_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236296_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236296_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236296_total_iter /
                (ctx->futhark_mc_segmap_parloop_236296_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236296_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236296_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236296_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236289            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236289_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236289_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236289_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236289_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236289_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236289_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236289_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236289_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236289_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236289_iter[i] /
                    (ctx->futhark_mc_segmap_task_236289_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236289_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236294     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236294_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236294_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236294_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236294_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236294_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236294_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236294_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236294_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236294_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236294_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236294_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236294_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_236334         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236334_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236334_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236334_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236334_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236334_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236334_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236334_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236334_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236334_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236334_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236334_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236334_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236334_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236334_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236334_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236334_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236334_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236334_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236334_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236334_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236334_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236334_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236334_total_iter /
                (ctx->futhark_mc_segmap_parloop_236334_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236334_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236334_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236334_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236344 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_236344_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236344_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236344_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236344_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236344_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236344_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236344_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236344_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236344_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236344_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236344_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236344_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236344_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_236344_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236344_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236344_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236344_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236344_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236344_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236344_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236344_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236344_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236344_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236344_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236344_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236344_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236344_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236341            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236341_runs[i],
                    (long) ctx->futhark_mc_segred_task_236341_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236341_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236341_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236341_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236341_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236341_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236341_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236341_iter[i],
                    (long) ctx->futhark_mc_segred_task_236341_iter[i] /
                    (ctx->futhark_mc_segred_task_236341_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236341_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236349 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_236349_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236349_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236349_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236349_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236349_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236349_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236349_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236349_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236349_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236349_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236349_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236349_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236349_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_236349_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236349_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236349_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236349_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236349_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236349_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236349_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236349_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236349_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236349_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236349_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236349_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236349_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236349_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236346            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236346_runs[i],
                    (long) ctx->futhark_mc_segred_task_236346_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236346_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236346_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236346_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236346_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236346_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236346_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236346_iter[i],
                    (long) ctx->futhark_mc_segred_task_236346_iter[i] /
                    (ctx->futhark_mc_segred_task_236346_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236346_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236338         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236338_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236338_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236338_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236338_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236338_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236338_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236338_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236338_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236338_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236338_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236338_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236338_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236338_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236338_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236338_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236338_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236338_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236338_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236338_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236338_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236338_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236338_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236338_total_iter /
                (ctx->futhark_mc_segmap_parloop_236338_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236338_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236338_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236338_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236332            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236332_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236332_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236332_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236332_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236332_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236332_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236332_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236332_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236332_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236332_iter[i] /
                    (ctx->futhark_mc_segmap_task_236332_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236332_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236336     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236336_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236336_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236336_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236336_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236336_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236336_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236336_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236336_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236336_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236336_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236336_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236336_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236329         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236329_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236329_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236329_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236329_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236329_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236329_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236329_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236329_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236329_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236329_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236329_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236329_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236329_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236329_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236329_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236329_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236329_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236329_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236329_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236329_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236329_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236329_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236329_total_iter /
                (ctx->futhark_mc_segmap_parloop_236329_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236329_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236329_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236329_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_236327     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236327_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236327_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236327_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236327_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236327_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236327_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236327_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236327_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236327_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236327_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236327_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236327_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236353         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236353_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236353_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236353_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236353_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236353_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236353_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236353_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236353_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236353_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236353_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236353_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236353_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236353_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236353_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236353_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236353_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236353_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236353_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236353_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236353_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236353_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236353_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236353_total_iter /
                (ctx->futhark_mc_segmap_parloop_236353_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236353_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236353_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236353_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236366         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236366_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236366_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236366_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236366_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236366_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236366_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236366_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236366_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236366_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236366_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236366_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236366_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236366_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236366_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236366_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236366_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236366_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236366_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236366_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236366_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236366_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236366_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236366_total_iter /
                (ctx->futhark_mc_segmap_parloop_236366_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236366_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236366_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236366_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236380 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_236380_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236380_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236380_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236380_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236380_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236380_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236380_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236380_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236380_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236380_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236380_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236380_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236380_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_236380_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236380_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236380_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236380_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236380_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236380_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236380_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236380_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236380_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236380_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236380_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236380_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236380_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236380_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236375            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236375_runs[i],
                    (long) ctx->futhark_mc_segred_task_236375_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236375_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236375_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236375_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236375_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236375_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236375_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236375_iter[i],
                    (long) ctx->futhark_mc_segred_task_236375_iter[i] /
                    (ctx->futhark_mc_segred_task_236375_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236375_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236386 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_236386_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236386_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236386_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236386_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236386_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236386_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236386_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236386_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236386_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236386_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236386_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236386_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236386_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_236386_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236386_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236386_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236386_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236386_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236386_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236386_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236386_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236386_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236386_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236386_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236386_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236386_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236386_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236382            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236382_runs[i],
                    (long) ctx->futhark_mc_segred_task_236382_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236382_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236382_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236382_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236382_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236382_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236382_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236382_iter[i],
                    (long) ctx->futhark_mc_segred_task_236382_iter[i] /
                    (ctx->futhark_mc_segred_task_236382_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236382_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236371         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236371_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236371_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236371_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236371_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236371_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236371_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236371_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236371_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236371_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236371_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236371_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236371_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236371_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236371_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236371_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236371_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236371_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236371_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236371_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236371_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236371_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236371_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236371_total_iter /
                (ctx->futhark_mc_segmap_parloop_236371_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236371_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236371_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236371_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236364            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236364_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236364_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236364_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236364_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236364_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236364_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236364_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236364_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236364_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236364_iter[i] /
                    (ctx->futhark_mc_segmap_task_236364_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236364_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236369     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236369_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236369_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236369_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236369_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236369_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236369_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236369_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236369_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236369_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236369_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236369_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236369_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236360         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236360_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236360_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236360_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236360_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236360_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236360_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236360_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236360_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236360_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236360_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236360_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236360_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236360_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236360_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236360_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236360_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236360_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236360_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236360_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236360_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236360_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236360_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236360_total_iter /
                (ctx->futhark_mc_segmap_parloop_236360_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236360_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236360_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236360_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236351            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236351_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236351_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236351_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236351_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236351_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236351_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236351_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236351_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236351_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236351_iter[i] /
                    (ctx->futhark_mc_segmap_task_236351_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236351_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236358     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236358_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236358_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236358_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236358_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236358_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236358_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236358_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236358_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236358_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236358_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236358_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236358_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_parloop_236405         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236405_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236405_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236405_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236405_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236405_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236405_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236405_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236405_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236405_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236405_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236405_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236405_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236405_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236405_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236405_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236405_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236405_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236405_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236405_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236405_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236405_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236405_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236405_total_iter /
                (ctx->futhark_mc_segmap_parloop_236405_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236405_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236405_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236405_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236420         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236420_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236420_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236420_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236420_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236420_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236420_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236420_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236420_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236420_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236420_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236420_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236420_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236420_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236420_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236420_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236420_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236420_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236420_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236420_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236420_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236420_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236420_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236420_total_iter /
                (ctx->futhark_mc_segmap_parloop_236420_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236420_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236420_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236420_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236418            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236418_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236418_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236418_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236418_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236418_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236418_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236418_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236418_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236418_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236418_iter[i] /
                    (ctx->futhark_mc_segmap_task_236418_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236418_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236429 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_236429_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236429_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236429_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236429_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236429_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236429_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236429_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236429_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236429_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236429_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236429_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236429_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236429_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_236429_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236429_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236429_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236429_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236429_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236429_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236429_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236429_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236429_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236429_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236429_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236429_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236429_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236429_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236422            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236422_runs[i],
                    (long) ctx->futhark_mc_segred_task_236422_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236422_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236422_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236422_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236422_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236422_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236422_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236422_iter[i],
                    (long) ctx->futhark_mc_segred_task_236422_iter[i] /
                    (ctx->futhark_mc_segred_task_236422_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236422_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236435 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_236435_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236435_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236435_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236435_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236435_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236435_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236435_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236435_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236435_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236435_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236435_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236435_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236435_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_236435_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236435_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236435_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236435_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236435_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236435_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236435_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236435_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236435_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236435_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236435_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236435_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236435_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236435_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236431            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236431_runs[i],
                    (long) ctx->futhark_mc_segred_task_236431_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236431_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236431_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236431_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236431_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236431_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236431_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236431_iter[i],
                    (long) ctx->futhark_mc_segred_task_236431_iter[i] /
                    (ctx->futhark_mc_segred_task_236431_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236431_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236412         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236412_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236412_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236412_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236412_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236412_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236412_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236412_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236412_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236412_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236412_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236412_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236412_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236412_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236412_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236412_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236412_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236412_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236412_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236412_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236412_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236412_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236412_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236412_total_iter /
                (ctx->futhark_mc_segmap_parloop_236412_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236412_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236412_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236412_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236403            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236403_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236403_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236403_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236403_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236403_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236403_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236403_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236403_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236403_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236403_iter[i] /
                    (ctx->futhark_mc_segmap_task_236403_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236403_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236410     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236410_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236410_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236410_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236410_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236410_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236410_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236410_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236410_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236410_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236410_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236410_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236410_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236399         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236399_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236399_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236399_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236399_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236399_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236399_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236399_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236399_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236399_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236399_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236399_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236399_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236399_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236399_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236399_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236399_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236399_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236399_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236399_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236399_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236399_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236399_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236399_total_iter /
                (ctx->futhark_mc_segmap_parloop_236399_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236399_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236399_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236399_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_nested_task_236397     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236397_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236397_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236397_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236397_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236397_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236397_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236397_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236397_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236397_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236397_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236397_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236397_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236439         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236439_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236439_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236439_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236439_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236439_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236439_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236439_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236439_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236439_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236439_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236439_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236439_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236439_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236439_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236439_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236439_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236439_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236439_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236439_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236439_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236439_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236439_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236439_total_iter /
                (ctx->futhark_mc_segmap_parloop_236439_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236439_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236439_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236439_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236448         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236448_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236448_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236448_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236448_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236448_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236448_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236448_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236448_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236448_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236448_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236448_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236448_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236448_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236448_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236448_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236448_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236448_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236448_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236448_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236448_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236448_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236448_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236448_total_iter /
                (ctx->futhark_mc_segmap_parloop_236448_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236448_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236448_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236448_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236446            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236446_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236446_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236446_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236446_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236446_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236446_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236446_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236446_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236446_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236446_iter[i] /
                    (ctx->futhark_mc_segmap_task_236446_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236446_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236443         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236443_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236443_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236443_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236443_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236443_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236443_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236443_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236443_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236443_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236443_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236443_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236443_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236443_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236443_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236443_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236443_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236443_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236443_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236443_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236443_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236443_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236443_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236443_total_iter /
                (ctx->futhark_mc_segmap_parloop_236443_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236443_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236443_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236443_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236437            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236437_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236437_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236437_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236437_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236437_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236437_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236437_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236437_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236437_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236437_iter[i] /
                    (ctx->futhark_mc_segmap_task_236437_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236437_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236441     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236441_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236441_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236441_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236441_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236441_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236441_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236441_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236441_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236441_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236441_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236441_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236441_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236452         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236452_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236452_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236452_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236452_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236452_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236452_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236452_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236452_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236452_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236452_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236452_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236452_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236452_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236452_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236452_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236452_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236452_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236452_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236452_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236452_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236452_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236452_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236452_total_iter /
                (ctx->futhark_mc_segmap_parloop_236452_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236452_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236452_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236452_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236461         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236461_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236461_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236461_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236461_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236461_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236461_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236461_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236461_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236461_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236461_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236461_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236461_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236461_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236461_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236461_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236461_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236461_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236461_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236461_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236461_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236461_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236461_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236461_total_iter /
                (ctx->futhark_mc_segmap_parloop_236461_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236461_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236461_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236461_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236459            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236459_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236459_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236459_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236459_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236459_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236459_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236459_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236459_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236459_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236459_iter[i] /
                    (ctx->futhark_mc_segmap_task_236459_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236459_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236456         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236456_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236456_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236456_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236456_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236456_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236456_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236456_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236456_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236456_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236456_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236456_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236456_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236456_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236456_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236456_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236456_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236456_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236456_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236456_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236456_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236456_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236456_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236456_total_iter /
                (ctx->futhark_mc_segmap_parloop_236456_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236456_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236456_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236456_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236450            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236450_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236450_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236450_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236450_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236450_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236450_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236450_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236450_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236450_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236450_iter[i] /
                    (ctx->futhark_mc_segmap_task_236450_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236450_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236454     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236454_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236454_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236454_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236454_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236454_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236454_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236454_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236454_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236454_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236454_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236454_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236454_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236465         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236465_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236465_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236465_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236465_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236465_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236465_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236465_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236465_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236465_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236465_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236465_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236465_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236465_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236465_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236465_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236465_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236465_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236465_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236465_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236465_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236465_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236465_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236465_total_iter /
                (ctx->futhark_mc_segmap_parloop_236465_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236465_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236465_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236465_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236480         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236480_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236480_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236480_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236480_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236480_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236480_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236480_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236480_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236480_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236480_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236480_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236480_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236480_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236480_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236480_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236480_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236480_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236480_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236480_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236480_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236480_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236480_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236480_total_iter /
                (ctx->futhark_mc_segmap_parloop_236480_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236480_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236480_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236480_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236478            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236478_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236478_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236478_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236478_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236478_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236478_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236478_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236478_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236478_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236478_iter[i] /
                    (ctx->futhark_mc_segmap_task_236478_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236478_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236484         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236484_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236484_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236484_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236484_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236484_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236484_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236484_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236484_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236484_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236484_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236484_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236484_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236484_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236484_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236484_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236484_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236484_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236484_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236484_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236484_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236484_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236484_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236484_total_iter /
                (ctx->futhark_mc_segmap_parloop_236484_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236484_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236484_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236484_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236482            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236482_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236482_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236482_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236482_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236482_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236482_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236482_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236482_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236482_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236482_iter[i] /
                    (ctx->futhark_mc_segmap_task_236482_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236482_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236488         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236488_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236488_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236488_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236488_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236488_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236488_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236488_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236488_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236488_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236488_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236488_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236488_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236488_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236488_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236488_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236488_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236488_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236488_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236488_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236488_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236488_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236488_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236488_total_iter /
                (ctx->futhark_mc_segmap_parloop_236488_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236488_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236488_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236488_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236496 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_236496_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236496_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236496_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236496_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236496_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236496_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236496_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236496_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236496_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236496_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236496_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236496_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236496_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_236496_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236496_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236496_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236496_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236496_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236496_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236496_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236496_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236496_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236496_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236496_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236496_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236496_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236496_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236493            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236493_runs[i],
                    (long) ctx->futhark_mc_segred_task_236493_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236493_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236493_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236493_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236493_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236493_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236493_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236493_iter[i],
                    (long) ctx->futhark_mc_segred_task_236493_iter[i] /
                    (ctx->futhark_mc_segred_task_236493_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236493_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236501 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_236501_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236501_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236501_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236501_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236501_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236501_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236501_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236501_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236501_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236501_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236501_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236501_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236501_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_236501_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236501_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236501_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236501_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236501_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236501_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236501_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236501_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236501_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236501_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236501_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236501_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236501_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236501_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236498            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236498_runs[i],
                    (long) ctx->futhark_mc_segred_task_236498_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236498_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236498_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236498_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236498_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236498_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236498_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236498_iter[i],
                    (long) ctx->futhark_mc_segred_task_236498_iter[i] /
                    (ctx->futhark_mc_segred_task_236498_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236498_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_236486            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236486_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236486_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236486_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236486_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236486_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236486_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236486_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236486_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236486_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236486_iter[i] /
                    (ctx->futhark_mc_segmap_task_236486_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236486_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_236472         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236472_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236472_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236472_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236472_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236472_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236472_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236472_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236472_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236472_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236472_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236472_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236472_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236472_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236472_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236472_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236472_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236472_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236472_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236472_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236472_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236472_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236472_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236472_total_iter /
                (ctx->futhark_mc_segmap_parloop_236472_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236472_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236472_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236472_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236463            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236463_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236463_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236463_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236463_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236463_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236463_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236463_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236463_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236463_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236463_iter[i] /
                    (ctx->futhark_mc_segmap_task_236463_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236463_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236470     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236470_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236470_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236470_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236470_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236470_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236470_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236470_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236470_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236470_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236470_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236470_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236470_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236505         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236505_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236505_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236505_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236505_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236505_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236505_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236505_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236505_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236505_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236505_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236505_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236505_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236505_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236505_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236505_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236505_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236505_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236505_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236505_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236505_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236505_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236505_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236505_total_iter /
                (ctx->futhark_mc_segmap_parloop_236505_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236505_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236505_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236505_total_runs;
        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_236520            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236520_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236520_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236520_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236520_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236520_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236520_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236520_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236520_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236520_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236520_iter[i] /
                    (ctx->futhark_mc_segmap_task_236520_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236520_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236526         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236526_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236526_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236526_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236526_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236526_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236526_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236526_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236526_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236526_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236526_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236526_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236526_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236526_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236526_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236526_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236526_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236526_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236526_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236526_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236526_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236526_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236526_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236526_total_iter /
                (ctx->futhark_mc_segmap_parloop_236526_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236526_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236526_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236526_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236524            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236524_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236524_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236524_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236524_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236524_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236524_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236524_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236524_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236524_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236524_iter[i] /
                    (ctx->futhark_mc_segmap_task_236524_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236524_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236530         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236530_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236530_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236530_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236530_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236530_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236530_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236530_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236530_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236530_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236530_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236530_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236530_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236530_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236530_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236530_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236530_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236530_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236530_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236530_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236530_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236530_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236530_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236530_total_iter /
                (ctx->futhark_mc_segmap_parloop_236530_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236530_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236530_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236530_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236540 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_236540_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236540_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236540_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236540_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236540_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236540_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236540_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236540_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236540_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236540_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236540_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236540_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236540_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_236540_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236540_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236540_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236540_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236540_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236540_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236540_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236540_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236540_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236540_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236540_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236540_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236540_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236540_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236535            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236535_runs[i],
                    (long) ctx->futhark_mc_segred_task_236535_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236535_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236535_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236535_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236535_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236535_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236535_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236535_iter[i],
                    (long) ctx->futhark_mc_segred_task_236535_iter[i] /
                    (ctx->futhark_mc_segred_task_236535_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236535_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236546 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_236546_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236546_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236546_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236546_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236546_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236546_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236546_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236546_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236546_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236546_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236546_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236546_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236546_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_236546_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236546_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236546_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236546_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236546_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236546_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236546_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236546_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236546_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236546_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236546_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236546_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236546_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236546_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236542            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236542_runs[i],
                    (long) ctx->futhark_mc_segred_task_236542_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236542_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236542_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236542_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236542_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236542_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236542_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236542_iter[i],
                    (long) ctx->futhark_mc_segred_task_236542_iter[i] /
                    (ctx->futhark_mc_segred_task_236542_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236542_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236533         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236533_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236533_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236533_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236533_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236533_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236533_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236533_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236533_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236533_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236533_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236533_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236533_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236533_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236533_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236533_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236533_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236533_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236533_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236533_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236533_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236533_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236533_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236533_total_iter /
                (ctx->futhark_mc_segmap_parloop_236533_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236533_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236533_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236533_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236528            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236528_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236528_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236528_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236528_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236528_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236528_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236528_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236528_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236528_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236528_iter[i] /
                    (ctx->futhark_mc_segmap_task_236528_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236528_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236531     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236531_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236531_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236531_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236531_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236531_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236531_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236531_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236531_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236531_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236531_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236531_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236531_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236513         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236513_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236513_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236513_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236513_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236513_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236513_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236513_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236513_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236513_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236513_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236513_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236513_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236513_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236513_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236513_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236513_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236513_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236513_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236513_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236513_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236513_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236513_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236513_total_iter /
                (ctx->futhark_mc_segmap_parloop_236513_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236513_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236513_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236513_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236503            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236503_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236503_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236503_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236503_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236503_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236503_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236503_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236503_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236503_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236503_iter[i] /
                    (ctx->futhark_mc_segmap_task_236503_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236503_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236511     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236511_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236511_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236511_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236511_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236511_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236511_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236511_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236511_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236511_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236511_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236511_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236511_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236550         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236550_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236550_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236550_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236550_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236550_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236550_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236550_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236550_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236550_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236550_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236550_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236550_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236550_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236550_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236550_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236550_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236550_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236550_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236550_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236550_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236550_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236550_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236550_total_iter /
                (ctx->futhark_mc_segmap_parloop_236550_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236550_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236550_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236550_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236567         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236567_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236567_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236567_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236567_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236567_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236567_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236567_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236567_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236567_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236567_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236567_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236567_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236567_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236567_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236567_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236567_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236567_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236567_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236567_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236567_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236567_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236567_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236567_total_iter /
                (ctx->futhark_mc_segmap_parloop_236567_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236567_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236567_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236567_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236565            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236565_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236565_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236565_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236565_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236565_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236565_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236565_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236565_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236565_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236565_iter[i] /
                    (ctx->futhark_mc_segmap_task_236565_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236565_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236571         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236571_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236571_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236571_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236571_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236571_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236571_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236571_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236571_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236571_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236571_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236571_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236571_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236571_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236571_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236571_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236571_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236571_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236571_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236571_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236571_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236571_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236571_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236571_total_iter /
                (ctx->futhark_mc_segmap_parloop_236571_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236571_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236571_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236571_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236569            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236569_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236569_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236569_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236569_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236569_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236569_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236569_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236569_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236569_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236569_iter[i] /
                    (ctx->futhark_mc_segmap_task_236569_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236569_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236575         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236575_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236575_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236575_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236575_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236575_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236575_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236575_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236575_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236575_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236575_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236575_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236575_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236575_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236575_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236575_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236575_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236575_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236575_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236575_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236575_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236575_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236575_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236575_total_iter /
                (ctx->futhark_mc_segmap_parloop_236575_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236575_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236575_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236575_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236587 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_236587_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236587_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236587_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236587_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236587_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236587_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236587_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236587_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236587_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236587_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236587_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236587_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236587_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_236587_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236587_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236587_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236587_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236587_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236587_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236587_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236587_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236587_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236587_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236587_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236587_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236587_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236587_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236580            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236580_runs[i],
                    (long) ctx->futhark_mc_segred_task_236580_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236580_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236580_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236580_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236580_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236580_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236580_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236580_iter[i],
                    (long) ctx->futhark_mc_segred_task_236580_iter[i] /
                    (ctx->futhark_mc_segred_task_236580_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236580_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236593 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_236593_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236593_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236593_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236593_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236593_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236593_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236593_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236593_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236593_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236593_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236593_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236593_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236593_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_236593_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236593_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236593_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236593_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236593_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236593_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236593_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236593_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236593_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236593_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236593_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236593_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236593_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236593_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236589            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236589_runs[i],
                    (long) ctx->futhark_mc_segred_task_236589_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236589_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236589_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236589_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236589_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236589_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236589_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236589_iter[i],
                    (long) ctx->futhark_mc_segred_task_236589_iter[i] /
                    (ctx->futhark_mc_segred_task_236589_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236589_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236578         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236578_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236578_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236578_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236578_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236578_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236578_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236578_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236578_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236578_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236578_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236578_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236578_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236578_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236578_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236578_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236578_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236578_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236578_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236578_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236578_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236578_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236578_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236578_total_iter /
                (ctx->futhark_mc_segmap_parloop_236578_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236578_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236578_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236578_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236573            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236573_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236573_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236573_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236573_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236573_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236573_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236573_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236573_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236573_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236573_iter[i] /
                    (ctx->futhark_mc_segmap_task_236573_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236573_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236576     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236576_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236576_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236576_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236576_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236576_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236576_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236576_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236576_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236576_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236576_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236576_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236576_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236558         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236558_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236558_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236558_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236558_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236558_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236558_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236558_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236558_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236558_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236558_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236558_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236558_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236558_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236558_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236558_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236558_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236558_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236558_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236558_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236558_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236558_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236558_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236558_total_iter /
                (ctx->futhark_mc_segmap_parloop_236558_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236558_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236558_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236558_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236548            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236548_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236548_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236548_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236548_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236548_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236548_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236548_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236548_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236548_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236548_iter[i] /
                    (ctx->futhark_mc_segmap_task_236548_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236548_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236556     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236556_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236556_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236556_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236556_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236556_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236556_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236556_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236556_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236556_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236556_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236556_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236556_runs[i] : 1));
        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_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_236611            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236611_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236611_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236611_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236611_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236611_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236611_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236611_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236611_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236611_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236611_iter[i] /
                    (ctx->futhark_mc_segmap_task_236611_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236611_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236617         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236617_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236617_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236617_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236617_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236617_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236617_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236617_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236617_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236617_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236617_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236617_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236617_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236617_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236617_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236617_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236617_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236617_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236617_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236617_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236617_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236617_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236617_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236617_total_iter /
                (ctx->futhark_mc_segmap_parloop_236617_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236617_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236617_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236617_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236615            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236615_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236615_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236615_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236615_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236615_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236615_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236615_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236615_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236615_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236615_iter[i] /
                    (ctx->futhark_mc_segmap_task_236615_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236615_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236621         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236621_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236621_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236621_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236621_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236621_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236621_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236621_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236621_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236621_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236621_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236621_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236621_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236621_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236621_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236621_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236621_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236621_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236621_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236621_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236621_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236621_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236621_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236621_total_iter /
                (ctx->futhark_mc_segmap_parloop_236621_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236621_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236621_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236621_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236631 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_236631_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236631_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236631_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236631_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236631_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236631_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236631_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236631_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236631_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236631_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236631_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236631_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236631_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_236631_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236631_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236631_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236631_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236631_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236631_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236631_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236631_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236631_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236631_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236631_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236631_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236631_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236631_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236628            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236628_runs[i],
                    (long) ctx->futhark_mc_segred_task_236628_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236628_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236628_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236628_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236628_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236628_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236628_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236628_iter[i],
                    (long) ctx->futhark_mc_segred_task_236628_iter[i] /
                    (ctx->futhark_mc_segred_task_236628_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236628_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236636 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_236636_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236636_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236636_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236636_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236636_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236636_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236636_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236636_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236636_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236636_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236636_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236636_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236636_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_236636_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236636_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236636_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236636_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236636_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236636_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236636_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236636_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236636_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236636_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236636_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236636_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236636_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236636_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236633            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236633_runs[i],
                    (long) ctx->futhark_mc_segred_task_236633_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236633_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236633_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236633_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236633_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236633_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236633_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236633_iter[i],
                    (long) ctx->futhark_mc_segred_task_236633_iter[i] /
                    (ctx->futhark_mc_segred_task_236633_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236633_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236625         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236625_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236625_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236625_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236625_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236625_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236625_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236625_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236625_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236625_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236625_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236625_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236625_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236625_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236625_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236625_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236625_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236625_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236625_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236625_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236625_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236625_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236625_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236625_total_iter /
                (ctx->futhark_mc_segmap_parloop_236625_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236625_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236625_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236625_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236619            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236619_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236619_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236619_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236619_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236619_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236619_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236619_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236619_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236619_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236619_iter[i] /
                    (ctx->futhark_mc_segmap_task_236619_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236619_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236623     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236623_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236623_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236623_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236623_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236623_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236623_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236623_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236623_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236623_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236623_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236623_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236623_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_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_nested_task_236603     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236603_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236603_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236603_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236603_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236603_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236603_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236603_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236603_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236603_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236603_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236603_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236603_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236640         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236640_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236640_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236640_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236640_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236640_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236640_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236640_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236640_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236640_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236640_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236640_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236640_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236640_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236640_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236640_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236640_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236640_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236640_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236640_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236640_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236640_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236640_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236640_total_iter /
                (ctx->futhark_mc_segmap_parloop_236640_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236640_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236640_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236640_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236659         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236659_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236659_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236659_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236659_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236659_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236659_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236659_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236659_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236659_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236659_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236659_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236659_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236659_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236659_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236659_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236659_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236659_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236659_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236659_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236659_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236659_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236659_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236659_total_iter /
                (ctx->futhark_mc_segmap_parloop_236659_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236659_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236659_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236659_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236657            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236657_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236657_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236657_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236657_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236657_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236657_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236657_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236657_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236657_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236657_iter[i] /
                    (ctx->futhark_mc_segmap_task_236657_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236657_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236663         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236663_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236663_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236663_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236663_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236663_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236663_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236663_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236663_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236663_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236663_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236663_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236663_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236663_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236663_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236663_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236663_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236663_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236663_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236663_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236663_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236663_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236663_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236663_total_iter /
                (ctx->futhark_mc_segmap_parloop_236663_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236663_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236663_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236663_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236661            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236661_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236661_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236661_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236661_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236661_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236661_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236661_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236661_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236661_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236661_iter[i] /
                    (ctx->futhark_mc_segmap_task_236661_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236661_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236667         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236667_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236667_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236667_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236667_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236667_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236667_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236667_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236667_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236667_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236667_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236667_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236667_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236667_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236667_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236667_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236667_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236667_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236667_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236667_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236667_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236667_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236667_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236667_total_iter /
                (ctx->futhark_mc_segmap_parloop_236667_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236667_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236667_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236667_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236681 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_236681_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236681_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236681_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236681_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236681_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236681_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236681_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236681_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236681_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236681_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236681_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236681_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236681_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_236681_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236681_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236681_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236681_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236681_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236681_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236681_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236681_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236681_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236681_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236681_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236681_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236681_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236681_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236676            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236676_runs[i],
                    (long) ctx->futhark_mc_segred_task_236676_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236676_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236676_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236676_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236676_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236676_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236676_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236676_iter[i],
                    (long) ctx->futhark_mc_segred_task_236676_iter[i] /
                    (ctx->futhark_mc_segred_task_236676_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236676_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236687 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_236687_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236687_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236687_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236687_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236687_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236687_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236687_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236687_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236687_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236687_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236687_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236687_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236687_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_236687_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236687_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236687_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236687_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236687_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236687_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236687_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236687_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236687_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236687_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236687_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236687_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236687_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236687_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236683            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236683_runs[i],
                    (long) ctx->futhark_mc_segred_task_236683_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236683_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236683_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236683_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236683_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236683_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236683_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236683_iter[i],
                    (long) ctx->futhark_mc_segred_task_236683_iter[i] /
                    (ctx->futhark_mc_segred_task_236683_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236683_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236672         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236672_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236672_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236672_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236672_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236672_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236672_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236672_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236672_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236672_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236672_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236672_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236672_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236672_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236672_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236672_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236672_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236672_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236672_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236672_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236672_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236672_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236672_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236672_total_iter /
                (ctx->futhark_mc_segmap_parloop_236672_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236672_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236672_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236672_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236665            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236665_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236665_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236665_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236665_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236665_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236665_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236665_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236665_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236665_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236665_iter[i] /
                    (ctx->futhark_mc_segmap_task_236665_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236665_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236670     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236670_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236670_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236670_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236670_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236670_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236670_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236670_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236670_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236670_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236670_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236670_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236670_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236650         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236650_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236650_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236650_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236650_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236650_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236650_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236650_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236650_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236650_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236650_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236650_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236650_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236650_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236650_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236650_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236650_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236650_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236650_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236650_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236650_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236650_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236650_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236650_total_iter /
                (ctx->futhark_mc_segmap_parloop_236650_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236650_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236650_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236650_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236638            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236638_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236638_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236638_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236638_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236638_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236638_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236638_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236638_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236638_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236638_iter[i] /
                    (ctx->futhark_mc_segmap_task_236638_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236638_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236648     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236648_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236648_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236648_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236648_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236648_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236648_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236648_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236648_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236648_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236648_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236648_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236648_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236691         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236691_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236691_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236691_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236691_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236691_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236691_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236691_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236691_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236691_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236691_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236691_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236691_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236691_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236691_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236691_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236691_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236691_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236691_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236691_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236691_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236691_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236691_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236691_total_iter /
                (ctx->futhark_mc_segmap_parloop_236691_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236691_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236691_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236691_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236712         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236712_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236712_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236712_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236712_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236712_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236712_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236712_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236712_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236712_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236712_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236712_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236712_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236712_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236712_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236712_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236712_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236712_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236712_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236712_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236712_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236712_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236712_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236712_total_iter /
                (ctx->futhark_mc_segmap_parloop_236712_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236712_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236712_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236712_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236710            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236710_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236710_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236710_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236710_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236710_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236710_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236710_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236710_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236710_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236710_iter[i] /
                    (ctx->futhark_mc_segmap_task_236710_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236710_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236716         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236716_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236716_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236716_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236716_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236716_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236716_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236716_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236716_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236716_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236716_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236716_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236716_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236716_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236716_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236716_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236716_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236716_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236716_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236716_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236716_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236716_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236716_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236716_total_iter /
                (ctx->futhark_mc_segmap_parloop_236716_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236716_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236716_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236716_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236714            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236714_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236714_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236714_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236714_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236714_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236714_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236714_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236714_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236714_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236714_iter[i] /
                    (ctx->futhark_mc_segmap_task_236714_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236714_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236720         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236720_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236720_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236720_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236720_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236720_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236720_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236720_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236720_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236720_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236720_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236720_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236720_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236720_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236720_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236720_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236720_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236720_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236720_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236720_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236720_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236720_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236720_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236720_total_iter /
                (ctx->futhark_mc_segmap_parloop_236720_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236720_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236720_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236720_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236735         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236735_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236735_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236735_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236735_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236735_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236735_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236735_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236735_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236735_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236735_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236735_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236735_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236735_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236735_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236735_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236735_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236735_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236735_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236735_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236735_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236735_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236735_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236735_total_iter /
                (ctx->futhark_mc_segmap_parloop_236735_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236735_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236735_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236735_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236733            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236733_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236733_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236733_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236733_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236733_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236733_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236733_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236733_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236733_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236733_iter[i] /
                    (ctx->futhark_mc_segmap_task_236733_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236733_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236744 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_236744_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236744_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236744_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236744_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236744_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236744_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236744_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236744_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236744_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236744_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236744_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236744_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236744_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_236744_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236744_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236744_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236744_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236744_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236744_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236744_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236744_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236744_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236744_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236744_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236744_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236744_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236744_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236737            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236737_runs[i],
                    (long) ctx->futhark_mc_segred_task_236737_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236737_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236737_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236737_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236737_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236737_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236737_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236737_iter[i],
                    (long) ctx->futhark_mc_segred_task_236737_iter[i] /
                    (ctx->futhark_mc_segred_task_236737_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236737_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236750 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_236750_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236750_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236750_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236750_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236750_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236750_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236750_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236750_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236750_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236750_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236750_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236750_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236750_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_236750_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236750_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236750_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236750_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236750_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236750_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236750_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236750_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236750_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236750_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236750_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236750_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236750_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236750_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236746            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236746_runs[i],
                    (long) ctx->futhark_mc_segred_task_236746_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236746_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236746_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236746_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236746_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236746_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236746_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236746_iter[i],
                    (long) ctx->futhark_mc_segred_task_236746_iter[i] /
                    (ctx->futhark_mc_segred_task_236746_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236746_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236727         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236727_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236727_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236727_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236727_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236727_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236727_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236727_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236727_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236727_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236727_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236727_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236727_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236727_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236727_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236727_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236727_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236727_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236727_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236727_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236727_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236727_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236727_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236727_total_iter /
                (ctx->futhark_mc_segmap_parloop_236727_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236727_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236727_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236727_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236718            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236718_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236718_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236718_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236718_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236718_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236718_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236718_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236718_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236718_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236718_iter[i] /
                    (ctx->futhark_mc_segmap_task_236718_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236718_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236725     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236725_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236725_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236725_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236725_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236725_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236725_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236725_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236725_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236725_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236725_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236725_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236725_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236703         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236703_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236703_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236703_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236703_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236703_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236703_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236703_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236703_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236703_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236703_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236703_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236703_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236703_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236703_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236703_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236703_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236703_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236703_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236703_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236703_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236703_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236703_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236703_total_iter /
                (ctx->futhark_mc_segmap_parloop_236703_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236703_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236703_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236703_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236689            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236689_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236689_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236689_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236689_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236689_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236689_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236689_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236689_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236689_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236689_iter[i] /
                    (ctx->futhark_mc_segmap_task_236689_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236689_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236701     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236701_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236701_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236701_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236701_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236701_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236701_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236701_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236701_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236701_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236701_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236701_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236701_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236754         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236754_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236754_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236754_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236754_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236754_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236754_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236754_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236754_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236754_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236754_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236754_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236754_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236754_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236754_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236754_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236754_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236754_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236754_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236754_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236754_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236754_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236754_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236754_total_iter /
                (ctx->futhark_mc_segmap_parloop_236754_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236754_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236754_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236754_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236763         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236763_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236763_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236763_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236763_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236763_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236763_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236763_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236763_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236763_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236763_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236763_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236763_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236763_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236763_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236763_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236763_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236763_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236763_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236763_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236763_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236763_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236763_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236763_total_iter /
                (ctx->futhark_mc_segmap_parloop_236763_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236763_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236763_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236763_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236761            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236761_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236761_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236761_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236761_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236761_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236761_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236761_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236761_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236761_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236761_iter[i] /
                    (ctx->futhark_mc_segmap_task_236761_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236761_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236758         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236758_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236758_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236758_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236758_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236758_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236758_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236758_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236758_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236758_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236758_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236758_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236758_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236758_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236758_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236758_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236758_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236758_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236758_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236758_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236758_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236758_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236758_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236758_total_iter /
                (ctx->futhark_mc_segmap_parloop_236758_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236758_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236758_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236758_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236752            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236752_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236752_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236752_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236752_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236752_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236752_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236752_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236752_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236752_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236752_iter[i] /
                    (ctx->futhark_mc_segmap_task_236752_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236752_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236756     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236756_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236756_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236756_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236756_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236756_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236756_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236756_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236756_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236756_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236756_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236756_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236756_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236767         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236767_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236767_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236767_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236767_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236767_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236767_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236767_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236767_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236767_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236767_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236767_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236767_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236767_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236767_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236767_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236767_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236767_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236767_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236767_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236767_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236767_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236767_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236767_total_iter /
                (ctx->futhark_mc_segmap_parloop_236767_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236767_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236767_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236767_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236778         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236778_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236778_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236778_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236778_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236778_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236778_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236778_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236778_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236778_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236778_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236778_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236778_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236778_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236778_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236778_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236778_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236778_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236778_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236778_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236778_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236778_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236778_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236778_total_iter /
                (ctx->futhark_mc_segmap_parloop_236778_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236778_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236778_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236778_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236776            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236776_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236776_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236776_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236776_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236776_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236776_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236776_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236776_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236776_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236776_iter[i] /
                    (ctx->futhark_mc_segmap_task_236776_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236776_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236782         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236782_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236782_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236782_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236782_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236782_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236782_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236782_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236782_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236782_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236782_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236782_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236782_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236782_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236782_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236782_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236782_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236782_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236782_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236782_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236782_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236782_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236782_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236782_total_iter /
                (ctx->futhark_mc_segmap_parloop_236782_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236782_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236782_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236782_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236780            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236780_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236780_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236780_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236780_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236780_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236780_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236780_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236780_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236780_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236780_iter[i] /
                    (ctx->futhark_mc_segmap_task_236780_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236780_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236772         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236772_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236772_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236772_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236772_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236772_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236772_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236772_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236772_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236772_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236772_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236772_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236772_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236772_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236772_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236772_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236772_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236772_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236772_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236772_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236772_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236772_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236772_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236772_total_iter /
                (ctx->futhark_mc_segmap_parloop_236772_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236772_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236772_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236772_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236765            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236765_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236765_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236765_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236765_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236765_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236765_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236765_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236765_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236765_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236765_iter[i] /
                    (ctx->futhark_mc_segmap_task_236765_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236765_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236770     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236770_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236770_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236770_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236770_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236770_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236770_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236770_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236770_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236770_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236770_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236770_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236770_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236786         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236786_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236786_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236786_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236786_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236786_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236786_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236786_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236786_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236786_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236786_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236786_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236786_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236786_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236786_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236786_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236786_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236786_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236786_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236786_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236786_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236786_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236786_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236786_total_iter /
                (ctx->futhark_mc_segmap_parloop_236786_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236786_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236786_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236786_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_236807   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_236807_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236807_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236807_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236807_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236807_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_236807_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236807_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236807_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236807_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_236807_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_236807_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_236807_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_236807_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_236807_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236807_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236807_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236807_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236807_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_236807_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_236807_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_236807_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_236807_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_236807_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_236807_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_236807_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_236807_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_236807_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_236809   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_236809_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236809_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236809_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236809_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236809_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_236809_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236809_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236809_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236809_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_236809_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_236809_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_236809_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_236809_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_236809_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236809_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236809_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236809_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236809_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_236809_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_236809_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_236809_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_236809_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_236809_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_236809_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_236809_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_236809_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_236809_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_236801           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_236801_runs[i],
                    (long) ctx->futhark_mc_segscan_task_236801_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236801_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236801_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_236801_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_236801_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_236801_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_236801_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_236801_iter[i],
                    (long) ctx->futhark_mc_segscan_task_236801_iter[i] /
                    (ctx->futhark_mc_segscan_task_236801_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_236801_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236813         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236813_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236813_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236813_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236813_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236813_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236813_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236813_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236813_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236813_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236813_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236813_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236813_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236813_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236813_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236813_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236813_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236813_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236813_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236813_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236813_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236813_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236813_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236813_total_iter /
                (ctx->futhark_mc_segmap_parloop_236813_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236813_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236813_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236813_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236811            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236811_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236811_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236811_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236811_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236811_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236811_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236811_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236811_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236811_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236811_iter[i] /
                    (ctx->futhark_mc_segmap_task_236811_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236811_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236794         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236794_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236794_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236794_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236794_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236794_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236794_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236794_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236794_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236794_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236794_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236794_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236794_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236794_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236794_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236794_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236794_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236794_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236794_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236794_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236794_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236794_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236794_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236794_total_iter /
                (ctx->futhark_mc_segmap_parloop_236794_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236794_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236794_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236794_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236784            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236784_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236784_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236784_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236784_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236784_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236784_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236784_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236784_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236784_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236784_iter[i] /
                    (ctx->futhark_mc_segmap_task_236784_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236784_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236792     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236792_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236792_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236792_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236792_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236792_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236792_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236792_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236792_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236792_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236792_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236792_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236792_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236817         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236817_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236817_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236817_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236817_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236817_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236817_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236817_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236817_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236817_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236817_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236817_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236817_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236817_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236817_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236817_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236817_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236817_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236817_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236817_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236817_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236817_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236817_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236817_total_iter /
                (ctx->futhark_mc_segmap_parloop_236817_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236817_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236817_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236817_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_236825 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_236825_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236825_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236825_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236825_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236825_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_236825_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236825_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236825_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236825_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_236825_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_236825_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_236825_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_236825_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_236825_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236825_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236825_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236825_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236825_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_236825_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_236825_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_236825_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_236825_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_236825_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_236825_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_236825_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_236825_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_236825_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_236822            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_236822_runs[i],
                    (long) ctx->futhark_mc_segred_task_236822_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236822_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236822_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_236822_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_236822_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_236822_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_236822_iter[i]),
                    (long) ctx->futhark_mc_segred_task_236822_iter[i],
                    (long) ctx->futhark_mc_segred_task_236822_iter[i] /
                    (ctx->futhark_mc_segred_task_236822_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_236822_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236820         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236820_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236820_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236820_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236820_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236820_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236820_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236820_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236820_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236820_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236820_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236820_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236820_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236820_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236820_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236820_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236820_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236820_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236820_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236820_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236820_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236820_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236820_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236820_total_iter /
                (ctx->futhark_mc_segmap_parloop_236820_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236820_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236820_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236820_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236815            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236815_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236815_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236815_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236815_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236815_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236815_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236815_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236815_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236815_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236815_iter[i] /
                    (ctx->futhark_mc_segmap_task_236815_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236815_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236818     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236818_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236818_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236818_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236818_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236818_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236818_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236818_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236818_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236818_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236818_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236818_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236818_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236829         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236829_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236829_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236829_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236829_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236829_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236829_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236829_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236829_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236829_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236829_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236829_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236829_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236829_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236829_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236829_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236829_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236829_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236829_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236829_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236829_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236829_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236829_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236829_total_iter /
                (ctx->futhark_mc_segmap_parloop_236829_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236829_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236829_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236829_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236838         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236838_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236838_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236838_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236838_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236838_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236838_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236838_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236838_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236838_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236838_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236838_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236838_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236838_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236838_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236838_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236838_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236838_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236838_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236838_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236838_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236838_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236838_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236838_total_iter /
                (ctx->futhark_mc_segmap_parloop_236838_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236838_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236838_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236838_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236836            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236836_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236836_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236836_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236836_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236836_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236836_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236836_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236836_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236836_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236836_iter[i] /
                    (ctx->futhark_mc_segmap_task_236836_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236836_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236833         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236833_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236833_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236833_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236833_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236833_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236833_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236833_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236833_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236833_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236833_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236833_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236833_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236833_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236833_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236833_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236833_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236833_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236833_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236833_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236833_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236833_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236833_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236833_total_iter /
                (ctx->futhark_mc_segmap_parloop_236833_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236833_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236833_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236833_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236827            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236827_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236827_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236827_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236827_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236827_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236827_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236827_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236827_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236827_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236827_iter[i] /
                    (ctx->futhark_mc_segmap_task_236827_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236827_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_236831     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_236831_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236831_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236831_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236831_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_236831_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_236831_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_236831_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_236831_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_236831_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_236831_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_236831_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_236831_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236847         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236847_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236847_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236847_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236847_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236847_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236847_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236847_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236847_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236847_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236847_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236847_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236847_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236847_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236847_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236847_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236847_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236847_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236847_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236847_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236847_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236847_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236847_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236847_total_iter /
                (ctx->futhark_mc_segmap_parloop_236847_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236847_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236847_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236847_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236845            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236845_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236845_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236845_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236845_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236845_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236845_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236845_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236845_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236845_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236845_iter[i] /
                    (ctx->futhark_mc_segmap_task_236845_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236845_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_236842         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_236842_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_236842_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236842_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236842_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_236842_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_236842_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_236842_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236842_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_236842_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_236842_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_236842_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_236842_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_236842_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_236842_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_236842_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236842_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236842_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_236842_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_236842_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_236842_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_236842_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_236842_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_236842_total_iter /
                (ctx->futhark_mc_segmap_parloop_236842_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_236842_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_236842_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_236842_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_236840            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_236840_runs[i],
                    (long) ctx->futhark_mc_segmap_task_236840_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236840_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236840_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_236840_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_236840_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_236840_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_236840_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_236840_iter[i],
                    (long) ctx->futhark_mc_segmap_task_236840_iter[i] /
                    (ctx->futhark_mc_segmap_task_236840_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_236840_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_235539,
                             struct memblock *mem_out_p_235540,
                             struct memblock *mem_out_p_235541,
                             struct memblock Y_mem_217387, int64_t m_203571,
                             int64_t n_203572, int64_t n_p_203574,
                             int64_t q_s_203575, int64_t q_t_203576,
                             int64_t q_l_203577, int64_t d_s_203578,
                             int64_t d_t_203579, int64_t d_l_203580,
                             int64_t jump_s_203581, int64_t jump_t_203582,
                             int64_t jump_l_203583, int64_t n_inner_203584,
                             int64_t n_outer_203585,
                             int64_t jump_threshold_203586,
                             int64_t q_threshold_203587);

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_235574 {
    struct futhark_context *ctx;
    int64_t free_m_203571;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    unsigned char *free_mem_217406;
    unsigned char *free_mem_217409;
    unsigned char *free_mem_217411;
};
struct futhark_mc_scan_stage_1_parloop_struct_235577 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    unsigned char *free_mem_217406;
    unsigned char *free_mem_217409;
    unsigned char *free_mem_217411;
};
struct futhark_mc_task_235579 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    bool *retval_defunc_2_reduce_res_203634;
};
struct futhark_mc_segred_stage_1_parloop_struct_235582 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221154;
};
static int futhark_mc_segred_stage_1_parloop_235583(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206952,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235582
    *futhark_mc_segred_stage_1_parloop_struct_235582 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235582 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235582->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235583_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235583_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_235582->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235582->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_segred_stage_1_parloop_struct_235582->free_defunc_0_f_res_203592;
    int64_t gtid_206951 =
            futhark_mc_segred_stage_1_parloop_struct_235582->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235582->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 =
            futhark_mc_segred_stage_1_parloop_struct_235582->free_bytes_217388;
    struct memblock reduce_stage_1_tid_res_arr_mem_221154 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221154",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235582->free_reduce_stage_1_tid_res_arr_mem_221154,
                                                             .size =0,
                                                             .references =NULL};
    size_t mem_217391_cached_sizze_235584 = 0;
    unsigned char *mem_217391 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221156 = start;
    
    if (mem_217391_cached_sizze_235584 < (size_t) bytes_217388) {
        mem_217391 = realloc(mem_217391, bytes_217388);
        mem_217391_cached_sizze_235584 = bytes_217388;
    }
    
    bool x_203635;
    bool x_203636;
    bool local_acc_221157 = 0;
    
    for (; iter_221156 < end; iter_221156++) {
        int64_t gtid_206953 = iter_221156;
        
        for (int64_t i_216123 = 0; i_216123 < defunc_0_f_res_203592;
             i_216123++) {
            int64_t x_203641 = mul64(n_p_203574, i_216123);
            int64_t idx_203642 = add64(x_203641, gtid_206953);
            bool cond_203643 = sle64(n_203572, idx_203642);
            bool defunc_0_f_res_203644;
            
            if (cond_203643) {
                defunc_0_f_res_203644 = 1;
            } else {
                bool x_203645 = sle64((int64_t) 0, idx_203642);
                bool y_203646 = slt64(idx_203642, n_203572);
                bool bounds_check_203647 = x_203645 && y_203646;
                bool index_certs_203648;
                
                if (!bounds_check_203647) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) idx_203642,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #0  stl.fut:406:66-71\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_203649;
                
                isnan_arg_203649 = ((double *) Y_mem_217387.mem)[gtid_206951 *
                                                                 n_203572 +
                                                                 idx_203642];
                
                bool isnan_res_203650;
                
                isnan_res_203650 = futrts_isnan64(isnan_arg_203649);
                defunc_0_f_res_203644 = isnan_res_203650;
            }
            ((bool *) mem_217391)[i_216123] = defunc_0_f_res_203644;
        }
        // Trace: trace
        {
            fprintf(ctx->log, "%s", "trace: ");
            for (int64_t nest_i_221159 = 0; nest_i_221159 <
                 defunc_0_f_res_203592; nest_i_221159++) {
                bool arr_elem_221160;
                
                arr_elem_221160 = ((bool *) mem_217391)[nest_i_221159];
                fprintf(ctx->log, "%s%s", arr_elem_221160 ? "true" : "false",
                        " ");
            }
            fprintf(ctx->log, "%s", "\n");
        }
        
        bool defunc_2_reduce_res_203652;
        bool redout_216125 = 1;
        
        for (int64_t i_216126 = 0; i_216126 < defunc_0_f_res_203592;
             i_216126++) {
            bool x_203656;
            
            x_203656 = ((bool *) mem_217391)[i_216126];
            
            bool x_203655 = x_203656 && redout_216125;
            bool redout_tmp_221161 = x_203655;
            
            redout_216125 = redout_tmp_221161;
        }
        defunc_2_reduce_res_203652 = redout_216125;
        // save map-out results
        { }
        // Load accum params
        {
            x_203635 = local_acc_221157;
        }
        // Load next params
        {
            x_203636 = defunc_2_reduce_res_203652;
        }
        // Red body
        {
            bool defunc_1_op_res_203637 = x_203635 || x_203636;
            
            local_acc_221157 = defunc_1_op_res_203637;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221154.mem)[flat_tid_206952] =
        local_acc_221157;
    
  cleanup:
    { }
    free(mem_217391);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235583_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235583_end -
                 futhark_mc_segred_stage_1_parloop_235583_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235583_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235583_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235583_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235580(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206952 = tid;
    int num_tasks_221153 = info.nsubtasks;
    struct futhark_mc_task_235579 *futhark_mc_task_235579 =
                                  (struct futhark_mc_task_235579 *) args;
    struct futhark_context *ctx = futhark_mc_task_235579->ctx;
    uint64_t futhark_mc_segred_task_235580_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235580_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235579->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235579->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235579->free_defunc_0_f_res_203592;
    int64_t gtid_206951 = futhark_mc_task_235579->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235579->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 = futhark_mc_task_235579->free_bytes_217388;
    bool defunc_2_reduce_res_203634 =
         *futhark_mc_task_235579->retval_defunc_2_reduce_res_203634;
    size_t reduce_stage_1_tid_res_arr_mem_221154_cached_sizze_235581 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221154 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221154_cached_sizze_235581 <
        (size_t) num_tasks_221153) {
        reduce_stage_1_tid_res_arr_mem_221154 =
            realloc(reduce_stage_1_tid_res_arr_mem_221154, num_tasks_221153);
        reduce_stage_1_tid_res_arr_mem_221154_cached_sizze_235581 =
            num_tasks_221153;
    }
    
    int64_t iter_221156;
    struct futhark_mc_segred_stage_1_parloop_struct_235582
    futhark_mc_segred_stage_1_parloop_struct_235582;
    
    futhark_mc_segred_stage_1_parloop_struct_235582.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235582.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_235582.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235582.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_segred_stage_1_parloop_struct_235582.free_gtid_206951 =
        gtid_206951;
    futhark_mc_segred_stage_1_parloop_struct_235582.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segred_stage_1_parloop_struct_235582.free_bytes_217388 =
        bytes_217388;
    futhark_mc_segred_stage_1_parloop_struct_235582.free_reduce_stage_1_tid_res_arr_mem_221154 =
        reduce_stage_1_tid_res_arr_mem_221154;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235583_task;
    
    futhark_mc_segred_stage_1_parloop_235583_task.name =
        "futhark_mc_segred_stage_1_parloop_235583";
    futhark_mc_segred_stage_1_parloop_235583_task.fn =
        futhark_mc_segred_stage_1_parloop_235583;
    futhark_mc_segred_stage_1_parloop_235583_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235582;
    futhark_mc_segred_stage_1_parloop_235583_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235583_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235583_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235583_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235583_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235583_task);
    
    if (futhark_mc_segred_stage_1_parloop_235583_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235583_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235583_total_end -
                 futhark_mc_segred_stage_1_parloop_235583_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235583_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235583_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235583_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203634 = 0;
    }
    
    bool x_221162;
    bool x_221163;
    
    for (int32_t i_221165 = 0; i_221165 < num_tasks_221153; i_221165++) {
        flat_tid_206952 = i_221165;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221162 = defunc_2_reduce_res_203634;
            }
            // load next params
            {
                x_221163 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221154)[flat_tid_206952];
            }
            // red body
            {
                bool defunc_1_op_res_221164 = x_221162 || x_221163;
                
                defunc_2_reduce_res_203634 = defunc_1_op_res_221164;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221154);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235580_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235580_end -
                 futhark_mc_segred_task_235580_start;
        
        ctx->futhark_mc_segred_task_235580_runs[tid]++;
        ctx->futhark_mc_segred_task_235580_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235580_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235579->retval_defunc_2_reduce_res_203634 =
            defunc_2_reduce_res_203634;
    }
    return err;
}
struct futhark_mc_segred_stage_1_parloop_struct_235587 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221166;
};
struct futhark_mc_task_235590 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    int64_t free_gtid_206961;
    unsigned char *free_Y_mem_217387;
    unsigned char *free_mem_217389;
};
struct futhark_mc_segmap_parloop_struct_235592 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    int64_t free_gtid_206961;
    unsigned char *free_Y_mem_217387;
    unsigned char *free_mem_217389;
};
static int futhark_mc_segmap_parloop_235593(void *args, int64_t start,
                                            int64_t end, int flat_tid_206967,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235592
    *futhark_mc_segmap_parloop_struct_235592 =
    (struct futhark_mc_segmap_parloop_struct_235592 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235592->ctx;
    uint64_t futhark_mc_segmap_parloop_235593_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235593_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235592->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235592->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_segmap_parloop_struct_235592->free_defunc_0_f_res_203592;
    int64_t gtid_206951 =
            futhark_mc_segmap_parloop_struct_235592->free_gtid_206951;
    int64_t gtid_206961 =
            futhark_mc_segmap_parloop_struct_235592->free_gtid_206961;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segmap_parloop_struct_235592->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_segmap_parloop_struct_235592->free_mem_217389,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221171 = start;
    
    for (; iter_221171 < end; iter_221171++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221178 = defunc_0_f_res_203592;
        int64_t gtid_206968 = iter_221171;
        int64_t remnant_221179 = iter_221171 - gtid_206968;
        int64_t x_206970 = mul64(n_p_203574, gtid_206968);
        int64_t idx_206971 = add64(gtid_206961, x_206970);
        bool cond_206972 = sle64(n_203572, idx_206971);
        bool defunc_0_f_res_206973;
        
        if (cond_206972) {
            defunc_0_f_res_206973 = 1;
        } else {
            bool x_221172 = sle64((int64_t) 0, idx_206971);
            bool y_221173 = slt64(idx_206971, n_203572);
            bool bounds_check_221174 = x_221172 && y_221173;
            bool index_certs_221175;
            
            if (!bounds_check_221174) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) idx_206971,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #0  stl.fut:406:66-71\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_221176;
            
            isnan_arg_221176 = ((double *) Y_mem_217387.mem)[gtid_206951 *
                                                             n_203572 +
                                                             idx_206971];
            
            bool isnan_res_221177;
            
            isnan_res_221177 = futrts_isnan64(isnan_arg_221176);
            defunc_0_f_res_206973 = isnan_res_221177;
        }
        ((bool *) mem_217389.mem)[gtid_206968] = defunc_0_f_res_206973;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235593_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235593_end -
                 futhark_mc_segmap_parloop_235593_start;
        
        ctx->futhark_mc_segmap_parloop_235593_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235593_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235593_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235591(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206967 = tid;
    int num_tasks_221170 = info.nsubtasks;
    struct futhark_mc_task_235590 *futhark_mc_task_235590 =
                                  (struct futhark_mc_task_235590 *) args;
    struct futhark_context *ctx = futhark_mc_task_235590->ctx;
    uint64_t futhark_mc_segmap_task_235591_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235591_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235590->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235590->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235590->free_defunc_0_f_res_203592;
    int64_t gtid_206951 = futhark_mc_task_235590->free_gtid_206951;
    int64_t gtid_206961 = futhark_mc_task_235590->free_gtid_206961;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235590->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_task_235590->free_mem_217389,
                                  .size =0, .references =NULL};
    int64_t iter_221171;
    struct futhark_mc_segmap_parloop_struct_235592
    futhark_mc_segmap_parloop_struct_235592;
    
    futhark_mc_segmap_parloop_struct_235592.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235592.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235592.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235592.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_segmap_parloop_struct_235592.free_gtid_206951 = gtid_206951;
    futhark_mc_segmap_parloop_struct_235592.free_gtid_206961 = gtid_206961;
    futhark_mc_segmap_parloop_struct_235592.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segmap_parloop_struct_235592.free_mem_217389 = mem_217389.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235593_task;
    
    futhark_mc_segmap_parloop_235593_task.name =
        "futhark_mc_segmap_parloop_235593";
    futhark_mc_segmap_parloop_235593_task.fn = futhark_mc_segmap_parloop_235593;
    futhark_mc_segmap_parloop_235593_task.args =
        &futhark_mc_segmap_parloop_struct_235592;
    futhark_mc_segmap_parloop_235593_task.iterations = iterations;
    futhark_mc_segmap_parloop_235593_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235593_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235593_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235593_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235593_task);
    
    if (futhark_mc_segmap_parloop_235593_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235593_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235593_total_end -
                 futhark_mc_segmap_parloop_235593_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235593_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235593_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235593_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235591_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235591_end -
                 futhark_mc_segmap_task_235591_start;
        
        ctx->futhark_mc_segmap_task_235591_runs[tid]++;
        ctx->futhark_mc_segmap_task_235591_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235591_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235594 {
    struct futhark_context *ctx;
    unsigned char *free_mem_217389;
    bool *retval_defunc_2_reduce_res_206981;
};
struct futhark_mc_segred_stage_1_parloop_struct_235597 {
    struct futhark_context *ctx;
    unsigned char *free_mem_217389;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221183;
};
static int futhark_mc_segred_stage_1_parloop_235598(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206982,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235597
    *futhark_mc_segred_stage_1_parloop_struct_235597 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235597 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235597->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235598_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235598_start = get_wall_time();
    
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235597->free_mem_217389,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221183 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221183",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235597->free_reduce_stage_1_tid_res_arr_mem_221183,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221185 = start;
    bool x_206984;
    bool x_206985;
    bool local_acc_221186 = 1;
    
    for (; iter_221185 < end; iter_221185++) {
        int64_t gtid_206983 = iter_221185;
        bool x_206987;
        
        x_206987 = ((bool *) mem_217389.mem)[gtid_206983];
        // save map-out results
        { }
        // Load accum params
        {
            x_206984 = local_acc_221186;
        }
        // Load next params
        {
            x_206985 = x_206987;
        }
        // Red body
        {
            bool x_206986 = x_206984 && x_206985;
            
            local_acc_221186 = x_206986;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221183.mem)[flat_tid_206982] =
        local_acc_221186;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235598_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235598_end -
                 futhark_mc_segred_stage_1_parloop_235598_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235598_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235598_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235598_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235595(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206982 = tid;
    int num_tasks_221182 = info.nsubtasks;
    struct futhark_mc_task_235594 *futhark_mc_task_235594 =
                                  (struct futhark_mc_task_235594 *) args;
    struct futhark_context *ctx = futhark_mc_task_235594->ctx;
    uint64_t futhark_mc_segred_task_235595_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235595_start = get_wall_time();
    
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_task_235594->free_mem_217389,
                                  .size =0, .references =NULL};
    bool defunc_2_reduce_res_206981 =
         *futhark_mc_task_235594->retval_defunc_2_reduce_res_206981;
    size_t reduce_stage_1_tid_res_arr_mem_221183_cached_sizze_235596 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221183 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221183_cached_sizze_235596 <
        (size_t) num_tasks_221182) {
        reduce_stage_1_tid_res_arr_mem_221183 =
            realloc(reduce_stage_1_tid_res_arr_mem_221183, num_tasks_221182);
        reduce_stage_1_tid_res_arr_mem_221183_cached_sizze_235596 =
            num_tasks_221182;
    }
    
    int64_t iter_221185;
    struct futhark_mc_segred_stage_1_parloop_struct_235597
    futhark_mc_segred_stage_1_parloop_struct_235597;
    
    futhark_mc_segred_stage_1_parloop_struct_235597.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235597.free_mem_217389 =
        mem_217389.mem;
    futhark_mc_segred_stage_1_parloop_struct_235597.free_reduce_stage_1_tid_res_arr_mem_221183 =
        reduce_stage_1_tid_res_arr_mem_221183;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235598_task;
    
    futhark_mc_segred_stage_1_parloop_235598_task.name =
        "futhark_mc_segred_stage_1_parloop_235598";
    futhark_mc_segred_stage_1_parloop_235598_task.fn =
        futhark_mc_segred_stage_1_parloop_235598;
    futhark_mc_segred_stage_1_parloop_235598_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235597;
    futhark_mc_segred_stage_1_parloop_235598_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235598_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235598_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235598_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235598_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235598_task);
    
    if (futhark_mc_segred_stage_1_parloop_235598_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235598_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235598_total_end -
                 futhark_mc_segred_stage_1_parloop_235598_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235598_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235598_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235598_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_206981 = 1;
    }
    
    bool x_221187;
    bool x_221188;
    
    for (int32_t i_221190 = 0; i_221190 < num_tasks_221182; i_221190++) {
        flat_tid_206982 = i_221190;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221187 = defunc_2_reduce_res_206981;
            }
            // load next params
            {
                x_221188 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221183)[flat_tid_206982];
            }
            // red body
            {
                bool x_221189 = x_221187 && x_221188;
                
                defunc_2_reduce_res_206981 = x_221189;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221183);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235595_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235595_end -
                 futhark_mc_segred_task_235595_start;
        
        ctx->futhark_mc_segred_task_235595_runs[tid]++;
        ctx->futhark_mc_segred_task_235595_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235595_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235594->retval_defunc_2_reduce_res_206981 =
            defunc_2_reduce_res_206981;
    }
    return err;
}
static int futhark_mc_segred_stage_1_parloop_235588(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206960,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235587
    *futhark_mc_segred_stage_1_parloop_struct_235587 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235587 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235587->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235588_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235588_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_235587->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235587->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_segred_stage_1_parloop_struct_235587->free_defunc_0_f_res_203592;
    int64_t gtid_206951 =
            futhark_mc_segred_stage_1_parloop_struct_235587->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235587->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 =
            futhark_mc_segred_stage_1_parloop_struct_235587->free_bytes_217388;
    struct memblock reduce_stage_1_tid_res_arr_mem_221166 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221166",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235587->free_reduce_stage_1_tid_res_arr_mem_221166,
                                                             .size =0,
                                                             .references =NULL};
    size_t mem_217389_cached_sizze_235589 = 0;
    unsigned char *mem_217389 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221168 = start;
    
    if (mem_217389_cached_sizze_235589 < (size_t) bytes_217388) {
        mem_217389 = realloc(mem_217389, bytes_217388);
        mem_217389_cached_sizze_235589 = bytes_217388;
    }
    
    bool x_206962;
    bool x_206963;
    bool local_acc_221169 = 0;
    
    for (; iter_221168 < end; iter_221168++) {
        int64_t gtid_206961 = iter_221168;
        int64_t flat_tid_206967 = (int64_t) 0;
        int32_t num_tasks_221170;
        struct futhark_mc_task_235590 futhark_mc_task_235590;
        
        futhark_mc_task_235590.ctx = ctx;
        futhark_mc_task_235590.free_n_203572 = n_203572;
        futhark_mc_task_235590.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235590.free_defunc_0_f_res_203592 =
            defunc_0_f_res_203592;
        futhark_mc_task_235590.free_gtid_206951 = gtid_206951;
        futhark_mc_task_235590.free_gtid_206961 = gtid_206961;
        futhark_mc_task_235590.free_Y_mem_217387 = Y_mem_217387.mem;
        futhark_mc_task_235590.free_mem_217389 = mem_217389;
        
        struct scheduler_segop futhark_mc_task_235590_task;
        
        futhark_mc_task_235590_task.args = &futhark_mc_task_235590;
        futhark_mc_task_235590_task.top_level_fn =
            futhark_mc_segmap_task_235591;
        futhark_mc_task_235590_task.name = "futhark_mc_segmap_task_235591";
        futhark_mc_task_235590_task.iterations = defunc_0_f_res_203592;
        futhark_mc_task_235590_task.task_time =
            &ctx->futhark_mc_segmap_task_235591_total_time;
        futhark_mc_task_235590_task.task_iter =
            &ctx->futhark_mc_segmap_task_235591_total_iter;
        futhark_mc_task_235590_task.sched = STATIC;
        futhark_mc_task_235590_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235591_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235590_task);
        
        if (futhark_mc_segmap_task_235591_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        // Trace: trace
        {
            fprintf(ctx->log, "%s", "trace: ");
            for (int64_t nest_i_221180 = 0; nest_i_221180 <
                 defunc_0_f_res_203592; nest_i_221180++) {
                bool arr_elem_221181;
                
                arr_elem_221181 = ((bool *) mem_217389)[nest_i_221180];
                fprintf(ctx->log, "%s%s", arr_elem_221181 ? "true" : "false",
                        " ");
            }
            fprintf(ctx->log, "%s", "\n");
        }
        
        bool defunc_2_reduce_res_206981;
        int64_t flat_tid_206982 = (int64_t) 0;
        int32_t num_tasks_221182;
        
        defunc_2_reduce_res_206981 = 0;
        
        struct futhark_mc_task_235594 futhark_mc_task_235594;
        
        futhark_mc_task_235594.ctx = ctx;
        futhark_mc_task_235594.free_mem_217389 = mem_217389;
        futhark_mc_task_235594.retval_defunc_2_reduce_res_206981 =
            &defunc_2_reduce_res_206981;
        
        struct scheduler_segop futhark_mc_task_235594_task;
        
        futhark_mc_task_235594_task.args = &futhark_mc_task_235594;
        futhark_mc_task_235594_task.top_level_fn =
            futhark_mc_segred_task_235595;
        futhark_mc_task_235594_task.name = "futhark_mc_segred_task_235595";
        futhark_mc_task_235594_task.iterations = defunc_0_f_res_203592;
        futhark_mc_task_235594_task.task_time =
            &ctx->futhark_mc_segred_task_235595_total_time;
        futhark_mc_task_235594_task.task_iter =
            &ctx->futhark_mc_segred_task_235595_total_iter;
        futhark_mc_task_235594_task.sched = STATIC;
        futhark_mc_task_235594_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235595_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235594_task);
        
        if (futhark_mc_segred_task_235595_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_206962 = local_acc_221169;
        }
        // Load next params
        {
            x_206963 = defunc_2_reduce_res_206981;
        }
        // Red body
        {
            bool defunc_1_op_res_206964 = x_206962 || x_206963;
            
            local_acc_221169 = defunc_1_op_res_206964;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221166.mem)[flat_tid_206960] =
        local_acc_221169;
    
  cleanup:
    { }
    free(mem_217389);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235588_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235588_end -
                 futhark_mc_segred_stage_1_parloop_235588_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235588_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235588_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235588_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_nested_task_235585(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206960 = tid;
    int num_tasks_221153 = info.nsubtasks;
    struct futhark_mc_task_235579 *futhark_mc_task_235579 =
                                  (struct futhark_mc_task_235579 *) args;
    struct futhark_context *ctx = futhark_mc_task_235579->ctx;
    uint64_t futhark_mc_segred_nested_task_235585_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_nested_task_235585_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235579->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235579->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235579->free_defunc_0_f_res_203592;
    int64_t gtid_206951 = futhark_mc_task_235579->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235579->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 = futhark_mc_task_235579->free_bytes_217388;
    bool defunc_2_reduce_res_203634 =
         *futhark_mc_task_235579->retval_defunc_2_reduce_res_203634;
    size_t reduce_stage_1_tid_res_arr_mem_221166_cached_sizze_235586 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221166 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221166_cached_sizze_235586 <
        (size_t) num_tasks_221153) {
        reduce_stage_1_tid_res_arr_mem_221166 =
            realloc(reduce_stage_1_tid_res_arr_mem_221166, num_tasks_221153);
        reduce_stage_1_tid_res_arr_mem_221166_cached_sizze_235586 =
            num_tasks_221153;
    }
    
    int64_t iter_221168;
    struct futhark_mc_segred_stage_1_parloop_struct_235587
    futhark_mc_segred_stage_1_parloop_struct_235587;
    
    futhark_mc_segred_stage_1_parloop_struct_235587.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235587.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_235587.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235587.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_segred_stage_1_parloop_struct_235587.free_gtid_206951 =
        gtid_206951;
    futhark_mc_segred_stage_1_parloop_struct_235587.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segred_stage_1_parloop_struct_235587.free_bytes_217388 =
        bytes_217388;
    futhark_mc_segred_stage_1_parloop_struct_235587.free_reduce_stage_1_tid_res_arr_mem_221166 =
        reduce_stage_1_tid_res_arr_mem_221166;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235588_task;
    
    futhark_mc_segred_stage_1_parloop_235588_task.name =
        "futhark_mc_segred_stage_1_parloop_235588";
    futhark_mc_segred_stage_1_parloop_235588_task.fn =
        futhark_mc_segred_stage_1_parloop_235588;
    futhark_mc_segred_stage_1_parloop_235588_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235587;
    futhark_mc_segred_stage_1_parloop_235588_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235588_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235588_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235588_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235588_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235588_task);
    
    if (futhark_mc_segred_stage_1_parloop_235588_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235588_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235588_total_end -
                 futhark_mc_segred_stage_1_parloop_235588_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235588_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235588_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235588_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203634 = 0;
    }
    
    bool x_221191;
    bool x_221192;
    
    for (int32_t i_221194 = 0; i_221194 < num_tasks_221153; i_221194++) {
        flat_tid_206960 = i_221194;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221191 = defunc_2_reduce_res_203634;
            }
            // load next params
            {
                x_221192 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221166)[flat_tid_206960];
            }
            // red body
            {
                bool defunc_1_op_res_221193 = x_221191 || x_221192;
                
                defunc_2_reduce_res_203634 = defunc_1_op_res_221193;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221166);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_nested_task_235585_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_nested_task_235585_end -
                 futhark_mc_segred_nested_task_235585_start;
        
        ctx->futhark_mc_segred_nested_task_235585_runs[tid]++;
        ctx->futhark_mc_segred_nested_task_235585_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_nested_task_235585_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235579->retval_defunc_2_reduce_res_203634 =
            defunc_2_reduce_res_203634;
    }
    return err;
}
static int futhark_mc_scan_stage_1_parloop_235578(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_206950, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_235577
    *futhark_mc_scan_stage_1_parloop_struct_235577 =
    (struct futhark_mc_scan_stage_1_parloop_struct_235577 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_235577->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_235578_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235578_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_scan_stage_1_parloop_struct_235577->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_scan_stage_1_parloop_struct_235577->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_scan_stage_1_parloop_struct_235577->free_defunc_0_f_res_203592;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_scan_stage_1_parloop_struct_235577->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 =
            futhark_mc_scan_stage_1_parloop_struct_235577->free_bytes_217388;
    struct memblock mem_217406 = {.desc ="mem_217406", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235577->free_mem_217406,
                                  .size =0, .references =NULL};
    struct memblock mem_217409 = {.desc ="mem_217409", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235577->free_mem_217409,
                                  .size =0, .references =NULL};
    struct memblock mem_217411 = {.desc ="mem_217411", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235577->free_mem_217411,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221152 = start;
    int64_t x_203630;
    int64_t y_203631;
    
    x_203630 = (int64_t) 0;
    for (; iter_221152 < end; iter_221152++) {
        int64_t gtid_206951 = iter_221152;
        
        // stage 1 scan body
        {
            bool defunc_2_reduce_res_203634;
            int64_t flat_tid_206952 = (int64_t) 0;
            int32_t num_tasks_221153;
            
            defunc_2_reduce_res_203634 = 0;
            
            int64_t flat_tid_206960 = (int64_t) 0;
            struct futhark_mc_task_235579 futhark_mc_task_235579;
            
            futhark_mc_task_235579.ctx = ctx;
            futhark_mc_task_235579.free_n_203572 = n_203572;
            futhark_mc_task_235579.free_n_p_203574 = n_p_203574;
            futhark_mc_task_235579.free_defunc_0_f_res_203592 =
                defunc_0_f_res_203592;
            futhark_mc_task_235579.free_gtid_206951 = gtid_206951;
            futhark_mc_task_235579.free_Y_mem_217387 = Y_mem_217387.mem;
            futhark_mc_task_235579.free_bytes_217388 = bytes_217388;
            futhark_mc_task_235579.retval_defunc_2_reduce_res_203634 =
                &defunc_2_reduce_res_203634;
            
            struct scheduler_segop futhark_mc_task_235579_task;
            
            futhark_mc_task_235579_task.args = &futhark_mc_task_235579;
            futhark_mc_task_235579_task.top_level_fn =
                futhark_mc_segred_task_235580;
            futhark_mc_task_235579_task.name = "futhark_mc_segred_task_235580";
            futhark_mc_task_235579_task.iterations = n_p_203574;
            futhark_mc_task_235579_task.task_time =
                &ctx->futhark_mc_segred_task_235580_total_time;
            futhark_mc_task_235579_task.task_iter =
                &ctx->futhark_mc_segred_task_235580_total_iter;
            futhark_mc_task_235579_task.sched = STATIC;
            futhark_mc_task_235579_task.nested_fn =
                futhark_mc_segred_nested_task_235585;
            
            int futhark_mc_segred_task_235580_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235579_task);
            
            if (futhark_mc_segred_task_235580_err != 0) {
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t defunc_2_lifted_lambda_res_203657 =
                    btoi_bool_i64(defunc_2_reduce_res_203634);
            bool is_i_203658 = defunc_2_lifted_lambda_res_203657 == (int64_t) 0;
            bool cond_neg_203659 = !is_i_203658;
            int64_t part_res_203660 = btoi_bool_i64(cond_neg_203659);
            int64_t part_res_203661 = btoi_bool_i64(is_i_203658);
            
            // write mapped values results to memory
            {
                ((int64_t *) mem_217409.mem)[gtid_206951] = part_res_203660;
                ((bool *) mem_217411.mem)[gtid_206951] =
                    defunc_2_reduce_res_203634;
            }
            x_203630 = x_203630;
            // Read next values
            {
                y_203631 = part_res_203661;
            }
            
            int64_t zz_203632 = x_203630 + y_203631;
            
            ((int64_t *) mem_217406.mem)[gtid_206951] = zz_203632;
            x_203630 = zz_203632;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235578_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235578_end -
                 futhark_mc_scan_stage_1_parloop_235578_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_235578_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_235578_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_235578_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_task_235599 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    bool *retval_defunc_2_reduce_res_203634;
};
struct futhark_mc_segred_stage_1_parloop_struct_235602 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221204;
};
static int futhark_mc_segred_stage_1_parloop_235603(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206952,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235602
    *futhark_mc_segred_stage_1_parloop_struct_235602 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235602 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235602->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235603_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235603_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_235602->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235602->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_segred_stage_1_parloop_struct_235602->free_defunc_0_f_res_203592;
    int64_t gtid_206951 =
            futhark_mc_segred_stage_1_parloop_struct_235602->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235602->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 =
            futhark_mc_segred_stage_1_parloop_struct_235602->free_bytes_217388;
    struct memblock reduce_stage_1_tid_res_arr_mem_221204 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221204",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235602->free_reduce_stage_1_tid_res_arr_mem_221204,
                                                             .size =0,
                                                             .references =NULL};
    size_t mem_217391_cached_sizze_235604 = 0;
    unsigned char *mem_217391 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221206 = start;
    
    if (mem_217391_cached_sizze_235604 < (size_t) bytes_217388) {
        mem_217391 = realloc(mem_217391, bytes_217388);
        mem_217391_cached_sizze_235604 = bytes_217388;
    }
    
    bool x_203635;
    bool x_203636;
    bool local_acc_221207 = 0;
    
    for (; iter_221206 < end; iter_221206++) {
        int64_t gtid_206953 = iter_221206;
        
        for (int64_t i_216123 = 0; i_216123 < defunc_0_f_res_203592;
             i_216123++) {
            int64_t x_203641 = mul64(n_p_203574, i_216123);
            int64_t idx_203642 = add64(x_203641, gtid_206953);
            bool cond_203643 = sle64(n_203572, idx_203642);
            bool defunc_0_f_res_203644;
            
            if (cond_203643) {
                defunc_0_f_res_203644 = 1;
            } else {
                bool x_203645 = sle64((int64_t) 0, idx_203642);
                bool y_203646 = slt64(idx_203642, n_203572);
                bool bounds_check_203647 = x_203645 && y_203646;
                bool index_certs_203648;
                
                if (!bounds_check_203647) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) idx_203642,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #0  stl.fut:406:66-71\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_203649;
                
                isnan_arg_203649 = ((double *) Y_mem_217387.mem)[gtid_206951 *
                                                                 n_203572 +
                                                                 idx_203642];
                
                bool isnan_res_203650;
                
                isnan_res_203650 = futrts_isnan64(isnan_arg_203649);
                defunc_0_f_res_203644 = isnan_res_203650;
            }
            ((bool *) mem_217391)[i_216123] = defunc_0_f_res_203644;
        }
        // Trace: trace
        {
            fprintf(ctx->log, "%s", "trace: ");
            for (int64_t nest_i_221209 = 0; nest_i_221209 <
                 defunc_0_f_res_203592; nest_i_221209++) {
                bool arr_elem_221210;
                
                arr_elem_221210 = ((bool *) mem_217391)[nest_i_221209];
                fprintf(ctx->log, "%s%s", arr_elem_221210 ? "true" : "false",
                        " ");
            }
            fprintf(ctx->log, "%s", "\n");
        }
        
        bool defunc_2_reduce_res_203652;
        bool redout_216125 = 1;
        
        for (int64_t i_216126 = 0; i_216126 < defunc_0_f_res_203592;
             i_216126++) {
            bool x_203656;
            
            x_203656 = ((bool *) mem_217391)[i_216126];
            
            bool x_203655 = x_203656 && redout_216125;
            bool redout_tmp_221211 = x_203655;
            
            redout_216125 = redout_tmp_221211;
        }
        defunc_2_reduce_res_203652 = redout_216125;
        // save map-out results
        { }
        // Load accum params
        {
            x_203635 = local_acc_221207;
        }
        // Load next params
        {
            x_203636 = defunc_2_reduce_res_203652;
        }
        // Red body
        {
            bool defunc_1_op_res_203637 = x_203635 || x_203636;
            
            local_acc_221207 = defunc_1_op_res_203637;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221204.mem)[flat_tid_206952] =
        local_acc_221207;
    
  cleanup:
    { }
    free(mem_217391);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235603_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235603_end -
                 futhark_mc_segred_stage_1_parloop_235603_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235603_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235603_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235603_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235600(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206952 = tid;
    int num_tasks_221203 = info.nsubtasks;
    struct futhark_mc_task_235599 *futhark_mc_task_235599 =
                                  (struct futhark_mc_task_235599 *) args;
    struct futhark_context *ctx = futhark_mc_task_235599->ctx;
    uint64_t futhark_mc_segred_task_235600_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235600_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235599->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235599->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235599->free_defunc_0_f_res_203592;
    int64_t gtid_206951 = futhark_mc_task_235599->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235599->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 = futhark_mc_task_235599->free_bytes_217388;
    bool defunc_2_reduce_res_203634 =
         *futhark_mc_task_235599->retval_defunc_2_reduce_res_203634;
    size_t reduce_stage_1_tid_res_arr_mem_221204_cached_sizze_235601 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221204 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221204_cached_sizze_235601 <
        (size_t) num_tasks_221203) {
        reduce_stage_1_tid_res_arr_mem_221204 =
            realloc(reduce_stage_1_tid_res_arr_mem_221204, num_tasks_221203);
        reduce_stage_1_tid_res_arr_mem_221204_cached_sizze_235601 =
            num_tasks_221203;
    }
    
    int64_t iter_221206;
    struct futhark_mc_segred_stage_1_parloop_struct_235602
    futhark_mc_segred_stage_1_parloop_struct_235602;
    
    futhark_mc_segred_stage_1_parloop_struct_235602.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235602.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_235602.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235602.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_segred_stage_1_parloop_struct_235602.free_gtid_206951 =
        gtid_206951;
    futhark_mc_segred_stage_1_parloop_struct_235602.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segred_stage_1_parloop_struct_235602.free_bytes_217388 =
        bytes_217388;
    futhark_mc_segred_stage_1_parloop_struct_235602.free_reduce_stage_1_tid_res_arr_mem_221204 =
        reduce_stage_1_tid_res_arr_mem_221204;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235603_task;
    
    futhark_mc_segred_stage_1_parloop_235603_task.name =
        "futhark_mc_segred_stage_1_parloop_235603";
    futhark_mc_segred_stage_1_parloop_235603_task.fn =
        futhark_mc_segred_stage_1_parloop_235603;
    futhark_mc_segred_stage_1_parloop_235603_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235602;
    futhark_mc_segred_stage_1_parloop_235603_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235603_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235603_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235603_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235603_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235603_task);
    
    if (futhark_mc_segred_stage_1_parloop_235603_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235603_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235603_total_end -
                 futhark_mc_segred_stage_1_parloop_235603_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235603_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235603_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235603_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203634 = 0;
    }
    
    bool x_221212;
    bool x_221213;
    
    for (int32_t i_221215 = 0; i_221215 < num_tasks_221203; i_221215++) {
        flat_tid_206952 = i_221215;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221212 = defunc_2_reduce_res_203634;
            }
            // load next params
            {
                x_221213 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221204)[flat_tid_206952];
            }
            // red body
            {
                bool defunc_1_op_res_221214 = x_221212 || x_221213;
                
                defunc_2_reduce_res_203634 = defunc_1_op_res_221214;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221204);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235600_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235600_end -
                 futhark_mc_segred_task_235600_start;
        
        ctx->futhark_mc_segred_task_235600_runs[tid]++;
        ctx->futhark_mc_segred_task_235600_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235600_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235599->retval_defunc_2_reduce_res_203634 =
            defunc_2_reduce_res_203634;
    }
    return err;
}
struct futhark_mc_segred_stage_1_parloop_struct_235607 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221216;
};
struct futhark_mc_task_235610 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    int64_t free_gtid_206961;
    unsigned char *free_Y_mem_217387;
    unsigned char *free_mem_217389;
};
struct futhark_mc_segmap_parloop_struct_235612 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    int64_t free_gtid_206961;
    unsigned char *free_Y_mem_217387;
    unsigned char *free_mem_217389;
};
static int futhark_mc_segmap_parloop_235613(void *args, int64_t start,
                                            int64_t end, int flat_tid_206967,
                                            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_203572 = futhark_mc_segmap_parloop_struct_235612->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235612->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_segmap_parloop_struct_235612->free_defunc_0_f_res_203592;
    int64_t gtid_206951 =
            futhark_mc_segmap_parloop_struct_235612->free_gtid_206951;
    int64_t gtid_206961 =
            futhark_mc_segmap_parloop_struct_235612->free_gtid_206961;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segmap_parloop_struct_235612->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_segmap_parloop_struct_235612->free_mem_217389,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221221 = start;
    
    for (; iter_221221 < end; iter_221221++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221228 = defunc_0_f_res_203592;
        int64_t gtid_206968 = iter_221221;
        int64_t remnant_221229 = iter_221221 - gtid_206968;
        int64_t x_206970 = mul64(n_p_203574, gtid_206968);
        int64_t idx_206971 = add64(gtid_206961, x_206970);
        bool cond_206972 = sle64(n_203572, idx_206971);
        bool defunc_0_f_res_206973;
        
        if (cond_206972) {
            defunc_0_f_res_206973 = 1;
        } else {
            bool x_221222 = sle64((int64_t) 0, idx_206971);
            bool y_221223 = slt64(idx_206971, n_203572);
            bool bounds_check_221224 = x_221222 && y_221223;
            bool index_certs_221225;
            
            if (!bounds_check_221224) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) idx_206971,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #0  stl.fut:406:66-71\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_221226;
            
            isnan_arg_221226 = ((double *) Y_mem_217387.mem)[gtid_206951 *
                                                             n_203572 +
                                                             idx_206971];
            
            bool isnan_res_221227;
            
            isnan_res_221227 = futrts_isnan64(isnan_arg_221226);
            defunc_0_f_res_206973 = isnan_res_221227;
        }
        ((bool *) mem_217389.mem)[gtid_206968] = defunc_0_f_res_206973;
    }
    
  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_206967 = tid;
    int num_tasks_221220 = 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_203572 = futhark_mc_task_235610->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235610->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235610->free_defunc_0_f_res_203592;
    int64_t gtid_206951 = futhark_mc_task_235610->free_gtid_206951;
    int64_t gtid_206961 = futhark_mc_task_235610->free_gtid_206961;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235610->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_task_235610->free_mem_217389,
                                  .size =0, .references =NULL};
    int64_t iter_221221;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235612.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235612.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_segmap_parloop_struct_235612.free_gtid_206951 = gtid_206951;
    futhark_mc_segmap_parloop_struct_235612.free_gtid_206961 = gtid_206961;
    futhark_mc_segmap_parloop_struct_235612.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segmap_parloop_struct_235612.free_mem_217389 = mem_217389.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;
    unsigned char *free_mem_217389;
    bool *retval_defunc_2_reduce_res_206981;
};
struct futhark_mc_segred_stage_1_parloop_struct_235617 {
    struct futhark_context *ctx;
    unsigned char *free_mem_217389;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221233;
};
static int futhark_mc_segred_stage_1_parloop_235618(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206982,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235617
    *futhark_mc_segred_stage_1_parloop_struct_235617 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235617 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235617->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235618_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235618_start = get_wall_time();
    
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235617->free_mem_217389,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221233 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221233",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235617->free_reduce_stage_1_tid_res_arr_mem_221233,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221235 = start;
    bool x_206984;
    bool x_206985;
    bool local_acc_221236 = 1;
    
    for (; iter_221235 < end; iter_221235++) {
        int64_t gtid_206983 = iter_221235;
        bool x_206987;
        
        x_206987 = ((bool *) mem_217389.mem)[gtid_206983];
        // save map-out results
        { }
        // Load accum params
        {
            x_206984 = local_acc_221236;
        }
        // Load next params
        {
            x_206985 = x_206987;
        }
        // Red body
        {
            bool x_206986 = x_206984 && x_206985;
            
            local_acc_221236 = x_206986;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221233.mem)[flat_tid_206982] =
        local_acc_221236;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235618_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235618_end -
                 futhark_mc_segred_stage_1_parloop_235618_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235618_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235618_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235618_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235615(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206982 = tid;
    int num_tasks_221232 = 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_segred_task_235615_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235615_start = get_wall_time();
    
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_task_235614->free_mem_217389,
                                  .size =0, .references =NULL};
    bool defunc_2_reduce_res_206981 =
         *futhark_mc_task_235614->retval_defunc_2_reduce_res_206981;
    size_t reduce_stage_1_tid_res_arr_mem_221233_cached_sizze_235616 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221233 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221233_cached_sizze_235616 <
        (size_t) num_tasks_221232) {
        reduce_stage_1_tid_res_arr_mem_221233 =
            realloc(reduce_stage_1_tid_res_arr_mem_221233, num_tasks_221232);
        reduce_stage_1_tid_res_arr_mem_221233_cached_sizze_235616 =
            num_tasks_221232;
    }
    
    int64_t iter_221235;
    struct futhark_mc_segred_stage_1_parloop_struct_235617
    futhark_mc_segred_stage_1_parloop_struct_235617;
    
    futhark_mc_segred_stage_1_parloop_struct_235617.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235617.free_mem_217389 =
        mem_217389.mem;
    futhark_mc_segred_stage_1_parloop_struct_235617.free_reduce_stage_1_tid_res_arr_mem_221233 =
        reduce_stage_1_tid_res_arr_mem_221233;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235618_task;
    
    futhark_mc_segred_stage_1_parloop_235618_task.name =
        "futhark_mc_segred_stage_1_parloop_235618";
    futhark_mc_segred_stage_1_parloop_235618_task.fn =
        futhark_mc_segred_stage_1_parloop_235618;
    futhark_mc_segred_stage_1_parloop_235618_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235617;
    futhark_mc_segred_stage_1_parloop_235618_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235618_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235618_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235618_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235618_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235618_task);
    
    if (futhark_mc_segred_stage_1_parloop_235618_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235618_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235618_total_end -
                 futhark_mc_segred_stage_1_parloop_235618_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235618_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235618_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235618_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_206981 = 1;
    }
    
    bool x_221237;
    bool x_221238;
    
    for (int32_t i_221240 = 0; i_221240 < num_tasks_221232; i_221240++) {
        flat_tid_206982 = i_221240;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221237 = defunc_2_reduce_res_206981;
            }
            // load next params
            {
                x_221238 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221233)[flat_tid_206982];
            }
            // red body
            {
                bool x_221239 = x_221237 && x_221238;
                
                defunc_2_reduce_res_206981 = x_221239;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221233);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235615_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235615_end -
                 futhark_mc_segred_task_235615_start;
        
        ctx->futhark_mc_segred_task_235615_runs[tid]++;
        ctx->futhark_mc_segred_task_235615_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235615_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235614->retval_defunc_2_reduce_res_206981 =
            defunc_2_reduce_res_206981;
    }
    return err;
}
static int futhark_mc_segred_stage_1_parloop_235608(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206960,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235607
    *futhark_mc_segred_stage_1_parloop_struct_235607 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235607 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235607->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235608_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235608_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_235607->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235607->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_segred_stage_1_parloop_struct_235607->free_defunc_0_f_res_203592;
    int64_t gtid_206951 =
            futhark_mc_segred_stage_1_parloop_struct_235607->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235607->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 =
            futhark_mc_segred_stage_1_parloop_struct_235607->free_bytes_217388;
    struct memblock reduce_stage_1_tid_res_arr_mem_221216 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221216",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235607->free_reduce_stage_1_tid_res_arr_mem_221216,
                                                             .size =0,
                                                             .references =NULL};
    size_t mem_217389_cached_sizze_235609 = 0;
    unsigned char *mem_217389 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221218 = start;
    
    if (mem_217389_cached_sizze_235609 < (size_t) bytes_217388) {
        mem_217389 = realloc(mem_217389, bytes_217388);
        mem_217389_cached_sizze_235609 = bytes_217388;
    }
    
    bool x_206962;
    bool x_206963;
    bool local_acc_221219 = 0;
    
    for (; iter_221218 < end; iter_221218++) {
        int64_t gtid_206961 = iter_221218;
        int64_t flat_tid_206967 = (int64_t) 0;
        int32_t num_tasks_221220;
        struct futhark_mc_task_235610 futhark_mc_task_235610;
        
        futhark_mc_task_235610.ctx = ctx;
        futhark_mc_task_235610.free_n_203572 = n_203572;
        futhark_mc_task_235610.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235610.free_defunc_0_f_res_203592 =
            defunc_0_f_res_203592;
        futhark_mc_task_235610.free_gtid_206951 = gtid_206951;
        futhark_mc_task_235610.free_gtid_206961 = gtid_206961;
        futhark_mc_task_235610.free_Y_mem_217387 = Y_mem_217387.mem;
        futhark_mc_task_235610.free_mem_217389 = mem_217389;
        
        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 = defunc_0_f_res_203592;
        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;
        }
        // Trace: trace
        {
            fprintf(ctx->log, "%s", "trace: ");
            for (int64_t nest_i_221230 = 0; nest_i_221230 <
                 defunc_0_f_res_203592; nest_i_221230++) {
                bool arr_elem_221231;
                
                arr_elem_221231 = ((bool *) mem_217389)[nest_i_221230];
                fprintf(ctx->log, "%s%s", arr_elem_221231 ? "true" : "false",
                        " ");
            }
            fprintf(ctx->log, "%s", "\n");
        }
        
        bool defunc_2_reduce_res_206981;
        int64_t flat_tid_206982 = (int64_t) 0;
        int32_t num_tasks_221232;
        
        defunc_2_reduce_res_206981 = 0;
        
        struct futhark_mc_task_235614 futhark_mc_task_235614;
        
        futhark_mc_task_235614.ctx = ctx;
        futhark_mc_task_235614.free_mem_217389 = mem_217389;
        futhark_mc_task_235614.retval_defunc_2_reduce_res_206981 =
            &defunc_2_reduce_res_206981;
        
        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_segred_task_235615;
        futhark_mc_task_235614_task.name = "futhark_mc_segred_task_235615";
        futhark_mc_task_235614_task.iterations = defunc_0_f_res_203592;
        futhark_mc_task_235614_task.task_time =
            &ctx->futhark_mc_segred_task_235615_total_time;
        futhark_mc_task_235614_task.task_iter =
            &ctx->futhark_mc_segred_task_235615_total_iter;
        futhark_mc_task_235614_task.sched = STATIC;
        futhark_mc_task_235614_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235615_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235614_task);
        
        if (futhark_mc_segred_task_235615_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_206962 = local_acc_221219;
        }
        // Load next params
        {
            x_206963 = defunc_2_reduce_res_206981;
        }
        // Red body
        {
            bool defunc_1_op_res_206964 = x_206962 || x_206963;
            
            local_acc_221219 = defunc_1_op_res_206964;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221216.mem)[flat_tid_206960] =
        local_acc_221219;
    
  cleanup:
    { }
    free(mem_217389);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235608_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235608_end -
                 futhark_mc_segred_stage_1_parloop_235608_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235608_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235608_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235608_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_nested_task_235605(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206960 = tid;
    int num_tasks_221203 = info.nsubtasks;
    struct futhark_mc_task_235599 *futhark_mc_task_235599 =
                                  (struct futhark_mc_task_235599 *) args;
    struct futhark_context *ctx = futhark_mc_task_235599->ctx;
    uint64_t futhark_mc_segred_nested_task_235605_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_nested_task_235605_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235599->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235599->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235599->free_defunc_0_f_res_203592;
    int64_t gtid_206951 = futhark_mc_task_235599->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235599->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 = futhark_mc_task_235599->free_bytes_217388;
    bool defunc_2_reduce_res_203634 =
         *futhark_mc_task_235599->retval_defunc_2_reduce_res_203634;
    size_t reduce_stage_1_tid_res_arr_mem_221216_cached_sizze_235606 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221216 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221216_cached_sizze_235606 <
        (size_t) num_tasks_221203) {
        reduce_stage_1_tid_res_arr_mem_221216 =
            realloc(reduce_stage_1_tid_res_arr_mem_221216, num_tasks_221203);
        reduce_stage_1_tid_res_arr_mem_221216_cached_sizze_235606 =
            num_tasks_221203;
    }
    
    int64_t iter_221218;
    struct futhark_mc_segred_stage_1_parloop_struct_235607
    futhark_mc_segred_stage_1_parloop_struct_235607;
    
    futhark_mc_segred_stage_1_parloop_struct_235607.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235607.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_235607.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235607.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_segred_stage_1_parloop_struct_235607.free_gtid_206951 =
        gtid_206951;
    futhark_mc_segred_stage_1_parloop_struct_235607.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segred_stage_1_parloop_struct_235607.free_bytes_217388 =
        bytes_217388;
    futhark_mc_segred_stage_1_parloop_struct_235607.free_reduce_stage_1_tid_res_arr_mem_221216 =
        reduce_stage_1_tid_res_arr_mem_221216;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235608_task;
    
    futhark_mc_segred_stage_1_parloop_235608_task.name =
        "futhark_mc_segred_stage_1_parloop_235608";
    futhark_mc_segred_stage_1_parloop_235608_task.fn =
        futhark_mc_segred_stage_1_parloop_235608;
    futhark_mc_segred_stage_1_parloop_235608_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235607;
    futhark_mc_segred_stage_1_parloop_235608_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235608_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235608_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235608_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235608_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235608_task);
    
    if (futhark_mc_segred_stage_1_parloop_235608_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235608_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235608_total_end -
                 futhark_mc_segred_stage_1_parloop_235608_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235608_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235608_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235608_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203634 = 0;
    }
    
    bool x_221241;
    bool x_221242;
    
    for (int32_t i_221244 = 0; i_221244 < num_tasks_221203; i_221244++) {
        flat_tid_206960 = i_221244;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221241 = defunc_2_reduce_res_203634;
            }
            // load next params
            {
                x_221242 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221216)[flat_tid_206960];
            }
            // red body
            {
                bool defunc_1_op_res_221243 = x_221241 || x_221242;
                
                defunc_2_reduce_res_203634 = defunc_1_op_res_221243;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221216);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_nested_task_235605_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_nested_task_235605_end -
                 futhark_mc_segred_nested_task_235605_start;
        
        ctx->futhark_mc_segred_nested_task_235605_runs[tid]++;
        ctx->futhark_mc_segred_nested_task_235605_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_nested_task_235605_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235599->retval_defunc_2_reduce_res_203634 =
            defunc_2_reduce_res_203634;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_235619 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    unsigned char *free_mem_217406;
};
struct futhark_mc_task_235621 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    bool *retval_defunc_2_reduce_res_203634;
};
struct futhark_mc_segred_stage_1_parloop_struct_235624 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221250;
};
static int futhark_mc_segred_stage_1_parloop_235625(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206952,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235624
    *futhark_mc_segred_stage_1_parloop_struct_235624 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235624 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235624->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235625_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235625_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_235624->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235624->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_segred_stage_1_parloop_struct_235624->free_defunc_0_f_res_203592;
    int64_t gtid_206951 =
            futhark_mc_segred_stage_1_parloop_struct_235624->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235624->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 =
            futhark_mc_segred_stage_1_parloop_struct_235624->free_bytes_217388;
    struct memblock reduce_stage_1_tid_res_arr_mem_221250 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221250",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235624->free_reduce_stage_1_tid_res_arr_mem_221250,
                                                             .size =0,
                                                             .references =NULL};
    size_t mem_217391_cached_sizze_235626 = 0;
    unsigned char *mem_217391 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221252 = start;
    
    if (mem_217391_cached_sizze_235626 < (size_t) bytes_217388) {
        mem_217391 = realloc(mem_217391, bytes_217388);
        mem_217391_cached_sizze_235626 = bytes_217388;
    }
    
    bool x_203635;
    bool x_203636;
    bool local_acc_221253 = 0;
    
    for (; iter_221252 < end; iter_221252++) {
        int64_t gtid_206953 = iter_221252;
        
        for (int64_t i_216123 = 0; i_216123 < defunc_0_f_res_203592;
             i_216123++) {
            int64_t x_203641 = mul64(n_p_203574, i_216123);
            int64_t idx_203642 = add64(x_203641, gtid_206953);
            bool cond_203643 = sle64(n_203572, idx_203642);
            bool defunc_0_f_res_203644;
            
            if (cond_203643) {
                defunc_0_f_res_203644 = 1;
            } else {
                bool x_203645 = sle64((int64_t) 0, idx_203642);
                bool y_203646 = slt64(idx_203642, n_203572);
                bool bounds_check_203647 = x_203645 && y_203646;
                bool index_certs_203648;
                
                if (!bounds_check_203647) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) idx_203642,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #0  stl.fut:406:66-71\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_203649;
                
                isnan_arg_203649 = ((double *) Y_mem_217387.mem)[gtid_206951 *
                                                                 n_203572 +
                                                                 idx_203642];
                
                bool isnan_res_203650;
                
                isnan_res_203650 = futrts_isnan64(isnan_arg_203649);
                defunc_0_f_res_203644 = isnan_res_203650;
            }
            ((bool *) mem_217391)[i_216123] = defunc_0_f_res_203644;
        }
        // Trace: trace
        {
            fprintf(ctx->log, "%s", "trace: ");
            for (int64_t nest_i_221255 = 0; nest_i_221255 <
                 defunc_0_f_res_203592; nest_i_221255++) {
                bool arr_elem_221256;
                
                arr_elem_221256 = ((bool *) mem_217391)[nest_i_221255];
                fprintf(ctx->log, "%s%s", arr_elem_221256 ? "true" : "false",
                        " ");
            }
            fprintf(ctx->log, "%s", "\n");
        }
        
        bool defunc_2_reduce_res_203652;
        bool redout_216125 = 1;
        
        for (int64_t i_216126 = 0; i_216126 < defunc_0_f_res_203592;
             i_216126++) {
            bool x_203656;
            
            x_203656 = ((bool *) mem_217391)[i_216126];
            
            bool x_203655 = x_203656 && redout_216125;
            bool redout_tmp_221257 = x_203655;
            
            redout_216125 = redout_tmp_221257;
        }
        defunc_2_reduce_res_203652 = redout_216125;
        // save map-out results
        { }
        // Load accum params
        {
            x_203635 = local_acc_221253;
        }
        // Load next params
        {
            x_203636 = defunc_2_reduce_res_203652;
        }
        // Red body
        {
            bool defunc_1_op_res_203637 = x_203635 || x_203636;
            
            local_acc_221253 = defunc_1_op_res_203637;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221250.mem)[flat_tid_206952] =
        local_acc_221253;
    
  cleanup:
    { }
    free(mem_217391);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235625_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235625_end -
                 futhark_mc_segred_stage_1_parloop_235625_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235625_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235625_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235625_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235622(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206952 = tid;
    int num_tasks_221249 = info.nsubtasks;
    struct futhark_mc_task_235621 *futhark_mc_task_235621 =
                                  (struct futhark_mc_task_235621 *) args;
    struct futhark_context *ctx = futhark_mc_task_235621->ctx;
    uint64_t futhark_mc_segred_task_235622_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235622_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235621->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235621->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235621->free_defunc_0_f_res_203592;
    int64_t gtid_206951 = futhark_mc_task_235621->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235621->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 = futhark_mc_task_235621->free_bytes_217388;
    bool defunc_2_reduce_res_203634 =
         *futhark_mc_task_235621->retval_defunc_2_reduce_res_203634;
    size_t reduce_stage_1_tid_res_arr_mem_221250_cached_sizze_235623 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221250 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221250_cached_sizze_235623 <
        (size_t) num_tasks_221249) {
        reduce_stage_1_tid_res_arr_mem_221250 =
            realloc(reduce_stage_1_tid_res_arr_mem_221250, num_tasks_221249);
        reduce_stage_1_tid_res_arr_mem_221250_cached_sizze_235623 =
            num_tasks_221249;
    }
    
    int64_t iter_221252;
    struct futhark_mc_segred_stage_1_parloop_struct_235624
    futhark_mc_segred_stage_1_parloop_struct_235624;
    
    futhark_mc_segred_stage_1_parloop_struct_235624.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235624.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_235624.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235624.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_segred_stage_1_parloop_struct_235624.free_gtid_206951 =
        gtid_206951;
    futhark_mc_segred_stage_1_parloop_struct_235624.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segred_stage_1_parloop_struct_235624.free_bytes_217388 =
        bytes_217388;
    futhark_mc_segred_stage_1_parloop_struct_235624.free_reduce_stage_1_tid_res_arr_mem_221250 =
        reduce_stage_1_tid_res_arr_mem_221250;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235625_task;
    
    futhark_mc_segred_stage_1_parloop_235625_task.name =
        "futhark_mc_segred_stage_1_parloop_235625";
    futhark_mc_segred_stage_1_parloop_235625_task.fn =
        futhark_mc_segred_stage_1_parloop_235625;
    futhark_mc_segred_stage_1_parloop_235625_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235624;
    futhark_mc_segred_stage_1_parloop_235625_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235625_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235625_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235625_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235625_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235625_task);
    
    if (futhark_mc_segred_stage_1_parloop_235625_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235625_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235625_total_end -
                 futhark_mc_segred_stage_1_parloop_235625_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235625_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235625_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235625_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203634 = 0;
    }
    
    bool x_221258;
    bool x_221259;
    
    for (int32_t i_221261 = 0; i_221261 < num_tasks_221249; i_221261++) {
        flat_tid_206952 = i_221261;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221258 = defunc_2_reduce_res_203634;
            }
            // load next params
            {
                x_221259 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221250)[flat_tid_206952];
            }
            // red body
            {
                bool defunc_1_op_res_221260 = x_221258 || x_221259;
                
                defunc_2_reduce_res_203634 = defunc_1_op_res_221260;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221250);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235622_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235622_end -
                 futhark_mc_segred_task_235622_start;
        
        ctx->futhark_mc_segred_task_235622_runs[tid]++;
        ctx->futhark_mc_segred_task_235622_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235622_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235621->retval_defunc_2_reduce_res_203634 =
            defunc_2_reduce_res_203634;
    }
    return err;
}
struct futhark_mc_segred_stage_1_parloop_struct_235629 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    unsigned char *free_Y_mem_217387;
    int64_t free_bytes_217388;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221262;
};
struct futhark_mc_task_235632 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    int64_t free_gtid_206961;
    unsigned char *free_Y_mem_217387;
    unsigned char *free_mem_217389;
};
struct futhark_mc_segmap_parloop_struct_235634 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203592;
    int64_t free_gtid_206951;
    int64_t free_gtid_206961;
    unsigned char *free_Y_mem_217387;
    unsigned char *free_mem_217389;
};
static int futhark_mc_segmap_parloop_235635(void *args, int64_t start,
                                            int64_t end, int flat_tid_206967,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235634
    *futhark_mc_segmap_parloop_struct_235634 =
    (struct futhark_mc_segmap_parloop_struct_235634 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235634->ctx;
    uint64_t futhark_mc_segmap_parloop_235635_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235635_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235634->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235634->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_segmap_parloop_struct_235634->free_defunc_0_f_res_203592;
    int64_t gtid_206951 =
            futhark_mc_segmap_parloop_struct_235634->free_gtid_206951;
    int64_t gtid_206961 =
            futhark_mc_segmap_parloop_struct_235634->free_gtid_206961;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segmap_parloop_struct_235634->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_segmap_parloop_struct_235634->free_mem_217389,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221267 = start;
    
    for (; iter_221267 < end; iter_221267++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221274 = defunc_0_f_res_203592;
        int64_t gtid_206968 = iter_221267;
        int64_t remnant_221275 = iter_221267 - gtid_206968;
        int64_t x_206970 = mul64(n_p_203574, gtid_206968);
        int64_t idx_206971 = add64(gtid_206961, x_206970);
        bool cond_206972 = sle64(n_203572, idx_206971);
        bool defunc_0_f_res_206973;
        
        if (cond_206972) {
            defunc_0_f_res_206973 = 1;
        } else {
            bool x_221268 = sle64((int64_t) 0, idx_206971);
            bool y_221269 = slt64(idx_206971, n_203572);
            bool bounds_check_221270 = x_221268 && y_221269;
            bool index_certs_221271;
            
            if (!bounds_check_221270) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) idx_206971,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #0  stl.fut:406:66-71\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_221272;
            
            isnan_arg_221272 = ((double *) Y_mem_217387.mem)[gtid_206951 *
                                                             n_203572 +
                                                             idx_206971];
            
            bool isnan_res_221273;
            
            isnan_res_221273 = futrts_isnan64(isnan_arg_221272);
            defunc_0_f_res_206973 = isnan_res_221273;
        }
        ((bool *) mem_217389.mem)[gtid_206968] = defunc_0_f_res_206973;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235635_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235635_end -
                 futhark_mc_segmap_parloop_235635_start;
        
        ctx->futhark_mc_segmap_parloop_235635_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235635_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235635_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235633(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206967 = tid;
    int num_tasks_221266 = info.nsubtasks;
    struct futhark_mc_task_235632 *futhark_mc_task_235632 =
                                  (struct futhark_mc_task_235632 *) args;
    struct futhark_context *ctx = futhark_mc_task_235632->ctx;
    uint64_t futhark_mc_segmap_task_235633_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235633_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235632->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235632->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235632->free_defunc_0_f_res_203592;
    int64_t gtid_206951 = futhark_mc_task_235632->free_gtid_206951;
    int64_t gtid_206961 = futhark_mc_task_235632->free_gtid_206961;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235632->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_task_235632->free_mem_217389,
                                  .size =0, .references =NULL};
    int64_t iter_221267;
    struct futhark_mc_segmap_parloop_struct_235634
    futhark_mc_segmap_parloop_struct_235634;
    
    futhark_mc_segmap_parloop_struct_235634.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235634.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235634.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235634.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_segmap_parloop_struct_235634.free_gtid_206951 = gtid_206951;
    futhark_mc_segmap_parloop_struct_235634.free_gtid_206961 = gtid_206961;
    futhark_mc_segmap_parloop_struct_235634.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segmap_parloop_struct_235634.free_mem_217389 = mem_217389.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235635_task;
    
    futhark_mc_segmap_parloop_235635_task.name =
        "futhark_mc_segmap_parloop_235635";
    futhark_mc_segmap_parloop_235635_task.fn = futhark_mc_segmap_parloop_235635;
    futhark_mc_segmap_parloop_235635_task.args =
        &futhark_mc_segmap_parloop_struct_235634;
    futhark_mc_segmap_parloop_235635_task.iterations = iterations;
    futhark_mc_segmap_parloop_235635_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235635_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235635_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235635_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235635_task);
    
    if (futhark_mc_segmap_parloop_235635_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235635_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235635_total_end -
                 futhark_mc_segmap_parloop_235635_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235635_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235635_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235635_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235633_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235633_end -
                 futhark_mc_segmap_task_235633_start;
        
        ctx->futhark_mc_segmap_task_235633_runs[tid]++;
        ctx->futhark_mc_segmap_task_235633_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235633_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235636 {
    struct futhark_context *ctx;
    unsigned char *free_mem_217389;
    bool *retval_defunc_2_reduce_res_206981;
};
struct futhark_mc_segred_stage_1_parloop_struct_235639 {
    struct futhark_context *ctx;
    unsigned char *free_mem_217389;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_221279;
};
static int futhark_mc_segred_stage_1_parloop_235640(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206982,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235639
    *futhark_mc_segred_stage_1_parloop_struct_235639 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235639 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235639->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235640_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235640_start = get_wall_time();
    
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235639->free_mem_217389,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_221279 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221279",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235639->free_reduce_stage_1_tid_res_arr_mem_221279,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221281 = start;
    bool x_206984;
    bool x_206985;
    bool local_acc_221282 = 1;
    
    for (; iter_221281 < end; iter_221281++) {
        int64_t gtid_206983 = iter_221281;
        bool x_206987;
        
        x_206987 = ((bool *) mem_217389.mem)[gtid_206983];
        // save map-out results
        { }
        // Load accum params
        {
            x_206984 = local_acc_221282;
        }
        // Load next params
        {
            x_206985 = x_206987;
        }
        // Red body
        {
            bool x_206986 = x_206984 && x_206985;
            
            local_acc_221282 = x_206986;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221279.mem)[flat_tid_206982] =
        local_acc_221282;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235640_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235640_end -
                 futhark_mc_segred_stage_1_parloop_235640_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235640_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235640_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235640_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235637(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206982 = tid;
    int num_tasks_221278 = info.nsubtasks;
    struct futhark_mc_task_235636 *futhark_mc_task_235636 =
                                  (struct futhark_mc_task_235636 *) args;
    struct futhark_context *ctx = futhark_mc_task_235636->ctx;
    uint64_t futhark_mc_segred_task_235637_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235637_start = get_wall_time();
    
    struct memblock mem_217389 = {.desc ="mem_217389", .mem =
                                  futhark_mc_task_235636->free_mem_217389,
                                  .size =0, .references =NULL};
    bool defunc_2_reduce_res_206981 =
         *futhark_mc_task_235636->retval_defunc_2_reduce_res_206981;
    size_t reduce_stage_1_tid_res_arr_mem_221279_cached_sizze_235638 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221279 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221279_cached_sizze_235638 <
        (size_t) num_tasks_221278) {
        reduce_stage_1_tid_res_arr_mem_221279 =
            realloc(reduce_stage_1_tid_res_arr_mem_221279, num_tasks_221278);
        reduce_stage_1_tid_res_arr_mem_221279_cached_sizze_235638 =
            num_tasks_221278;
    }
    
    int64_t iter_221281;
    struct futhark_mc_segred_stage_1_parloop_struct_235639
    futhark_mc_segred_stage_1_parloop_struct_235639;
    
    futhark_mc_segred_stage_1_parloop_struct_235639.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235639.free_mem_217389 =
        mem_217389.mem;
    futhark_mc_segred_stage_1_parloop_struct_235639.free_reduce_stage_1_tid_res_arr_mem_221279 =
        reduce_stage_1_tid_res_arr_mem_221279;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235640_task;
    
    futhark_mc_segred_stage_1_parloop_235640_task.name =
        "futhark_mc_segred_stage_1_parloop_235640";
    futhark_mc_segred_stage_1_parloop_235640_task.fn =
        futhark_mc_segred_stage_1_parloop_235640;
    futhark_mc_segred_stage_1_parloop_235640_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235639;
    futhark_mc_segred_stage_1_parloop_235640_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235640_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235640_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235640_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235640_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235640_task);
    
    if (futhark_mc_segred_stage_1_parloop_235640_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235640_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235640_total_end -
                 futhark_mc_segred_stage_1_parloop_235640_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235640_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235640_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235640_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_206981 = 1;
    }
    
    bool x_221283;
    bool x_221284;
    
    for (int32_t i_221286 = 0; i_221286 < num_tasks_221278; i_221286++) {
        flat_tid_206982 = i_221286;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221283 = defunc_2_reduce_res_206981;
            }
            // load next params
            {
                x_221284 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221279)[flat_tid_206982];
            }
            // red body
            {
                bool x_221285 = x_221283 && x_221284;
                
                defunc_2_reduce_res_206981 = x_221285;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221279);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235637_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235637_end -
                 futhark_mc_segred_task_235637_start;
        
        ctx->futhark_mc_segred_task_235637_runs[tid]++;
        ctx->futhark_mc_segred_task_235637_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235637_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235636->retval_defunc_2_reduce_res_206981 =
            defunc_2_reduce_res_206981;
    }
    return err;
}
static int futhark_mc_segred_stage_1_parloop_235630(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_206960,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235629
    *futhark_mc_segred_stage_1_parloop_struct_235629 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235629 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235629->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235630_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235630_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_235629->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235629->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_segred_stage_1_parloop_struct_235629->free_defunc_0_f_res_203592;
    int64_t gtid_206951 =
            futhark_mc_segred_stage_1_parloop_struct_235629->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_235629->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 =
            futhark_mc_segred_stage_1_parloop_struct_235629->free_bytes_217388;
    struct memblock reduce_stage_1_tid_res_arr_mem_221262 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_221262",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235629->free_reduce_stage_1_tid_res_arr_mem_221262,
                                                             .size =0,
                                                             .references =NULL};
    size_t mem_217389_cached_sizze_235631 = 0;
    unsigned char *mem_217389 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221264 = start;
    
    if (mem_217389_cached_sizze_235631 < (size_t) bytes_217388) {
        mem_217389 = realloc(mem_217389, bytes_217388);
        mem_217389_cached_sizze_235631 = bytes_217388;
    }
    
    bool x_206962;
    bool x_206963;
    bool local_acc_221265 = 0;
    
    for (; iter_221264 < end; iter_221264++) {
        int64_t gtid_206961 = iter_221264;
        int64_t flat_tid_206967 = (int64_t) 0;
        int32_t num_tasks_221266;
        struct futhark_mc_task_235632 futhark_mc_task_235632;
        
        futhark_mc_task_235632.ctx = ctx;
        futhark_mc_task_235632.free_n_203572 = n_203572;
        futhark_mc_task_235632.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235632.free_defunc_0_f_res_203592 =
            defunc_0_f_res_203592;
        futhark_mc_task_235632.free_gtid_206951 = gtid_206951;
        futhark_mc_task_235632.free_gtid_206961 = gtid_206961;
        futhark_mc_task_235632.free_Y_mem_217387 = Y_mem_217387.mem;
        futhark_mc_task_235632.free_mem_217389 = mem_217389;
        
        struct scheduler_segop futhark_mc_task_235632_task;
        
        futhark_mc_task_235632_task.args = &futhark_mc_task_235632;
        futhark_mc_task_235632_task.top_level_fn =
            futhark_mc_segmap_task_235633;
        futhark_mc_task_235632_task.name = "futhark_mc_segmap_task_235633";
        futhark_mc_task_235632_task.iterations = defunc_0_f_res_203592;
        futhark_mc_task_235632_task.task_time =
            &ctx->futhark_mc_segmap_task_235633_total_time;
        futhark_mc_task_235632_task.task_iter =
            &ctx->futhark_mc_segmap_task_235633_total_iter;
        futhark_mc_task_235632_task.sched = STATIC;
        futhark_mc_task_235632_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235633_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235632_task);
        
        if (futhark_mc_segmap_task_235633_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        // Trace: trace
        {
            fprintf(ctx->log, "%s", "trace: ");
            for (int64_t nest_i_221276 = 0; nest_i_221276 <
                 defunc_0_f_res_203592; nest_i_221276++) {
                bool arr_elem_221277;
                
                arr_elem_221277 = ((bool *) mem_217389)[nest_i_221276];
                fprintf(ctx->log, "%s%s", arr_elem_221277 ? "true" : "false",
                        " ");
            }
            fprintf(ctx->log, "%s", "\n");
        }
        
        bool defunc_2_reduce_res_206981;
        int64_t flat_tid_206982 = (int64_t) 0;
        int32_t num_tasks_221278;
        
        defunc_2_reduce_res_206981 = 0;
        
        struct futhark_mc_task_235636 futhark_mc_task_235636;
        
        futhark_mc_task_235636.ctx = ctx;
        futhark_mc_task_235636.free_mem_217389 = mem_217389;
        futhark_mc_task_235636.retval_defunc_2_reduce_res_206981 =
            &defunc_2_reduce_res_206981;
        
        struct scheduler_segop futhark_mc_task_235636_task;
        
        futhark_mc_task_235636_task.args = &futhark_mc_task_235636;
        futhark_mc_task_235636_task.top_level_fn =
            futhark_mc_segred_task_235637;
        futhark_mc_task_235636_task.name = "futhark_mc_segred_task_235637";
        futhark_mc_task_235636_task.iterations = defunc_0_f_res_203592;
        futhark_mc_task_235636_task.task_time =
            &ctx->futhark_mc_segred_task_235637_total_time;
        futhark_mc_task_235636_task.task_iter =
            &ctx->futhark_mc_segred_task_235637_total_iter;
        futhark_mc_task_235636_task.sched = STATIC;
        futhark_mc_task_235636_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235637_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235636_task);
        
        if (futhark_mc_segred_task_235637_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_206962 = local_acc_221265;
        }
        // Load next params
        {
            x_206963 = defunc_2_reduce_res_206981;
        }
        // Red body
        {
            bool defunc_1_op_res_206964 = x_206962 || x_206963;
            
            local_acc_221265 = defunc_1_op_res_206964;
        }
    }
    ((bool *) reduce_stage_1_tid_res_arr_mem_221262.mem)[flat_tid_206960] =
        local_acc_221265;
    
  cleanup:
    { }
    free(mem_217389);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235630_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235630_end -
                 futhark_mc_segred_stage_1_parloop_235630_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235630_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235630_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235630_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_nested_task_235627(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206960 = tid;
    int num_tasks_221249 = info.nsubtasks;
    struct futhark_mc_task_235621 *futhark_mc_task_235621 =
                                  (struct futhark_mc_task_235621 *) args;
    struct futhark_context *ctx = futhark_mc_task_235621->ctx;
    uint64_t futhark_mc_segred_nested_task_235627_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_nested_task_235627_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235621->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235621->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235621->free_defunc_0_f_res_203592;
    int64_t gtid_206951 = futhark_mc_task_235621->free_gtid_206951;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235621->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 = futhark_mc_task_235621->free_bytes_217388;
    bool defunc_2_reduce_res_203634 =
         *futhark_mc_task_235621->retval_defunc_2_reduce_res_203634;
    size_t reduce_stage_1_tid_res_arr_mem_221262_cached_sizze_235628 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_221262 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_221262_cached_sizze_235628 <
        (size_t) num_tasks_221249) {
        reduce_stage_1_tid_res_arr_mem_221262 =
            realloc(reduce_stage_1_tid_res_arr_mem_221262, num_tasks_221249);
        reduce_stage_1_tid_res_arr_mem_221262_cached_sizze_235628 =
            num_tasks_221249;
    }
    
    int64_t iter_221264;
    struct futhark_mc_segred_stage_1_parloop_struct_235629
    futhark_mc_segred_stage_1_parloop_struct_235629;
    
    futhark_mc_segred_stage_1_parloop_struct_235629.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235629.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_235629.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235629.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_segred_stage_1_parloop_struct_235629.free_gtid_206951 =
        gtid_206951;
    futhark_mc_segred_stage_1_parloop_struct_235629.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segred_stage_1_parloop_struct_235629.free_bytes_217388 =
        bytes_217388;
    futhark_mc_segred_stage_1_parloop_struct_235629.free_reduce_stage_1_tid_res_arr_mem_221262 =
        reduce_stage_1_tid_res_arr_mem_221262;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235630_task;
    
    futhark_mc_segred_stage_1_parloop_235630_task.name =
        "futhark_mc_segred_stage_1_parloop_235630";
    futhark_mc_segred_stage_1_parloop_235630_task.fn =
        futhark_mc_segred_stage_1_parloop_235630;
    futhark_mc_segred_stage_1_parloop_235630_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235629;
    futhark_mc_segred_stage_1_parloop_235630_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235630_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235630_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235630_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235630_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235630_task);
    
    if (futhark_mc_segred_stage_1_parloop_235630_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235630_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235630_total_end -
                 futhark_mc_segred_stage_1_parloop_235630_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235630_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235630_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235630_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_203634 = 0;
    }
    
    bool x_221287;
    bool x_221288;
    
    for (int32_t i_221290 = 0; i_221290 < num_tasks_221249; i_221290++) {
        flat_tid_206960 = i_221290;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_221287 = defunc_2_reduce_res_203634;
            }
            // load next params
            {
                x_221288 =
                    ((bool *) reduce_stage_1_tid_res_arr_mem_221262)[flat_tid_206960];
            }
            // red body
            {
                bool defunc_1_op_res_221289 = x_221287 || x_221288;
                
                defunc_2_reduce_res_203634 = defunc_1_op_res_221289;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_221262);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_nested_task_235627_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_nested_task_235627_end -
                 futhark_mc_segred_nested_task_235627_start;
        
        ctx->futhark_mc_segred_nested_task_235627_runs[tid]++;
        ctx->futhark_mc_segred_nested_task_235627_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_nested_task_235627_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235621->retval_defunc_2_reduce_res_203634 =
            defunc_2_reduce_res_203634;
    }
    return err;
}
static int futhark_mc_scan_stage_3_parloop_235620(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_206950, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_235619
    *futhark_mc_scan_stage_3_parloop_struct_235619 =
    (struct futhark_mc_scan_stage_3_parloop_struct_235619 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_235619->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_235620_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_235620_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_scan_stage_3_parloop_struct_235619->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_scan_stage_3_parloop_struct_235619->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_scan_stage_3_parloop_struct_235619->free_defunc_0_f_res_203592;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_scan_stage_3_parloop_struct_235619->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 =
            futhark_mc_scan_stage_3_parloop_struct_235619->free_bytes_217388;
    struct memblock mem_217406 = {.desc ="mem_217406", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235619->free_mem_217406,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221248 = start;
    int64_t x_221245;
    int64_t y_221246;
    
    if (iter_221248 == (int64_t) 0) {
        x_221245 = (int64_t) 0;
    } else {
        x_221245 = ((int64_t *) mem_217406.mem)[iter_221248 - (int64_t) 1];
    }
    for (; iter_221248 < end; iter_221248++) {
        int64_t gtid_206951 = iter_221248;
        
        // stage 3 scan body
        {
            bool defunc_2_reduce_res_203634;
            int64_t flat_tid_206952 = (int64_t) 0;
            int32_t num_tasks_221249;
            
            defunc_2_reduce_res_203634 = 0;
            
            int64_t flat_tid_206960 = (int64_t) 0;
            struct futhark_mc_task_235621 futhark_mc_task_235621;
            
            futhark_mc_task_235621.ctx = ctx;
            futhark_mc_task_235621.free_n_203572 = n_203572;
            futhark_mc_task_235621.free_n_p_203574 = n_p_203574;
            futhark_mc_task_235621.free_defunc_0_f_res_203592 =
                defunc_0_f_res_203592;
            futhark_mc_task_235621.free_gtid_206951 = gtid_206951;
            futhark_mc_task_235621.free_Y_mem_217387 = Y_mem_217387.mem;
            futhark_mc_task_235621.free_bytes_217388 = bytes_217388;
            futhark_mc_task_235621.retval_defunc_2_reduce_res_203634 =
                &defunc_2_reduce_res_203634;
            
            struct scheduler_segop futhark_mc_task_235621_task;
            
            futhark_mc_task_235621_task.args = &futhark_mc_task_235621;
            futhark_mc_task_235621_task.top_level_fn =
                futhark_mc_segred_task_235622;
            futhark_mc_task_235621_task.name = "futhark_mc_segred_task_235622";
            futhark_mc_task_235621_task.iterations = n_p_203574;
            futhark_mc_task_235621_task.task_time =
                &ctx->futhark_mc_segred_task_235622_total_time;
            futhark_mc_task_235621_task.task_iter =
                &ctx->futhark_mc_segred_task_235622_total_iter;
            futhark_mc_task_235621_task.sched = STATIC;
            futhark_mc_task_235621_task.nested_fn =
                futhark_mc_segred_nested_task_235627;
            
            int futhark_mc_segred_task_235622_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235621_task);
            
            if (futhark_mc_segred_task_235622_err != 0) {
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t defunc_2_lifted_lambda_res_203657 =
                    btoi_bool_i64(defunc_2_reduce_res_203634);
            bool is_i_203658 = defunc_2_lifted_lambda_res_203657 == (int64_t) 0;
            bool cond_neg_203659 = !is_i_203658;
            int64_t part_res_203660 = btoi_bool_i64(cond_neg_203659);
            int64_t part_res_203661 = btoi_bool_i64(is_i_203658);
            
            x_221245 = x_221245;
            y_221246 = part_res_203661;
            
            int64_t zz_221247 = x_221245 + y_221246;
            
            ((int64_t *) mem_217406.mem)[gtid_206951] = zz_221247;
            x_221245 = zz_221247;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_235620_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_235620_end -
                 futhark_mc_scan_stage_3_parloop_235620_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_235620_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_235620_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_235620_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_235575(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206950 = tid;
    int num_tasks_221151 = info.nsubtasks;
    struct futhark_mc_task_235574 *futhark_mc_task_235574 =
                                  (struct futhark_mc_task_235574 *) args;
    struct futhark_context *ctx = futhark_mc_task_235574->ctx;
    uint64_t futhark_mc_segscan_task_235575_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_235575_start = get_wall_time();
    
    int64_t m_203571 = futhark_mc_task_235574->free_m_203571;
    int64_t n_203572 = futhark_mc_task_235574->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235574->free_n_p_203574;
    int64_t defunc_0_f_res_203592 =
            futhark_mc_task_235574->free_defunc_0_f_res_203592;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235574->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    int64_t bytes_217388 = futhark_mc_task_235574->free_bytes_217388;
    struct memblock mem_217406 = {.desc ="mem_217406", .mem =
                                  futhark_mc_task_235574->free_mem_217406,
                                  .size =0, .references =NULL};
    struct memblock mem_217409 = {.desc ="mem_217409", .mem =
                                  futhark_mc_task_235574->free_mem_217409,
                                  .size =0, .references =NULL};
    struct memblock mem_217411 = {.desc ="mem_217411", .mem =
                                  futhark_mc_task_235574->free_mem_217411,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_221200_cached_sizze_235576 = 0;
    unsigned char *scan_stage_2_accum_mem_221200 = NULL;
    int64_t iter_221152;
    struct futhark_mc_scan_stage_1_parloop_struct_235577
    futhark_mc_scan_stage_1_parloop_struct_235577;
    
    futhark_mc_scan_stage_1_parloop_struct_235577.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_235577.free_n_203572 = n_203572;
    futhark_mc_scan_stage_1_parloop_struct_235577.free_n_p_203574 = n_p_203574;
    futhark_mc_scan_stage_1_parloop_struct_235577.free_defunc_0_f_res_203592 =
        defunc_0_f_res_203592;
    futhark_mc_scan_stage_1_parloop_struct_235577.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_scan_stage_1_parloop_struct_235577.free_bytes_217388 =
        bytes_217388;
    futhark_mc_scan_stage_1_parloop_struct_235577.free_mem_217406 =
        mem_217406.mem;
    futhark_mc_scan_stage_1_parloop_struct_235577.free_mem_217409 =
        mem_217409.mem;
    futhark_mc_scan_stage_1_parloop_struct_235577.free_mem_217411 =
        mem_217411.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_235578_task;
    
    futhark_mc_scan_stage_1_parloop_235578_task.name =
        "futhark_mc_scan_stage_1_parloop_235578";
    futhark_mc_scan_stage_1_parloop_235578_task.fn =
        futhark_mc_scan_stage_1_parloop_235578;
    futhark_mc_scan_stage_1_parloop_235578_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_235577;
    futhark_mc_scan_stage_1_parloop_235578_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_235578_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_235578_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235578_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_235578_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_235578_task);
    
    if (futhark_mc_scan_stage_1_parloop_235578_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235578_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235578_total_end -
                 futhark_mc_scan_stage_1_parloop_235578_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235578_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235578_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235578_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_221151)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_221195;
        int64_t y_221196;
        int64_t offset_221198 = (int64_t) 0;
        int64_t offset_index_221199 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_221200_cached_sizze_235576 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_221200 =
                realloc(scan_stage_2_accum_mem_221200, (int64_t) 8);
            scan_stage_2_accum_mem_221200_cached_sizze_235576 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_221200)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_221202 = 0; i_221202 < num_tasks_221151 - 1;
             i_221202++) {
            offset_221198 = squot64(m_203571, sext_i32_i64(num_tasks_221151));
            if (slt64(sext_i32_i64(i_221202), srem64(m_203571,
                                                     sext_i32_i64(num_tasks_221151)))) {
                offset_221198 += (int64_t) 1;
            }
            offset_index_221199 += offset_221198;
            
            int64_t gtid_206951 = offset_index_221199;
            bool defunc_2_reduce_res_203634;
            int64_t flat_tid_206952 = (int64_t) 0;
            int32_t num_tasks_221203;
            
            defunc_2_reduce_res_203634 = 0;
            
            int64_t flat_tid_206960 = (int64_t) 0;
            struct futhark_mc_task_235599 futhark_mc_task_235599;
            
            futhark_mc_task_235599.ctx = ctx;
            futhark_mc_task_235599.free_n_203572 = n_203572;
            futhark_mc_task_235599.free_n_p_203574 = n_p_203574;
            futhark_mc_task_235599.free_defunc_0_f_res_203592 =
                defunc_0_f_res_203592;
            futhark_mc_task_235599.free_gtid_206951 = gtid_206951;
            futhark_mc_task_235599.free_Y_mem_217387 = Y_mem_217387.mem;
            futhark_mc_task_235599.free_bytes_217388 = bytes_217388;
            futhark_mc_task_235599.retval_defunc_2_reduce_res_203634 =
                &defunc_2_reduce_res_203634;
            
            struct scheduler_segop futhark_mc_task_235599_task;
            
            futhark_mc_task_235599_task.args = &futhark_mc_task_235599;
            futhark_mc_task_235599_task.top_level_fn =
                futhark_mc_segred_task_235600;
            futhark_mc_task_235599_task.name = "futhark_mc_segred_task_235600";
            futhark_mc_task_235599_task.iterations = n_p_203574;
            futhark_mc_task_235599_task.task_time =
                &ctx->futhark_mc_segred_task_235600_total_time;
            futhark_mc_task_235599_task.task_iter =
                &ctx->futhark_mc_segred_task_235600_total_iter;
            futhark_mc_task_235599_task.sched = STATIC;
            futhark_mc_task_235599_task.nested_fn =
                futhark_mc_segred_nested_task_235605;
            
            int futhark_mc_segred_task_235600_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235599_task);
            
            if (futhark_mc_segred_task_235600_err != 0) {
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t defunc_2_lifted_lambda_res_203657 =
                    btoi_bool_i64(defunc_2_reduce_res_203634);
            bool is_i_203658 = defunc_2_lifted_lambda_res_203657 == (int64_t) 0;
            bool cond_neg_203659 = !is_i_203658;
            int64_t part_res_203660 = btoi_bool_i64(cond_neg_203659);
            int64_t part_res_203661 = btoi_bool_i64(is_i_203658);
            
            // Read carry in
            {
                x_221195 =
                    ((int64_t *) scan_stage_2_accum_mem_221200)[(int64_t) 0];
            }
            // Read next values
            {
                y_221196 = ((int64_t *) mem_217406.mem)[offset_index_221199 -
                                                        (int64_t) 1];
            }
            
            int64_t zz_221197 = x_221195 + y_221196;
            
            ((int64_t *) mem_217406.mem)[offset_index_221199 - (int64_t) 1] =
                zz_221197;
            ((int64_t *) scan_stage_2_accum_mem_221200)[(int64_t) 0] =
                zz_221197;
        }
        
        int64_t iter_221248 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_235619
        futhark_mc_scan_stage_3_parloop_struct_235619;
        
        futhark_mc_scan_stage_3_parloop_struct_235619.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_235619.free_n_203572 = n_203572;
        futhark_mc_scan_stage_3_parloop_struct_235619.free_n_p_203574 =
            n_p_203574;
        futhark_mc_scan_stage_3_parloop_struct_235619.free_defunc_0_f_res_203592 =
            defunc_0_f_res_203592;
        futhark_mc_scan_stage_3_parloop_struct_235619.free_Y_mem_217387 =
            Y_mem_217387.mem;
        futhark_mc_scan_stage_3_parloop_struct_235619.free_bytes_217388 =
            bytes_217388;
        futhark_mc_scan_stage_3_parloop_struct_235619.free_mem_217406 =
            mem_217406.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_235620_task;
        
        futhark_mc_scan_stage_3_parloop_235620_task.name =
            "futhark_mc_scan_stage_3_parloop_235620";
        futhark_mc_scan_stage_3_parloop_235620_task.fn =
            futhark_mc_scan_stage_3_parloop_235620;
        futhark_mc_scan_stage_3_parloop_235620_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_235619;
        futhark_mc_scan_stage_3_parloop_235620_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_235620_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_235620_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_235620_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_235620_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_235620_task);
        
        if (futhark_mc_scan_stage_3_parloop_235620_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_235620_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_235620_total_end -
                     futhark_mc_scan_stage_3_parloop_235620_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235620_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235620_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235620_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_221200);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_235575_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_235575_end -
                 futhark_mc_segscan_task_235575_start;
        
        ctx->futhark_mc_segscan_task_235575_runs[tid]++;
        ctx->futhark_mc_segscan_task_235575_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_235575_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235641 {
    struct futhark_context *ctx;
    int64_t free_m_203571;
    int64_t free_n_203572;
    unsigned char *free_Y_mem_217387;
    unsigned char *free_mem_217406;
    unsigned char *free_mem_217409;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_217418;
};
struct futhark_mc_segmap_parloop_struct_235643 {
    struct futhark_context *ctx;
    int64_t free_m_203571;
    int64_t free_n_203572;
    unsigned char *free_Y_mem_217387;
    unsigned char *free_mem_217406;
    unsigned char *free_mem_217409;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_217418;
};
static int futhark_mc_segmap_parloop_235644(void *args, int64_t start,
                                            int64_t end, int flat_tid_206988,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235643
    *futhark_mc_segmap_parloop_struct_235643 =
    (struct futhark_mc_segmap_parloop_struct_235643 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235643->ctx;
    uint64_t futhark_mc_segmap_parloop_235644_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235644_start = get_wall_time();
    
    int64_t m_203571 = futhark_mc_segmap_parloop_struct_235643->free_m_203571;
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235643->free_n_203572;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_segmap_parloop_struct_235643->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    struct memblock mem_217406 = {.desc ="mem_217406", .mem =
                                  futhark_mc_segmap_parloop_struct_235643->free_mem_217406,
                                  .size =0, .references =NULL};
    struct memblock mem_217409 = {.desc ="mem_217409", .mem =
                                  futhark_mc_segmap_parloop_struct_235643->free_mem_217409,
                                  .size =0, .references =NULL};
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235643->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_217418 = {.desc ="mem_217418", .mem =
                                  futhark_mc_segmap_parloop_struct_235643->free_mem_217418,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221292 = start;
    
    for (; iter_221292 < end; iter_221292++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221293 = m_203571;
        int64_t gtid_206989 = iter_221292;
        int64_t remnant_221294 = iter_221292 - gtid_206989;
        int64_t c_203673;
        
        c_203673 = ((int64_t *) mem_217409.mem)[gtid_206989];
        
        int64_t offset_203674;
        
        offset_203674 = ((int64_t *) mem_217406.mem)[gtid_206989];
        
        bool is_this_one_203678 = c_203673 == (int64_t) 0;
        int64_t this_offset_203679 = (int64_t) -1 + offset_203674;
        int64_t total_res_203680;
        
        if (is_this_one_203678) {
            total_res_203680 = this_offset_203679;
        } else {
            total_res_203680 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, total_res_203680) && slt64(total_res_203680,
                                                          m_203571)) {
            if (n_203572 * (int64_t) 8 > 0)
                memmove(mem_217415.mem + total_res_203680 * n_203572 *
                        (int64_t) 8, Y_mem_217387.mem + gtid_206989 * n_203572 *
                        (int64_t) 8, n_203572 * (int64_t) 8);
        }
        if (sle64((int64_t) 0, total_res_203680) && slt64(total_res_203680,
                                                          m_203571)) {
            ((int64_t *) mem_217418.mem)[total_res_203680] = gtid_206989;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235644_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235644_end -
                 futhark_mc_segmap_parloop_235644_start;
        
        ctx->futhark_mc_segmap_parloop_235644_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235644_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235644_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235642(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206988 = tid;
    int num_tasks_221291 = info.nsubtasks;
    struct futhark_mc_task_235641 *futhark_mc_task_235641 =
                                  (struct futhark_mc_task_235641 *) args;
    struct futhark_context *ctx = futhark_mc_task_235641->ctx;
    uint64_t futhark_mc_segmap_task_235642_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235642_start = get_wall_time();
    
    int64_t m_203571 = futhark_mc_task_235641->free_m_203571;
    int64_t n_203572 = futhark_mc_task_235641->free_n_203572;
    struct memblock Y_mem_217387 = {.desc ="Y_mem_217387", .mem =
                                    futhark_mc_task_235641->free_Y_mem_217387,
                                    .size =0, .references =NULL};
    struct memblock mem_217406 = {.desc ="mem_217406", .mem =
                                  futhark_mc_task_235641->free_mem_217406,
                                  .size =0, .references =NULL};
    struct memblock mem_217409 = {.desc ="mem_217409", .mem =
                                  futhark_mc_task_235641->free_mem_217409,
                                  .size =0, .references =NULL};
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235641->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_217418 = {.desc ="mem_217418", .mem =
                                  futhark_mc_task_235641->free_mem_217418,
                                  .size =0, .references =NULL};
    int64_t iter_221292;
    struct futhark_mc_segmap_parloop_struct_235643
    futhark_mc_segmap_parloop_struct_235643;
    
    futhark_mc_segmap_parloop_struct_235643.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235643.free_m_203571 = m_203571;
    futhark_mc_segmap_parloop_struct_235643.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235643.free_Y_mem_217387 =
        Y_mem_217387.mem;
    futhark_mc_segmap_parloop_struct_235643.free_mem_217406 = mem_217406.mem;
    futhark_mc_segmap_parloop_struct_235643.free_mem_217409 = mem_217409.mem;
    futhark_mc_segmap_parloop_struct_235643.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235643.free_mem_217418 = mem_217418.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235644_task;
    
    futhark_mc_segmap_parloop_235644_task.name =
        "futhark_mc_segmap_parloop_235644";
    futhark_mc_segmap_parloop_235644_task.fn = futhark_mc_segmap_parloop_235644;
    futhark_mc_segmap_parloop_235644_task.args =
        &futhark_mc_segmap_parloop_struct_235643;
    futhark_mc_segmap_parloop_235644_task.iterations = iterations;
    futhark_mc_segmap_parloop_235644_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235644_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235644_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235644_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235644_task);
    
    if (futhark_mc_segmap_parloop_235644_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235644_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235644_total_end -
                 futhark_mc_segmap_parloop_235644_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235644_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235644_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235644_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235642_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235642_end -
                 futhark_mc_segmap_task_235642_start;
        
        ctx->futhark_mc_segmap_task_235642_runs[tid]++;
        ctx->futhark_mc_segmap_task_235642_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235642_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235645 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
};
struct futhark_mc_segmap_parloop_struct_235647 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
};
static int futhark_mc_segmap_parloop_235648(void *args, int64_t start,
                                            int64_t end, int flat_tid_206990,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235647
    *futhark_mc_segmap_parloop_struct_235647 =
    (struct futhark_mc_segmap_parloop_struct_235647 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235647->ctx;
    uint64_t futhark_mc_segmap_parloop_235648_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235648_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235647->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235647->free_partition_sizze_203667;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235647->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235647->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_235647->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235647->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_235647->free_mem_217461,
                                  .size =0, .references =NULL};
    size_t mem_217427_cached_sizze_235649 = 0;
    unsigned char *mem_217427 = NULL;
    size_t mem_217442_cached_sizze_235650 = 0;
    unsigned char *mem_217442 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221296 = start;
    
    if (mem_217427_cached_sizze_235649 < (size_t) bytes_217420) {
        mem_217427 = realloc(mem_217427, bytes_217420);
        mem_217427_cached_sizze_235649 = bytes_217420;
    }
    if (mem_217442_cached_sizze_235650 < (size_t) bytes_217420) {
        mem_217442 = realloc(mem_217442, bytes_217420);
        mem_217442_cached_sizze_235650 = bytes_217420;
    }
    for (; iter_221296 < end; iter_221296++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221315 = partition_sizze_203667;
        int64_t gtid_206991 = iter_221296;
        int64_t remnant_221316 = iter_221296 - gtid_206991;
        int64_t discard_216132;
        int64_t scanacc_221298 = (int64_t) 0;
        
        for (int64_t i_221297 = 0; i_221297 < n_203572; i_221297++) {
            double x_221300;
            
            x_221300 = ((double *) mem_217415.mem)[gtid_206991 * n_203572 +
                                                   i_221297];
            
            bool isnan_res_221301;
            
            isnan_res_221301 = futrts_isnan64(x_221300);
            
            bool defunc_0_p_res_221302 = !isnan_res_221301;
            int64_t defunc_0_f_res_221303 =
                    btoi_bool_i64(defunc_0_p_res_221302);
            int64_t defunc_1_op_res_221304 = add64(defunc_0_f_res_221303,
                                                   scanacc_221298);
            
            ((int64_t *) mem_217427)[i_221297] = defunc_1_op_res_221304;
            
            int64_t scanacc_tmp_221317 = defunc_1_op_res_221304;
            
            scanacc_221298 = scanacc_tmp_221317;
        }
        discard_216132 = scanacc_221298;
        
        int64_t last_res_203776;
        
        last_res_203776 = ((int64_t *) mem_217427)[i_203760];
        for (int64_t i_221319 = 0; i_221319 < n_203572; i_221319++) {
            ((int64_t *) mem_217442)[i_221319] = (int64_t) -1;
        }
        for (int64_t write_iter_221306 = 0; write_iter_221306 < n_203572;
             write_iter_221306++) {
            double write_iv_221308;
            
            write_iv_221308 = ((double *) mem_217415.mem)[gtid_206991 *
                                                          n_203572 +
                                                          write_iter_221306];
            
            bool isnan_res_221309;
            
            isnan_res_221309 = futrts_isnan64(write_iv_221308);
            
            bool defunc_0_p_res_221310 = !isnan_res_221309;
            int64_t defunc_1_f_res_221311;
            
            if (defunc_0_p_res_221310) {
                int64_t write_iv_221312;
                
                write_iv_221312 = ((int64_t *) mem_217427)[write_iter_221306];
                
                int64_t defunc_1_f_res_t_res_221313 = sub64(write_iv_221312,
                                                            (int64_t) 1);
                
                defunc_1_f_res_221311 = defunc_1_f_res_t_res_221313;
            } else {
                defunc_1_f_res_221311 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_221311) &&
                slt64(defunc_1_f_res_221311, n_203572)) {
                ((int64_t *) mem_217442)[defunc_1_f_res_221311] =
                    write_iter_221306;
            }
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_217458.mem + gtid_206991 * n_203572 * (int64_t) 8,
                    mem_217442 + (int64_t) 0, n_203572 * (int64_t) 8);
        ((int64_t *) mem_217461.mem)[gtid_206991] = last_res_203776;
    }
    
  cleanup:
    { }
    free(mem_217427);
    free(mem_217442);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235648_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235648_end -
                 futhark_mc_segmap_parloop_235648_start;
        
        ctx->futhark_mc_segmap_parloop_235648_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235648_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235648_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235646(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206990 = tid;
    int num_tasks_221295 = info.nsubtasks;
    struct futhark_mc_task_235645 *futhark_mc_task_235645 =
                                  (struct futhark_mc_task_235645 *) args;
    struct futhark_context *ctx = futhark_mc_task_235645->ctx;
    uint64_t futhark_mc_segmap_task_235646_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235646_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235645->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235645->free_partition_sizze_203667;
    int64_t i_203760 = futhark_mc_task_235645->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235645->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_235645->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235645->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_235645->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t iter_221296;
    struct futhark_mc_segmap_parloop_struct_235647
    futhark_mc_segmap_parloop_struct_235647;
    
    futhark_mc_segmap_parloop_struct_235647.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235647.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235647.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235647.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235647.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235647.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_235647.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235647.free_mem_217461 = mem_217461.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235648_task;
    
    futhark_mc_segmap_parloop_235648_task.name =
        "futhark_mc_segmap_parloop_235648";
    futhark_mc_segmap_parloop_235648_task.fn = futhark_mc_segmap_parloop_235648;
    futhark_mc_segmap_parloop_235648_task.args =
        &futhark_mc_segmap_parloop_struct_235647;
    futhark_mc_segmap_parloop_235648_task.iterations = iterations;
    futhark_mc_segmap_parloop_235648_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235648_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235648_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235648_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235648_task);
    
    if (futhark_mc_segmap_parloop_235648_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235648_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235648_total_end -
                 futhark_mc_segmap_parloop_235648_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235648_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235648_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235648_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235646_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235646_end -
                 futhark_mc_segmap_task_235646_start;
        
        ctx->futhark_mc_segmap_task_235646_runs[tid]++;
        ctx->futhark_mc_segmap_task_235646_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235646_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235652 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
};
struct futhark_mc_task_235656 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_206999;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_217421;
};
struct futhark_mc_scan_stage_1_parloop_struct_235659 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_206999;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_217421;
};
static int futhark_mc_scan_stage_1_parloop_235660(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_221322, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_235659
    *futhark_mc_scan_stage_1_parloop_struct_235659 =
    (struct futhark_mc_scan_stage_1_parloop_struct_235659 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_235659->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_235660_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235660_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_scan_stage_1_parloop_struct_235659->free_n_203572;
    int64_t gtid_206999 =
            futhark_mc_scan_stage_1_parloop_struct_235659->free_gtid_206999;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235659->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_217421 = {.desc ="mem_217421", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235659->free_mem_217421,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221342 = start;
    int64_t x_221324;
    int64_t x_221325;
    
    x_221324 = (int64_t) 0;
    for (; iter_221342 < end; iter_221342++) {
        int64_t gtid_221323 = iter_221342;
        
        // stage 1 scan body
        {
            double x_221327;
            
            x_221327 = ((double *) mem_217415.mem)[gtid_206999 * n_203572 +
                                                   gtid_221323];
            
            bool isnan_res_221328;
            
            isnan_res_221328 = futrts_isnan64(x_221327);
            
            bool defunc_0_p_res_221329 = !isnan_res_221328;
            int64_t defunc_0_f_res_221330 =
                    btoi_bool_i64(defunc_0_p_res_221329);
            
            // write mapped values results to memory
            { }
            x_221324 = x_221324;
            // Read next values
            {
                x_221325 = defunc_0_f_res_221330;
            }
            
            int64_t defunc_1_op_res_221326 = add64(x_221324, x_221325);
            
            ((int64_t *) mem_217421.mem)[gtid_221323] = defunc_1_op_res_221326;
            x_221324 = defunc_1_op_res_221326;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235660_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235660_end -
                 futhark_mc_scan_stage_1_parloop_235660_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_235660_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_235660_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_235660_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_235661 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_206999;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_217421;
};
static int futhark_mc_scan_stage_3_parloop_235662(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_221322, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_235661
    *futhark_mc_scan_stage_3_parloop_struct_235661 =
    (struct futhark_mc_scan_stage_3_parloop_struct_235661 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_235661->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_235662_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_235662_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_scan_stage_3_parloop_struct_235661->free_n_203572;
    int64_t gtid_206999 =
            futhark_mc_scan_stage_3_parloop_struct_235661->free_gtid_206999;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235661->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_217421 = {.desc ="mem_217421", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235661->free_mem_217421,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221354 = start;
    int64_t x_221351;
    int64_t x_221352;
    
    if (iter_221354 == (int64_t) 0) {
        x_221351 = (int64_t) 0;
    } else {
        x_221351 = ((int64_t *) mem_217421.mem)[iter_221354 - (int64_t) 1];
    }
    for (; iter_221354 < end; iter_221354++) {
        int64_t gtid_221323 = iter_221354;
        
        // stage 3 scan body
        {
            double x_221327;
            
            x_221327 = ((double *) mem_217415.mem)[gtid_206999 * n_203572 +
                                                   gtid_221323];
            
            bool isnan_res_221328;
            
            isnan_res_221328 = futrts_isnan64(x_221327);
            
            bool defunc_0_p_res_221329 = !isnan_res_221328;
            int64_t defunc_0_f_res_221330 =
                    btoi_bool_i64(defunc_0_p_res_221329);
            
            x_221351 = x_221351;
            x_221352 = defunc_0_f_res_221330;
            
            int64_t defunc_1_op_res_221353 = add64(x_221351, x_221352);
            
            ((int64_t *) mem_217421.mem)[gtid_221323] = defunc_1_op_res_221353;
            x_221351 = defunc_1_op_res_221353;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_235662_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_235662_end -
                 futhark_mc_scan_stage_3_parloop_235662_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_235662_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_235662_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_235662_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_235657(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221322 = tid;
    int num_tasks_221341 = info.nsubtasks;
    struct futhark_mc_task_235656 *futhark_mc_task_235656 =
                                  (struct futhark_mc_task_235656 *) args;
    struct futhark_context *ctx = futhark_mc_task_235656->ctx;
    uint64_t futhark_mc_segscan_task_235657_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_235657_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235656->free_n_203572;
    int64_t gtid_206999 = futhark_mc_task_235656->free_gtid_206999;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235656->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_217421 = {.desc ="mem_217421", .mem =
                                  futhark_mc_task_235656->free_mem_217421,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_221348_cached_sizze_235658 = 0;
    unsigned char *scan_stage_2_accum_mem_221348 = NULL;
    int64_t iter_221342;
    struct futhark_mc_scan_stage_1_parloop_struct_235659
    futhark_mc_scan_stage_1_parloop_struct_235659;
    
    futhark_mc_scan_stage_1_parloop_struct_235659.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_235659.free_n_203572 = n_203572;
    futhark_mc_scan_stage_1_parloop_struct_235659.free_gtid_206999 =
        gtid_206999;
    futhark_mc_scan_stage_1_parloop_struct_235659.free_mem_217415 =
        mem_217415.mem;
    futhark_mc_scan_stage_1_parloop_struct_235659.free_mem_217421 =
        mem_217421.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_235660_task;
    
    futhark_mc_scan_stage_1_parloop_235660_task.name =
        "futhark_mc_scan_stage_1_parloop_235660";
    futhark_mc_scan_stage_1_parloop_235660_task.fn =
        futhark_mc_scan_stage_1_parloop_235660;
    futhark_mc_scan_stage_1_parloop_235660_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_235659;
    futhark_mc_scan_stage_1_parloop_235660_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_235660_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_235660_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235660_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_235660_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_235660_task);
    
    if (futhark_mc_scan_stage_1_parloop_235660_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235660_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235660_total_end -
                 futhark_mc_scan_stage_1_parloop_235660_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235660_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235660_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235660_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_221341)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_221343;
        int64_t x_221344;
        int64_t offset_221346 = (int64_t) 0;
        int64_t offset_index_221347 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_221348_cached_sizze_235658 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_221348 =
                realloc(scan_stage_2_accum_mem_221348, (int64_t) 8);
            scan_stage_2_accum_mem_221348_cached_sizze_235658 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_221348)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_221350 = 0; i_221350 < num_tasks_221341 - 1;
             i_221350++) {
            offset_221346 = squot64(n_203572, sext_i32_i64(num_tasks_221341));
            if (slt64(sext_i32_i64(i_221350), srem64(n_203572,
                                                     sext_i32_i64(num_tasks_221341)))) {
                offset_221346 += (int64_t) 1;
            }
            offset_index_221347 += offset_221346;
            
            int64_t gtid_221323 = offset_index_221347;
            double x_221327;
            
            x_221327 = ((double *) mem_217415.mem)[gtid_206999 * n_203572 +
                                                   gtid_221323];
            
            bool isnan_res_221328;
            
            isnan_res_221328 = futrts_isnan64(x_221327);
            
            bool defunc_0_p_res_221329 = !isnan_res_221328;
            int64_t defunc_0_f_res_221330 =
                    btoi_bool_i64(defunc_0_p_res_221329);
            
            // Read carry in
            {
                x_221343 =
                    ((int64_t *) scan_stage_2_accum_mem_221348)[(int64_t) 0];
            }
            // Read next values
            {
                x_221344 = ((int64_t *) mem_217421.mem)[offset_index_221347 -
                                                        (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_221345 = add64(x_221343, x_221344);
            
            ((int64_t *) mem_217421.mem)[offset_index_221347 - (int64_t) 1] =
                defunc_1_op_res_221345;
            ((int64_t *) scan_stage_2_accum_mem_221348)[(int64_t) 0] =
                defunc_1_op_res_221345;
        }
        
        int64_t iter_221354 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_235661
        futhark_mc_scan_stage_3_parloop_struct_235661;
        
        futhark_mc_scan_stage_3_parloop_struct_235661.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_235661.free_n_203572 = n_203572;
        futhark_mc_scan_stage_3_parloop_struct_235661.free_gtid_206999 =
            gtid_206999;
        futhark_mc_scan_stage_3_parloop_struct_235661.free_mem_217415 =
            mem_217415.mem;
        futhark_mc_scan_stage_3_parloop_struct_235661.free_mem_217421 =
            mem_217421.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_235662_task;
        
        futhark_mc_scan_stage_3_parloop_235662_task.name =
            "futhark_mc_scan_stage_3_parloop_235662";
        futhark_mc_scan_stage_3_parloop_235662_task.fn =
            futhark_mc_scan_stage_3_parloop_235662;
        futhark_mc_scan_stage_3_parloop_235662_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_235661;
        futhark_mc_scan_stage_3_parloop_235662_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_235662_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_235662_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_235662_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_235662_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_235662_task);
        
        if (futhark_mc_scan_stage_3_parloop_235662_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_235662_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_235662_total_end -
                     futhark_mc_scan_stage_3_parloop_235662_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235662_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235662_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235662_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_221348);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_235657_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_235657_end -
                 futhark_mc_segscan_task_235657_start;
        
        ctx->futhark_mc_segscan_task_235657_runs[tid]++;
        ctx->futhark_mc_segscan_task_235657_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_235657_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235663 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_206999;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_217421;
    unsigned char *free_mem_217424;
};
struct futhark_mc_segmap_parloop_struct_235665 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_206999;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_217421;
    unsigned char *free_mem_217424;
};
static int futhark_mc_segmap_parloop_235666(void *args, int64_t start,
                                            int64_t end, int flat_tid_221331,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235665
    *futhark_mc_segmap_parloop_struct_235665 =
    (struct futhark_mc_segmap_parloop_struct_235665 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235665->ctx;
    uint64_t futhark_mc_segmap_parloop_235666_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235666_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235665->free_n_203572;
    int64_t gtid_206999 =
            futhark_mc_segmap_parloop_struct_235665->free_gtid_206999;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235665->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_217421 = {.desc ="mem_217421", .mem =
                                  futhark_mc_segmap_parloop_struct_235665->free_mem_217421,
                                  .size =0, .references =NULL};
    struct memblock mem_217424 = {.desc ="mem_217424", .mem =
                                  futhark_mc_segmap_parloop_struct_235665->free_mem_217424,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221357 = start;
    
    for (; iter_221357 < end; iter_221357++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221360 = n_203572;
        int64_t gtid_221332 = iter_221357;
        int64_t remnant_221361 = iter_221357 - gtid_221332;
        double x_221333;
        
        x_221333 = ((double *) mem_217415.mem)[gtid_206999 * n_203572 +
                                               gtid_221332];
        
        bool isnan_res_221334;
        
        isnan_res_221334 = futrts_isnan64(x_221333);
        
        bool defunc_0_p_res_221335 = !isnan_res_221334;
        int64_t defunc_1_f_res_221336;
        
        if (defunc_0_p_res_221335) {
            int64_t x_221358;
            
            x_221358 = ((int64_t *) mem_217421.mem)[gtid_221332];
            
            int64_t defunc_1_f_res_t_res_221359 = sub64(x_221358, (int64_t) 1);
            
            defunc_1_f_res_221336 = defunc_1_f_res_t_res_221359;
        } else {
            defunc_1_f_res_221336 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_221336) &&
            slt64(defunc_1_f_res_221336, n_203572)) {
            ((int64_t *) mem_217424.mem)[defunc_1_f_res_221336] = gtid_221332;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235666_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235666_end -
                 futhark_mc_segmap_parloop_235666_start;
        
        ctx->futhark_mc_segmap_parloop_235666_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235666_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235666_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235664(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221331 = tid;
    int num_tasks_221356 = info.nsubtasks;
    struct futhark_mc_task_235663 *futhark_mc_task_235663 =
                                  (struct futhark_mc_task_235663 *) args;
    struct futhark_context *ctx = futhark_mc_task_235663->ctx;
    uint64_t futhark_mc_segmap_task_235664_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235664_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235663->free_n_203572;
    int64_t gtid_206999 = futhark_mc_task_235663->free_gtid_206999;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235663->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_217421 = {.desc ="mem_217421", .mem =
                                  futhark_mc_task_235663->free_mem_217421,
                                  .size =0, .references =NULL};
    struct memblock mem_217424 = {.desc ="mem_217424", .mem =
                                  futhark_mc_task_235663->free_mem_217424,
                                  .size =0, .references =NULL};
    int64_t iter_221357;
    struct futhark_mc_segmap_parloop_struct_235665
    futhark_mc_segmap_parloop_struct_235665;
    
    futhark_mc_segmap_parloop_struct_235665.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235665.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235665.free_gtid_206999 = gtid_206999;
    futhark_mc_segmap_parloop_struct_235665.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235665.free_mem_217421 = mem_217421.mem;
    futhark_mc_segmap_parloop_struct_235665.free_mem_217424 = mem_217424.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235666_task;
    
    futhark_mc_segmap_parloop_235666_task.name =
        "futhark_mc_segmap_parloop_235666";
    futhark_mc_segmap_parloop_235666_task.fn = futhark_mc_segmap_parloop_235666;
    futhark_mc_segmap_parloop_235666_task.args =
        &futhark_mc_segmap_parloop_struct_235665;
    futhark_mc_segmap_parloop_235666_task.iterations = iterations;
    futhark_mc_segmap_parloop_235666_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235666_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235666_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235666_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235666_task);
    
    if (futhark_mc_segmap_parloop_235666_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235666_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235666_total_end -
                 futhark_mc_segmap_parloop_235666_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235666_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235666_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235666_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235664_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235664_end -
                 futhark_mc_segmap_task_235664_start;
        
        ctx->futhark_mc_segmap_task_235664_runs[tid]++;
        ctx->futhark_mc_segmap_task_235664_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235664_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235653(void *args, int64_t start,
                                            int64_t end, int flat_tid_206998,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235652
    *futhark_mc_segmap_parloop_struct_235652 =
    (struct futhark_mc_segmap_parloop_struct_235652 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235652->ctx;
    uint64_t futhark_mc_segmap_parloop_235653_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235653_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235652->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235652->free_partition_sizze_203667;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235652->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235652->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_235652->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235652->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_235652->free_mem_217461,
                                  .size =0, .references =NULL};
    size_t mem_217421_cached_sizze_235654 = 0;
    unsigned char *mem_217421 = NULL;
    size_t mem_217424_cached_sizze_235655 = 0;
    unsigned char *mem_217424 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221321 = start;
    
    if (mem_217421_cached_sizze_235654 < (size_t) bytes_217420) {
        mem_217421 = realloc(mem_217421, bytes_217420);
        mem_217421_cached_sizze_235654 = bytes_217420;
    }
    if (mem_217424_cached_sizze_235655 < (size_t) bytes_217420) {
        mem_217424 = realloc(mem_217424, bytes_217420);
        mem_217424_cached_sizze_235655 = bytes_217420;
    }
    for (; iter_221321 < end; iter_221321++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221339 = partition_sizze_203667;
        int64_t gtid_206999 = iter_221321;
        int64_t remnant_221340 = iter_221321 - gtid_206999;
        int64_t flat_tid_221322 = (int64_t) 0;
        int32_t num_tasks_221341;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_235656 futhark_mc_task_235656;
        
        futhark_mc_task_235656.ctx = ctx;
        futhark_mc_task_235656.free_n_203572 = n_203572;
        futhark_mc_task_235656.free_gtid_206999 = gtid_206999;
        futhark_mc_task_235656.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_235656.free_mem_217421 = mem_217421;
        
        struct scheduler_segop futhark_mc_task_235656_task;
        
        futhark_mc_task_235656_task.args = &futhark_mc_task_235656;
        futhark_mc_task_235656_task.top_level_fn =
            futhark_mc_segscan_task_235657;
        futhark_mc_task_235656_task.name = "futhark_mc_segscan_task_235657";
        futhark_mc_task_235656_task.iterations = n_203572;
        futhark_mc_task_235656_task.task_time =
            &ctx->futhark_mc_segscan_task_235657_total_time;
        futhark_mc_task_235656_task.task_iter =
            &ctx->futhark_mc_segscan_task_235657_total_iter;
        futhark_mc_task_235656_task.sched = STATIC;
        futhark_mc_task_235656_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_235657_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235656_task);
        
        if (futhark_mc_segscan_task_235657_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_207011;
        
        last_res_207011 = ((int64_t *) mem_217421)[i_203760];
        for (int64_t i_221355 = 0; i_221355 < n_203572; i_221355++) {
            ((int64_t *) mem_217424)[i_221355] = (int64_t) -1;
        }
        
        int64_t flat_tid_221331 = (int64_t) 0;
        int32_t num_tasks_221356;
        struct futhark_mc_task_235663 futhark_mc_task_235663;
        
        futhark_mc_task_235663.ctx = ctx;
        futhark_mc_task_235663.free_n_203572 = n_203572;
        futhark_mc_task_235663.free_gtid_206999 = gtid_206999;
        futhark_mc_task_235663.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_235663.free_mem_217421 = mem_217421;
        futhark_mc_task_235663.free_mem_217424 = mem_217424;
        
        struct scheduler_segop futhark_mc_task_235663_task;
        
        futhark_mc_task_235663_task.args = &futhark_mc_task_235663;
        futhark_mc_task_235663_task.top_level_fn =
            futhark_mc_segmap_task_235664;
        futhark_mc_task_235663_task.name = "futhark_mc_segmap_task_235664";
        futhark_mc_task_235663_task.iterations = n_203572;
        futhark_mc_task_235663_task.task_time =
            &ctx->futhark_mc_segmap_task_235664_total_time;
        futhark_mc_task_235663_task.task_iter =
            &ctx->futhark_mc_segmap_task_235664_total_iter;
        futhark_mc_task_235663_task.sched = STATIC;
        futhark_mc_task_235663_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235664_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235663_task);
        
        if (futhark_mc_segmap_task_235664_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_217458.mem + gtid_206999 * n_203572 * (int64_t) 8,
                    mem_217424 + (int64_t) 0, n_203572 * (int64_t) 8);
        ((int64_t *) mem_217461.mem)[gtid_206999] = last_res_207011;
    }
    
  cleanup:
    { }
    free(mem_217421);
    free(mem_217424);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235653_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235653_end -
                 futhark_mc_segmap_parloop_235653_start;
        
        ctx->futhark_mc_segmap_parloop_235653_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235653_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235653_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235651(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_206998 = tid;
    int num_tasks_221295 = info.nsubtasks;
    struct futhark_mc_task_235645 *futhark_mc_task_235645 =
                                  (struct futhark_mc_task_235645 *) args;
    struct futhark_context *ctx = futhark_mc_task_235645->ctx;
    uint64_t futhark_mc_segmap_nested_task_235651_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235651_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235645->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235645->free_partition_sizze_203667;
    int64_t i_203760 = futhark_mc_task_235645->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235645->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_235645->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235645->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_235645->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t iter_221321;
    struct futhark_mc_segmap_parloop_struct_235652
    futhark_mc_segmap_parloop_struct_235652;
    
    futhark_mc_segmap_parloop_struct_235652.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235652.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235652.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235652.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235652.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235652.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_235652.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235652.free_mem_217461 = mem_217461.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235653_task;
    
    futhark_mc_segmap_parloop_235653_task.name =
        "futhark_mc_segmap_parloop_235653";
    futhark_mc_segmap_parloop_235653_task.fn = futhark_mc_segmap_parloop_235653;
    futhark_mc_segmap_parloop_235653_task.args =
        &futhark_mc_segmap_parloop_struct_235652;
    futhark_mc_segmap_parloop_235653_task.iterations = iterations;
    futhark_mc_segmap_parloop_235653_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235653_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235653_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235653_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235653_task);
    
    if (futhark_mc_segmap_parloop_235653_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235653_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235653_total_end -
                 futhark_mc_segmap_parloop_235653_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235653_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235653_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235653_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235651_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235651_end -
                 futhark_mc_segmap_nested_task_235651_start;
        
        ctx->futhark_mc_segmap_nested_task_235651_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235651_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235651_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235667 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217463;
    int64_t free_bytes_217482;
    unsigned char *free_mem_217532;
};
struct futhark_mc_segmap_parloop_struct_235669 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217482;
    unsigned char *free_mem_217532;
};
static int futhark_mc_segmap_parloop_235670(void *args, int64_t start,
                                            int64_t end, int flat_tid_207023,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235669
    *futhark_mc_segmap_parloop_struct_235669 =
    (struct futhark_mc_segmap_parloop_struct_235669 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235669->ctx;
    uint64_t futhark_mc_segmap_parloop_235670_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235670_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235669->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235669->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235669->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235669->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235669->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235669->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217482 =
            futhark_mc_segmap_parloop_struct_235669->free_bytes_217482;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_segmap_parloop_struct_235669->free_mem_217532,
                                  .size =0, .references =NULL};
    size_t mem_217487_cached_sizze_235671 = 0;
    unsigned char *mem_217487 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221363 = start;
    
    if (mem_217487_cached_sizze_235671 < (size_t) bytes_217482) {
        mem_217487 = realloc(mem_217487, bytes_217482);
        mem_217487_cached_sizze_235671 = bytes_217482;
    }
    for (; iter_221363 < end; iter_221363++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221379 = partition_sizze_203667;
        int64_t gtid_207024 = iter_221363;
        int64_t remnant_221380 = iter_221363 - gtid_207024;
        
        for (int64_t i_221364 = 0; i_221364 < n_p_203574; i_221364++) {
            for (int64_t i_221367 = 0; i_221367 < defunc_0_f_res_203721;
                 i_221367++) {
                int64_t y_221369 = mul64(n_p_203574, i_221367);
                int64_t new_i_221370 = add64(y_221369, i_221364);
                bool cond_221371 = slt64(i_203760, new_i_221370);
                double defunc_0_f_res_221372;
                
                if (cond_221371) {
                    defunc_0_f_res_221372 = NAN;
                } else {
                    bool x_221373 = sle64((int64_t) 0, new_i_221370);
                    bool y_221374 = slt64(new_i_221370, n_203572);
                    bool bounds_check_221375 = x_221373 && y_221374;
                    bool index_certs_221376;
                    
                    if (!bounds_check_221375) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) new_i_221370,
                                      "] out of bounds for array of shape [",
                                      (long long) n_203572, "].",
                                      "-> #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_221377;
                    
                    defunc_0_f_res_f_res_221377 =
                        ((double *) mem_217415.mem)[gtid_207024 * n_203572 +
                                                    new_i_221370];
                    defunc_0_f_res_221372 = defunc_0_f_res_f_res_221377;
                }
                ((double *) mem_217487)[i_221364 * defunc_0_f_res_203721 +
                                        i_221367] = defunc_0_f_res_221372;
            }
        }
        if (n_p_203574 * defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_217532.mem + gtid_207024 * (defunc_0_f_res_203721 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_217487 + (int64_t) 0, n_p_203574 *
                    defunc_0_f_res_203721 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217487);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235670_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235670_end -
                 futhark_mc_segmap_parloop_235670_start;
        
        ctx->futhark_mc_segmap_parloop_235670_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235670_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235670_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235668(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207023 = tid;
    int num_tasks_221362 = info.nsubtasks;
    struct futhark_mc_task_235667 *futhark_mc_task_235667 =
                                  (struct futhark_mc_task_235667 *) args;
    struct futhark_context *ctx = futhark_mc_task_235667->ctx;
    uint64_t futhark_mc_segmap_task_235668_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235668_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235667->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235667->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235667->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235667->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235667->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235667->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217463 = futhark_mc_task_235667->free_bytes_217463;
    int64_t bytes_217482 = futhark_mc_task_235667->free_bytes_217482;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_task_235667->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t iter_221363;
    struct futhark_mc_segmap_parloop_struct_235669
    futhark_mc_segmap_parloop_struct_235669;
    
    futhark_mc_segmap_parloop_struct_235669.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235669.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235669.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235669.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235669.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235669.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235669.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235669.free_bytes_217482 = bytes_217482;
    futhark_mc_segmap_parloop_struct_235669.free_mem_217532 = mem_217532.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235670_task;
    
    futhark_mc_segmap_parloop_235670_task.name =
        "futhark_mc_segmap_parloop_235670";
    futhark_mc_segmap_parloop_235670_task.fn = futhark_mc_segmap_parloop_235670;
    futhark_mc_segmap_parloop_235670_task.args =
        &futhark_mc_segmap_parloop_struct_235669;
    futhark_mc_segmap_parloop_235670_task.iterations = iterations;
    futhark_mc_segmap_parloop_235670_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235670_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235670_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235670_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235670_task);
    
    if (futhark_mc_segmap_parloop_235670_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235670_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235670_total_end -
                 futhark_mc_segmap_parloop_235670_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235670_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235670_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235670_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235668_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235668_end -
                 futhark_mc_segmap_task_235668_start;
        
        ctx->futhark_mc_segmap_task_235668_runs[tid]++;
        ctx->futhark_mc_segmap_task_235668_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235668_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235673 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217463;
    int64_t free_bytes_217482;
    unsigned char *free_mem_217532;
};
struct futhark_mc_task_235676 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207050;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217483;
};
struct futhark_mc_segmap_parloop_struct_235678 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207050;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217483;
};
static int futhark_mc_segmap_parloop_235679(void *args, int64_t start,
                                            int64_t end, int flat_tid_221399,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235678
    *futhark_mc_segmap_parloop_struct_235678 =
    (struct futhark_mc_segmap_parloop_struct_235678 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235678->ctx;
    uint64_t futhark_mc_segmap_parloop_235679_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235679_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235678->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235678->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235678->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235678->free_i_203760;
    int64_t gtid_207050 =
            futhark_mc_segmap_parloop_struct_235678->free_gtid_207050;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235678->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235678->free_bytes_217463;
    struct memblock mem_217483 = {.desc ="mem_217483", .mem =
                                  futhark_mc_segmap_parloop_struct_235678->free_mem_217483,
                                  .size =0, .references =NULL};
    size_t mem_221401_cached_sizze_235680 = 0;
    unsigned char *mem_221401 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221419 = start;
    
    if (mem_221401_cached_sizze_235680 < (size_t) bytes_217463) {
        mem_221401 = realloc(mem_221401, bytes_217463);
        mem_221401_cached_sizze_235680 = bytes_217463;
    }
    for (; iter_221419 < end; iter_221419++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221432 = n_p_203574;
        int64_t gtid_221400 = iter_221419;
        int64_t remnant_221433 = iter_221419 - gtid_221400;
        
        for (int64_t i_221420 = 0; i_221420 < defunc_0_f_res_203721;
             i_221420++) {
            int64_t y_221422 = mul64(n_p_203574, i_221420);
            int64_t new_i_221423 = add64(gtid_221400, y_221422);
            bool cond_221424 = slt64(i_203760, new_i_221423);
            double defunc_0_f_res_221425;
            
            if (cond_221424) {
                defunc_0_f_res_221425 = NAN;
            } else {
                bool x_221426 = sle64((int64_t) 0, new_i_221423);
                bool y_221427 = slt64(new_i_221423, n_203572);
                bool bounds_check_221428 = x_221426 && y_221427;
                bool index_certs_221429;
                
                if (!bounds_check_221428) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) new_i_221423,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_221430;
                
                defunc_0_f_res_f_res_221430 =
                    ((double *) mem_217415.mem)[gtid_207050 * n_203572 +
                                                new_i_221423];
                defunc_0_f_res_221425 = defunc_0_f_res_f_res_221430;
            }
            ((double *) mem_221401)[i_221420] = defunc_0_f_res_221425;
        }
        if (defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_217483.mem + gtid_221400 * defunc_0_f_res_203721 *
                    (int64_t) 8, mem_221401 + (int64_t) 0,
                    defunc_0_f_res_203721 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_221401);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235679_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235679_end -
                 futhark_mc_segmap_parloop_235679_start;
        
        ctx->futhark_mc_segmap_parloop_235679_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235679_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235679_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235677(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221399 = tid;
    int num_tasks_221418 = info.nsubtasks;
    struct futhark_mc_task_235676 *futhark_mc_task_235676 =
                                  (struct futhark_mc_task_235676 *) args;
    struct futhark_context *ctx = futhark_mc_task_235676->ctx;
    uint64_t futhark_mc_segmap_task_235677_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235677_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235676->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235676->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235676->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235676->free_i_203760;
    int64_t gtid_207050 = futhark_mc_task_235676->free_gtid_207050;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235676->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217463 = futhark_mc_task_235676->free_bytes_217463;
    struct memblock mem_217483 = {.desc ="mem_217483", .mem =
                                  futhark_mc_task_235676->free_mem_217483,
                                  .size =0, .references =NULL};
    int64_t iter_221419;
    struct futhark_mc_segmap_parloop_struct_235678
    futhark_mc_segmap_parloop_struct_235678;
    
    futhark_mc_segmap_parloop_struct_235678.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235678.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235678.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235678.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235678.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235678.free_gtid_207050 = gtid_207050;
    futhark_mc_segmap_parloop_struct_235678.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235678.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235678.free_mem_217483 = mem_217483.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235679_task;
    
    futhark_mc_segmap_parloop_235679_task.name =
        "futhark_mc_segmap_parloop_235679";
    futhark_mc_segmap_parloop_235679_task.fn = futhark_mc_segmap_parloop_235679;
    futhark_mc_segmap_parloop_235679_task.args =
        &futhark_mc_segmap_parloop_struct_235678;
    futhark_mc_segmap_parloop_235679_task.iterations = iterations;
    futhark_mc_segmap_parloop_235679_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235679_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235679_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235679_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235679_task);
    
    if (futhark_mc_segmap_parloop_235679_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235679_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235679_total_end -
                 futhark_mc_segmap_parloop_235679_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235679_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235679_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235679_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235677_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235677_end -
                 futhark_mc_segmap_task_235677_start;
        
        ctx->futhark_mc_segmap_task_235677_runs[tid]++;
        ctx->futhark_mc_segmap_task_235677_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235677_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235682 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207050;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217483;
};
struct futhark_mc_task_235685 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207050;
    unsigned char *free_mem_217415;
    int64_t free_gtid_221385;
    unsigned char *free_mem_221386;
};
struct futhark_mc_segmap_parloop_struct_235687 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207050;
    unsigned char *free_mem_217415;
    int64_t free_gtid_221385;
    unsigned char *free_mem_221386;
};
static int futhark_mc_segmap_parloop_235688(void *args, int64_t start,
                                            int64_t end, int flat_tid_221436,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235687
    *futhark_mc_segmap_parloop_struct_235687 =
    (struct futhark_mc_segmap_parloop_struct_235687 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235687->ctx;
    uint64_t futhark_mc_segmap_parloop_235688_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235688_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235687->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235687->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235687->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235687->free_i_203760;
    int64_t gtid_207050 =
            futhark_mc_segmap_parloop_struct_235687->free_gtid_207050;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235687->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t gtid_221385 =
            futhark_mc_segmap_parloop_struct_235687->free_gtid_221385;
    struct memblock mem_221386 = {.desc ="mem_221386", .mem =
                                  futhark_mc_segmap_parloop_struct_235687->free_mem_221386,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221450 = start;
    
    for (; iter_221450 < end; iter_221450++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221456 = defunc_0_f_res_203721;
        int64_t gtid_221437 = iter_221450;
        int64_t remnant_221457 = iter_221450 - gtid_221437;
        int64_t y_221438 = mul64(n_p_203574, gtid_221437);
        int64_t new_i_221439 = add64(gtid_221385, y_221438);
        bool cond_221440 = slt64(i_203760, new_i_221439);
        double defunc_0_f_res_221441;
        
        if (cond_221440) {
            defunc_0_f_res_221441 = NAN;
        } else {
            bool x_221451 = sle64((int64_t) 0, new_i_221439);
            bool y_221452 = slt64(new_i_221439, n_203572);
            bool bounds_check_221453 = x_221451 && y_221452;
            bool index_certs_221454;
            
            if (!bounds_check_221453) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) new_i_221439,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_221455;
            
            defunc_0_f_res_f_res_221455 =
                ((double *) mem_217415.mem)[gtid_207050 * n_203572 +
                                            new_i_221439];
            defunc_0_f_res_221441 = defunc_0_f_res_f_res_221455;
        }
        ((double *) mem_221386.mem)[gtid_221437] = defunc_0_f_res_221441;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235688_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235688_end -
                 futhark_mc_segmap_parloop_235688_start;
        
        ctx->futhark_mc_segmap_parloop_235688_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235688_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235688_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235686(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221436 = tid;
    int num_tasks_221449 = info.nsubtasks;
    struct futhark_mc_task_235685 *futhark_mc_task_235685 =
                                  (struct futhark_mc_task_235685 *) args;
    struct futhark_context *ctx = futhark_mc_task_235685->ctx;
    uint64_t futhark_mc_segmap_task_235686_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235686_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235685->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235685->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235685->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235685->free_i_203760;
    int64_t gtid_207050 = futhark_mc_task_235685->free_gtid_207050;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235685->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t gtid_221385 = futhark_mc_task_235685->free_gtid_221385;
    struct memblock mem_221386 = {.desc ="mem_221386", .mem =
                                  futhark_mc_task_235685->free_mem_221386,
                                  .size =0, .references =NULL};
    int64_t iter_221450;
    struct futhark_mc_segmap_parloop_struct_235687
    futhark_mc_segmap_parloop_struct_235687;
    
    futhark_mc_segmap_parloop_struct_235687.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235687.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235687.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235687.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235687.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235687.free_gtid_207050 = gtid_207050;
    futhark_mc_segmap_parloop_struct_235687.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235687.free_gtid_221385 = gtid_221385;
    futhark_mc_segmap_parloop_struct_235687.free_mem_221386 = mem_221386.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235688_task;
    
    futhark_mc_segmap_parloop_235688_task.name =
        "futhark_mc_segmap_parloop_235688";
    futhark_mc_segmap_parloop_235688_task.fn = futhark_mc_segmap_parloop_235688;
    futhark_mc_segmap_parloop_235688_task.args =
        &futhark_mc_segmap_parloop_struct_235687;
    futhark_mc_segmap_parloop_235688_task.iterations = iterations;
    futhark_mc_segmap_parloop_235688_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235688_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235688_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235688_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235688_task);
    
    if (futhark_mc_segmap_parloop_235688_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235688_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235688_total_end -
                 futhark_mc_segmap_parloop_235688_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235688_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235688_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235688_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235686_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235686_end -
                 futhark_mc_segmap_task_235686_start;
        
        ctx->futhark_mc_segmap_task_235686_runs[tid]++;
        ctx->futhark_mc_segmap_task_235686_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235686_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235683(void *args, int64_t start,
                                            int64_t end, int flat_tid_221384,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235682
    *futhark_mc_segmap_parloop_struct_235682 =
    (struct futhark_mc_segmap_parloop_struct_235682 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235682->ctx;
    uint64_t futhark_mc_segmap_parloop_235683_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235683_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235682->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235682->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235682->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235682->free_i_203760;
    int64_t gtid_207050 =
            futhark_mc_segmap_parloop_struct_235682->free_gtid_207050;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235682->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235682->free_bytes_217463;
    struct memblock mem_217483 = {.desc ="mem_217483", .mem =
                                  futhark_mc_segmap_parloop_struct_235682->free_mem_217483,
                                  .size =0, .references =NULL};
    size_t mem_221386_cached_sizze_235684 = 0;
    unsigned char *mem_221386 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221435 = start;
    
    if (mem_221386_cached_sizze_235684 < (size_t) bytes_217463) {
        mem_221386 = realloc(mem_221386, bytes_217463);
        mem_221386_cached_sizze_235684 = bytes_217463;
    }
    for (; iter_221435 < end; iter_221435++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221447 = n_p_203574;
        int64_t gtid_221385 = iter_221435;
        int64_t remnant_221448 = iter_221435 - gtid_221385;
        int64_t flat_tid_221436 = (int64_t) 0;
        int32_t num_tasks_221449;
        struct futhark_mc_task_235685 futhark_mc_task_235685;
        
        futhark_mc_task_235685.ctx = ctx;
        futhark_mc_task_235685.free_n_203572 = n_203572;
        futhark_mc_task_235685.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235685.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235685.free_i_203760 = i_203760;
        futhark_mc_task_235685.free_gtid_207050 = gtid_207050;
        futhark_mc_task_235685.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_235685.free_gtid_221385 = gtid_221385;
        futhark_mc_task_235685.free_mem_221386 = mem_221386;
        
        struct scheduler_segop futhark_mc_task_235685_task;
        
        futhark_mc_task_235685_task.args = &futhark_mc_task_235685;
        futhark_mc_task_235685_task.top_level_fn =
            futhark_mc_segmap_task_235686;
        futhark_mc_task_235685_task.name = "futhark_mc_segmap_task_235686";
        futhark_mc_task_235685_task.iterations = defunc_0_f_res_203721;
        futhark_mc_task_235685_task.task_time =
            &ctx->futhark_mc_segmap_task_235686_total_time;
        futhark_mc_task_235685_task.task_iter =
            &ctx->futhark_mc_segmap_task_235686_total_iter;
        futhark_mc_task_235685_task.sched = STATIC;
        futhark_mc_task_235685_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235686_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235685_task);
        
        if (futhark_mc_segmap_task_235686_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_217483.mem + gtid_221385 * defunc_0_f_res_203721 *
                    (int64_t) 8, mem_221386 + (int64_t) 0,
                    defunc_0_f_res_203721 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_221386);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235683_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235683_end -
                 futhark_mc_segmap_parloop_235683_start;
        
        ctx->futhark_mc_segmap_parloop_235683_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235683_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235683_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235681(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221384 = tid;
    int num_tasks_221418 = info.nsubtasks;
    struct futhark_mc_task_235676 *futhark_mc_task_235676 =
                                  (struct futhark_mc_task_235676 *) args;
    struct futhark_context *ctx = futhark_mc_task_235676->ctx;
    uint64_t futhark_mc_segmap_nested_task_235681_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235681_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235676->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235676->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235676->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235676->free_i_203760;
    int64_t gtid_207050 = futhark_mc_task_235676->free_gtid_207050;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235676->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217463 = futhark_mc_task_235676->free_bytes_217463;
    struct memblock mem_217483 = {.desc ="mem_217483", .mem =
                                  futhark_mc_task_235676->free_mem_217483,
                                  .size =0, .references =NULL};
    int64_t iter_221435;
    struct futhark_mc_segmap_parloop_struct_235682
    futhark_mc_segmap_parloop_struct_235682;
    
    futhark_mc_segmap_parloop_struct_235682.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235682.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235682.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235682.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235682.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235682.free_gtid_207050 = gtid_207050;
    futhark_mc_segmap_parloop_struct_235682.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235682.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235682.free_mem_217483 = mem_217483.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235683_task;
    
    futhark_mc_segmap_parloop_235683_task.name =
        "futhark_mc_segmap_parloop_235683";
    futhark_mc_segmap_parloop_235683_task.fn = futhark_mc_segmap_parloop_235683;
    futhark_mc_segmap_parloop_235683_task.args =
        &futhark_mc_segmap_parloop_struct_235682;
    futhark_mc_segmap_parloop_235683_task.iterations = iterations;
    futhark_mc_segmap_parloop_235683_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235683_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235683_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235683_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235683_task);
    
    if (futhark_mc_segmap_parloop_235683_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235683_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235683_total_end -
                 futhark_mc_segmap_parloop_235683_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235683_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235683_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235683_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235681_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235681_end -
                 futhark_mc_segmap_nested_task_235681_start;
        
        ctx->futhark_mc_segmap_nested_task_235681_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235681_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235681_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235674(void *args, int64_t start,
                                            int64_t end, int flat_tid_207049,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235673
    *futhark_mc_segmap_parloop_struct_235673 =
    (struct futhark_mc_segmap_parloop_struct_235673 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235673->ctx;
    uint64_t futhark_mc_segmap_parloop_235674_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235674_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235673->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235673->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235673->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235673->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235673->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235673->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235673->free_bytes_217463;
    int64_t bytes_217482 =
            futhark_mc_segmap_parloop_struct_235673->free_bytes_217482;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_segmap_parloop_struct_235673->free_mem_217532,
                                  .size =0, .references =NULL};
    size_t mem_217483_cached_sizze_235675 = 0;
    unsigned char *mem_217483 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221383 = start;
    
    if (mem_217483_cached_sizze_235675 < (size_t) bytes_217482) {
        mem_217483 = realloc(mem_217483, bytes_217482);
        mem_217483_cached_sizze_235675 = bytes_217482;
    }
    for (; iter_221383 < end; iter_221383++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221416 = partition_sizze_203667;
        int64_t gtid_207050 = iter_221383;
        int64_t remnant_221417 = iter_221383 - gtid_207050;
        int64_t flat_tid_221399 = (int64_t) 0;
        int32_t num_tasks_221418;
        int64_t flat_tid_221384 = (int64_t) 0;
        struct futhark_mc_task_235676 futhark_mc_task_235676;
        
        futhark_mc_task_235676.ctx = ctx;
        futhark_mc_task_235676.free_n_203572 = n_203572;
        futhark_mc_task_235676.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235676.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235676.free_i_203760 = i_203760;
        futhark_mc_task_235676.free_gtid_207050 = gtid_207050;
        futhark_mc_task_235676.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_235676.free_bytes_217463 = bytes_217463;
        futhark_mc_task_235676.free_mem_217483 = mem_217483;
        
        struct scheduler_segop futhark_mc_task_235676_task;
        
        futhark_mc_task_235676_task.args = &futhark_mc_task_235676;
        futhark_mc_task_235676_task.top_level_fn =
            futhark_mc_segmap_task_235677;
        futhark_mc_task_235676_task.name = "futhark_mc_segmap_task_235677";
        futhark_mc_task_235676_task.iterations = n_p_203574;
        futhark_mc_task_235676_task.task_time =
            &ctx->futhark_mc_segmap_task_235677_total_time;
        futhark_mc_task_235676_task.task_iter =
            &ctx->futhark_mc_segmap_task_235677_total_iter;
        futhark_mc_task_235676_task.sched = STATIC;
        futhark_mc_task_235676_task.nested_fn =
            futhark_mc_segmap_nested_task_235681;
        
        int futhark_mc_segmap_task_235677_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235676_task);
        
        if (futhark_mc_segmap_task_235677_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_217532.mem + gtid_207050 * (defunc_0_f_res_203721 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_217483 + (int64_t) 0, n_p_203574 *
                    defunc_0_f_res_203721 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217483);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235674_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235674_end -
                 futhark_mc_segmap_parloop_235674_start;
        
        ctx->futhark_mc_segmap_parloop_235674_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235674_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235674_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235672(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207049 = tid;
    int num_tasks_221362 = info.nsubtasks;
    struct futhark_mc_task_235667 *futhark_mc_task_235667 =
                                  (struct futhark_mc_task_235667 *) args;
    struct futhark_context *ctx = futhark_mc_task_235667->ctx;
    uint64_t futhark_mc_segmap_nested_task_235672_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235672_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235667->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235667->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235667->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235667->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235667->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235667->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217463 = futhark_mc_task_235667->free_bytes_217463;
    int64_t bytes_217482 = futhark_mc_task_235667->free_bytes_217482;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_task_235667->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t iter_221383;
    struct futhark_mc_segmap_parloop_struct_235673
    futhark_mc_segmap_parloop_struct_235673;
    
    futhark_mc_segmap_parloop_struct_235673.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235673.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235673.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235673.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235673.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235673.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235673.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235673.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235673.free_bytes_217482 = bytes_217482;
    futhark_mc_segmap_parloop_struct_235673.free_mem_217532 = mem_217532.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235674_task;
    
    futhark_mc_segmap_parloop_235674_task.name =
        "futhark_mc_segmap_parloop_235674";
    futhark_mc_segmap_parloop_235674_task.fn = futhark_mc_segmap_parloop_235674;
    futhark_mc_segmap_parloop_235674_task.args =
        &futhark_mc_segmap_parloop_struct_235673;
    futhark_mc_segmap_parloop_235674_task.iterations = iterations;
    futhark_mc_segmap_parloop_235674_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235674_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235674_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235674_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235674_task);
    
    if (futhark_mc_segmap_parloop_235674_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235674_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235674_total_end -
                 futhark_mc_segmap_parloop_235674_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235674_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235674_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235674_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235672_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235672_end -
                 futhark_mc_segmap_nested_task_235672_start;
        
        ctx->futhark_mc_segmap_nested_task_235672_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235672_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235672_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235689 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203808;
    int64_t free_bytes_217463;
    int64_t free_bytes_217482;
    unsigned char *free_mem_217532;
    int64_t free_bytes_217574;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
};
struct futhark_mc_segmap_parloop_struct_235691 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203808;
    int64_t free_bytes_217463;
    int64_t free_bytes_217482;
    unsigned char *free_mem_217532;
    int64_t free_bytes_217574;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
};
static int futhark_mc_segmap_parloop_235692(void *args, int64_t start,
                                            int64_t end, int flat_tid_207083,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235691
    *futhark_mc_segmap_parloop_struct_235691 =
    (struct futhark_mc_segmap_parloop_struct_235691 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235691->ctx;
    uint64_t futhark_mc_segmap_parloop_235692_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235692_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235691->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235691->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235691->free_defunc_0_f_res_203721;
    int64_t i_203808 = futhark_mc_segmap_parloop_struct_235691->free_i_203808;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235691->free_bytes_217463;
    int64_t bytes_217482 =
            futhark_mc_segmap_parloop_struct_235691->free_bytes_217482;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_segmap_parloop_struct_235691->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t bytes_217574 =
            futhark_mc_segmap_parloop_struct_235691->free_bytes_217574;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235691->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235691->free_mem_217658,
                                  .size =0, .references =NULL};
    size_t mem_217579_cached_sizze_235693 = 0;
    unsigned char *mem_217579 = NULL;
    size_t mem_217582_cached_sizze_235694 = 0;
    unsigned char *mem_217582 = NULL;
    size_t mem_217602_cached_sizze_235695 = 0;
    unsigned char *mem_217602 = NULL;
    size_t mem_217617_cached_sizze_235696 = 0;
    unsigned char *mem_217617 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221459 = start;
    
    if (mem_217579_cached_sizze_235693 < (size_t) bytes_217482) {
        mem_217579 = realloc(mem_217579, bytes_217482);
        mem_217579_cached_sizze_235693 = bytes_217482;
    }
    if (mem_217582_cached_sizze_235694 < (size_t) bytes_217574) {
        mem_217582 = realloc(mem_217582, bytes_217574);
        mem_217582_cached_sizze_235694 = bytes_217574;
    }
    if (mem_217602_cached_sizze_235695 < (size_t) bytes_217463) {
        mem_217602 = realloc(mem_217602, bytes_217463);
        mem_217602_cached_sizze_235695 = bytes_217463;
    }
    if (mem_217617_cached_sizze_235696 < (size_t) bytes_217463) {
        mem_217617 = realloc(mem_217617, bytes_217463);
        mem_217617_cached_sizze_235696 = bytes_217463;
    }
    for (; iter_221459 < end; iter_221459++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221488 = partition_sizze_203667;
        int64_t gtid_207084 = iter_221459;
        int64_t remnant_221489 = iter_221459 - gtid_207084;
        
        for (int64_t i_221490 = 0; i_221490 < defunc_0_f_res_203721;
             i_221490++) {
            ((int64_t *) mem_217617)[i_221490] = (int64_t) -1;
        }
        for (int64_t i_221460 = 0; i_221460 < n_p_203574; i_221460++) {
            int64_t discard_221464;
            int64_t scanacc_221467 = (int64_t) 0;
            
            for (int64_t i_221466 = 0; i_221466 < defunc_0_f_res_203721;
                 i_221466++) {
                double x_221469;
                
                x_221469 = ((double *) mem_217532.mem)[gtid_207084 *
                                                       (defunc_0_f_res_203721 *
                                                        n_p_203574) + i_221460 *
                                                       defunc_0_f_res_203721 +
                                                       i_221466];
                
                bool isnan_res_221470;
                
                isnan_res_221470 = futrts_isnan64(x_221469);
                
                bool defunc_0_p_res_221471 = !isnan_res_221470;
                int64_t defunc_0_f_res_221472 =
                        btoi_bool_i64(defunc_0_p_res_221471);
                int64_t defunc_1_op_res_221473 = add64(defunc_0_f_res_221472,
                                                       scanacc_221467);
                
                ((int64_t *) mem_217602)[i_221466] = defunc_1_op_res_221473;
                
                int64_t scanacc_tmp_221493 = defunc_1_op_res_221473;
                
                scanacc_221467 = scanacc_tmp_221493;
            }
            discard_221464 = scanacc_221467;
            if (defunc_0_f_res_203721 * (int64_t) 8 > 0)
                memmove(mem_217579 + i_221460 * defunc_0_f_res_203721 *
                        (int64_t) 8, mem_217617 + (int64_t) 0,
                        defunc_0_f_res_203721 * (int64_t) 8);
            for (int64_t write_iter_221477 = 0; write_iter_221477 <
                 defunc_0_f_res_203721; write_iter_221477++) {
                double write_iv_221479;
                
                write_iv_221479 = ((double *) mem_217532.mem)[gtid_207084 *
                                                              (defunc_0_f_res_203721 *
                                                               n_p_203574) +
                                                              i_221460 *
                                                              defunc_0_f_res_203721 +
                                                              write_iter_221477];
                
                bool isnan_res_221480;
                
                isnan_res_221480 = futrts_isnan64(write_iv_221479);
                
                bool defunc_0_p_res_221481 = !isnan_res_221480;
                int64_t defunc_1_f_res_221482;
                
                if (defunc_0_p_res_221481) {
                    int64_t write_iv_221483;
                    
                    write_iv_221483 =
                        ((int64_t *) mem_217602)[write_iter_221477];
                    
                    int64_t defunc_1_f_res_t_res_221484 = sub64(write_iv_221483,
                                                                (int64_t) 1);
                    
                    defunc_1_f_res_221482 = defunc_1_f_res_t_res_221484;
                } else {
                    defunc_1_f_res_221482 = (int64_t) -1;
                }
                if ((sle64((int64_t) 0, i_221460) && slt64(i_221460,
                                                           n_p_203574)) &&
                    (sle64((int64_t) 0, defunc_1_f_res_221482) &&
                     slt64(defunc_1_f_res_221482, defunc_0_f_res_203721))) {
                    ((int64_t *) mem_217579)[i_221460 * defunc_0_f_res_203721 +
                                             defunc_1_f_res_221482] =
                        write_iter_221477;
                }
            }
            if ((int64_t) 8 > 0)
                memmove(mem_217582 + i_221460 * (int64_t) 8, mem_217602 +
                        i_203808 * (int64_t) 8, (int64_t) 8);
        }
        if (n_p_203574 * defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_217654.mem + gtid_207084 * (defunc_0_f_res_203721 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_217579 + (int64_t) 0, n_p_203574 *
                    defunc_0_f_res_203721 * (int64_t) 8);
        if (n_p_203574 * (int64_t) 8 > 0)
            memmove(mem_217658.mem + gtid_207084 * n_p_203574 * (int64_t) 8,
                    mem_217582 + (int64_t) 0, n_p_203574 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217579);
    free(mem_217582);
    free(mem_217602);
    free(mem_217617);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235692_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235692_end -
                 futhark_mc_segmap_parloop_235692_start;
        
        ctx->futhark_mc_segmap_parloop_235692_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235692_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235692_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235690(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207083 = tid;
    int num_tasks_221458 = info.nsubtasks;
    struct futhark_mc_task_235689 *futhark_mc_task_235689 =
                                  (struct futhark_mc_task_235689 *) args;
    struct futhark_context *ctx = futhark_mc_task_235689->ctx;
    uint64_t futhark_mc_segmap_task_235690_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235690_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235689->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235689->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235689->free_defunc_0_f_res_203721;
    int64_t i_203808 = futhark_mc_task_235689->free_i_203808;
    int64_t bytes_217463 = futhark_mc_task_235689->free_bytes_217463;
    int64_t bytes_217482 = futhark_mc_task_235689->free_bytes_217482;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_task_235689->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t bytes_217574 = futhark_mc_task_235689->free_bytes_217574;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235689->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235689->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t iter_221459;
    struct futhark_mc_segmap_parloop_struct_235691
    futhark_mc_segmap_parloop_struct_235691;
    
    futhark_mc_segmap_parloop_struct_235691.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235691.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235691.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235691.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235691.free_i_203808 = i_203808;
    futhark_mc_segmap_parloop_struct_235691.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235691.free_bytes_217482 = bytes_217482;
    futhark_mc_segmap_parloop_struct_235691.free_mem_217532 = mem_217532.mem;
    futhark_mc_segmap_parloop_struct_235691.free_bytes_217574 = bytes_217574;
    futhark_mc_segmap_parloop_struct_235691.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235691.free_mem_217658 = mem_217658.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235692_task;
    
    futhark_mc_segmap_parloop_235692_task.name =
        "futhark_mc_segmap_parloop_235692";
    futhark_mc_segmap_parloop_235692_task.fn = futhark_mc_segmap_parloop_235692;
    futhark_mc_segmap_parloop_235692_task.args =
        &futhark_mc_segmap_parloop_struct_235691;
    futhark_mc_segmap_parloop_235692_task.iterations = iterations;
    futhark_mc_segmap_parloop_235692_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235692_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235692_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235692_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235692_task);
    
    if (futhark_mc_segmap_parloop_235692_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235692_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235692_total_end -
                 futhark_mc_segmap_parloop_235692_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235692_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235692_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235692_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235690_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235690_end -
                 futhark_mc_segmap_task_235690_start;
        
        ctx->futhark_mc_segmap_task_235690_runs[tid]++;
        ctx->futhark_mc_segmap_task_235690_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235690_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235698 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203808;
    int64_t free_bytes_217463;
    int64_t free_bytes_217482;
    unsigned char *free_mem_217532;
    int64_t free_bytes_217574;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
};
struct futhark_mc_task_235702 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203808;
    int64_t free_gtid_207121;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217532;
    unsigned char *free_mem_217572;
    unsigned char *free_mem_217575;
};
struct futhark_mc_segmap_parloop_struct_235704 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203808;
    int64_t free_gtid_207121;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217532;
    unsigned char *free_mem_217572;
    unsigned char *free_mem_217575;
};
static int futhark_mc_segmap_parloop_235705(void *args, int64_t start,
                                            int64_t end, int flat_tid_221522,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235704
    *futhark_mc_segmap_parloop_struct_235704 =
    (struct futhark_mc_segmap_parloop_struct_235704 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235704->ctx;
    uint64_t futhark_mc_segmap_parloop_235705_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235705_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235704->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235704->free_defunc_0_f_res_203721;
    int64_t i_203808 = futhark_mc_segmap_parloop_struct_235704->free_i_203808;
    int64_t gtid_207121 =
            futhark_mc_segmap_parloop_struct_235704->free_gtid_207121;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235704->free_bytes_217463;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_segmap_parloop_struct_235704->free_mem_217532,
                                  .size =0, .references =NULL};
    struct memblock mem_217572 = {.desc ="mem_217572", .mem =
                                  futhark_mc_segmap_parloop_struct_235704->free_mem_217572,
                                  .size =0, .references =NULL};
    struct memblock mem_217575 = {.desc ="mem_217575", .mem =
                                  futhark_mc_segmap_parloop_struct_235704->free_mem_217575,
                                  .size =0, .references =NULL};
    size_t mem_221524_cached_sizze_235706 = 0;
    unsigned char *mem_221524 = NULL;
    size_t mem_221538_cached_sizze_235707 = 0;
    unsigned char *mem_221538 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221553 = start;
    
    if (mem_221524_cached_sizze_235706 < (size_t) bytes_217463) {
        mem_221524 = realloc(mem_221524, bytes_217463);
        mem_221524_cached_sizze_235706 = bytes_217463;
    }
    if (mem_221538_cached_sizze_235707 < (size_t) bytes_217463) {
        mem_221538 = realloc(mem_221538, bytes_217463);
        mem_221538_cached_sizze_235707 = bytes_217463;
    }
    for (; iter_221553 < end; iter_221553++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221572 = n_p_203574;
        int64_t gtid_221523 = iter_221553;
        int64_t remnant_221573 = iter_221553 - gtid_221523;
        int64_t discard_221526;
        int64_t scanacc_221555 = (int64_t) 0;
        
        for (int64_t i_221554 = 0; i_221554 < defunc_0_f_res_203721;
             i_221554++) {
            double x_221557;
            
            x_221557 = ((double *) mem_217532.mem)[gtid_207121 *
                                                   (defunc_0_f_res_203721 *
                                                    n_p_203574) + gtid_221523 *
                                                   defunc_0_f_res_203721 +
                                                   i_221554];
            
            bool isnan_res_221558;
            
            isnan_res_221558 = futrts_isnan64(x_221557);
            
            bool defunc_0_p_res_221559 = !isnan_res_221558;
            int64_t defunc_0_f_res_221560 =
                    btoi_bool_i64(defunc_0_p_res_221559);
            int64_t defunc_1_op_res_221561 = add64(defunc_0_f_res_221560,
                                                   scanacc_221555);
            
            ((int64_t *) mem_221524)[i_221554] = defunc_1_op_res_221561;
            
            int64_t scanacc_tmp_221574 = defunc_1_op_res_221561;
            
            scanacc_221555 = scanacc_tmp_221574;
        }
        discard_221526 = scanacc_221555;
        
        int64_t last_res_221537;
        
        last_res_221537 = ((int64_t *) mem_221524)[i_203808];
        for (int64_t i_221576 = 0; i_221576 < defunc_0_f_res_203721;
             i_221576++) {
            ((int64_t *) mem_221538)[i_221576] = (int64_t) -1;
        }
        for (int64_t write_iter_221563 = 0; write_iter_221563 <
             defunc_0_f_res_203721; write_iter_221563++) {
            double write_iv_221565;
            
            write_iv_221565 = ((double *) mem_217532.mem)[gtid_207121 *
                                                          (defunc_0_f_res_203721 *
                                                           n_p_203574) +
                                                          gtid_221523 *
                                                          defunc_0_f_res_203721 +
                                                          write_iter_221563];
            
            bool isnan_res_221566;
            
            isnan_res_221566 = futrts_isnan64(write_iv_221565);
            
            bool defunc_0_p_res_221567 = !isnan_res_221566;
            int64_t defunc_1_f_res_221568;
            
            if (defunc_0_p_res_221567) {
                int64_t write_iv_221569;
                
                write_iv_221569 = ((int64_t *) mem_221524)[write_iter_221563];
                
                int64_t defunc_1_f_res_t_res_221570 = sub64(write_iv_221569,
                                                            (int64_t) 1);
                
                defunc_1_f_res_221568 = defunc_1_f_res_t_res_221570;
            } else {
                defunc_1_f_res_221568 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_221568) &&
                slt64(defunc_1_f_res_221568, defunc_0_f_res_203721)) {
                ((int64_t *) mem_221538)[defunc_1_f_res_221568] =
                    write_iter_221563;
            }
        }
        if (defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_217572.mem + gtid_221523 * defunc_0_f_res_203721 *
                    (int64_t) 8, mem_221538 + (int64_t) 0,
                    defunc_0_f_res_203721 * (int64_t) 8);
        ((int64_t *) mem_217575.mem)[gtid_221523] = last_res_221537;
    }
    
  cleanup:
    { }
    free(mem_221524);
    free(mem_221538);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235705_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235705_end -
                 futhark_mc_segmap_parloop_235705_start;
        
        ctx->futhark_mc_segmap_parloop_235705_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235705_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235705_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235703(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221522 = tid;
    int num_tasks_221552 = info.nsubtasks;
    struct futhark_mc_task_235702 *futhark_mc_task_235702 =
                                  (struct futhark_mc_task_235702 *) args;
    struct futhark_context *ctx = futhark_mc_task_235702->ctx;
    uint64_t futhark_mc_segmap_task_235703_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235703_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235702->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235702->free_defunc_0_f_res_203721;
    int64_t i_203808 = futhark_mc_task_235702->free_i_203808;
    int64_t gtid_207121 = futhark_mc_task_235702->free_gtid_207121;
    int64_t bytes_217463 = futhark_mc_task_235702->free_bytes_217463;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_task_235702->free_mem_217532,
                                  .size =0, .references =NULL};
    struct memblock mem_217572 = {.desc ="mem_217572", .mem =
                                  futhark_mc_task_235702->free_mem_217572,
                                  .size =0, .references =NULL};
    struct memblock mem_217575 = {.desc ="mem_217575", .mem =
                                  futhark_mc_task_235702->free_mem_217575,
                                  .size =0, .references =NULL};
    int64_t iter_221553;
    struct futhark_mc_segmap_parloop_struct_235704
    futhark_mc_segmap_parloop_struct_235704;
    
    futhark_mc_segmap_parloop_struct_235704.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235704.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235704.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235704.free_i_203808 = i_203808;
    futhark_mc_segmap_parloop_struct_235704.free_gtid_207121 = gtid_207121;
    futhark_mc_segmap_parloop_struct_235704.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235704.free_mem_217532 = mem_217532.mem;
    futhark_mc_segmap_parloop_struct_235704.free_mem_217572 = mem_217572.mem;
    futhark_mc_segmap_parloop_struct_235704.free_mem_217575 = mem_217575.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235705_task;
    
    futhark_mc_segmap_parloop_235705_task.name =
        "futhark_mc_segmap_parloop_235705";
    futhark_mc_segmap_parloop_235705_task.fn = futhark_mc_segmap_parloop_235705;
    futhark_mc_segmap_parloop_235705_task.args =
        &futhark_mc_segmap_parloop_struct_235704;
    futhark_mc_segmap_parloop_235705_task.iterations = iterations;
    futhark_mc_segmap_parloop_235705_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235705_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235705_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235705_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235705_task);
    
    if (futhark_mc_segmap_parloop_235705_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235705_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235705_total_end -
                 futhark_mc_segmap_parloop_235705_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235705_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235705_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235705_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235703_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235703_end -
                 futhark_mc_segmap_task_235703_start;
        
        ctx->futhark_mc_segmap_task_235703_runs[tid]++;
        ctx->futhark_mc_segmap_task_235703_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235703_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235709 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203808;
    int64_t free_gtid_207121;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217532;
    unsigned char *free_mem_217572;
    unsigned char *free_mem_217575;
};
struct futhark_mc_task_235713 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_207121;
    unsigned char *free_mem_217532;
    int64_t free_gtid_221498;
    unsigned char *free_mem_221499;
};
struct futhark_mc_scan_stage_1_parloop_struct_235716 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_207121;
    unsigned char *free_mem_217532;
    int64_t free_gtid_221498;
    unsigned char *free_mem_221499;
};
static int futhark_mc_scan_stage_1_parloop_235717(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_221579, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_235716
    *futhark_mc_scan_stage_1_parloop_struct_235716 =
    (struct futhark_mc_scan_stage_1_parloop_struct_235716 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_235716->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_235717_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235717_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_scan_stage_1_parloop_struct_235716->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_scan_stage_1_parloop_struct_235716->free_defunc_0_f_res_203721;
    int64_t gtid_207121 =
            futhark_mc_scan_stage_1_parloop_struct_235716->free_gtid_207121;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235716->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t gtid_221498 =
            futhark_mc_scan_stage_1_parloop_struct_235716->free_gtid_221498;
    struct memblock mem_221499 = {.desc ="mem_221499", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_235716->free_mem_221499,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221599 = start;
    int64_t x_221581;
    int64_t x_221582;
    
    x_221581 = (int64_t) 0;
    for (; iter_221599 < end; iter_221599++) {
        int64_t gtid_221580 = iter_221599;
        
        // stage 1 scan body
        {
            double x_221584;
            
            x_221584 = ((double *) mem_217532.mem)[gtid_207121 *
                                                   (defunc_0_f_res_203721 *
                                                    n_p_203574) + gtid_221498 *
                                                   defunc_0_f_res_203721 +
                                                   gtid_221580];
            
            bool isnan_res_221585;
            
            isnan_res_221585 = futrts_isnan64(x_221584);
            
            bool defunc_0_p_res_221586 = !isnan_res_221585;
            int64_t defunc_0_f_res_221587 =
                    btoi_bool_i64(defunc_0_p_res_221586);
            
            // write mapped values results to memory
            { }
            x_221581 = x_221581;
            // Read next values
            {
                x_221582 = defunc_0_f_res_221587;
            }
            
            int64_t defunc_1_op_res_221583 = add64(x_221581, x_221582);
            
            ((int64_t *) mem_221499.mem)[gtid_221580] = defunc_1_op_res_221583;
            x_221581 = defunc_1_op_res_221583;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235717_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235717_end -
                 futhark_mc_scan_stage_1_parloop_235717_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_235717_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_235717_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_235717_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_235718 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_207121;
    unsigned char *free_mem_217532;
    int64_t free_gtid_221498;
    unsigned char *free_mem_221499;
};
static int futhark_mc_scan_stage_3_parloop_235719(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_221579, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_235718
    *futhark_mc_scan_stage_3_parloop_struct_235718 =
    (struct futhark_mc_scan_stage_3_parloop_struct_235718 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_235718->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_235719_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_235719_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_scan_stage_3_parloop_struct_235718->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_scan_stage_3_parloop_struct_235718->free_defunc_0_f_res_203721;
    int64_t gtid_207121 =
            futhark_mc_scan_stage_3_parloop_struct_235718->free_gtid_207121;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235718->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t gtid_221498 =
            futhark_mc_scan_stage_3_parloop_struct_235718->free_gtid_221498;
    struct memblock mem_221499 = {.desc ="mem_221499", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_235718->free_mem_221499,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221611 = start;
    int64_t x_221608;
    int64_t x_221609;
    
    if (iter_221611 == (int64_t) 0) {
        x_221608 = (int64_t) 0;
    } else {
        x_221608 = ((int64_t *) mem_221499.mem)[iter_221611 - (int64_t) 1];
    }
    for (; iter_221611 < end; iter_221611++) {
        int64_t gtid_221580 = iter_221611;
        
        // stage 3 scan body
        {
            double x_221584;
            
            x_221584 = ((double *) mem_217532.mem)[gtid_207121 *
                                                   (defunc_0_f_res_203721 *
                                                    n_p_203574) + gtid_221498 *
                                                   defunc_0_f_res_203721 +
                                                   gtid_221580];
            
            bool isnan_res_221585;
            
            isnan_res_221585 = futrts_isnan64(x_221584);
            
            bool defunc_0_p_res_221586 = !isnan_res_221585;
            int64_t defunc_0_f_res_221587 =
                    btoi_bool_i64(defunc_0_p_res_221586);
            
            x_221608 = x_221608;
            x_221609 = defunc_0_f_res_221587;
            
            int64_t defunc_1_op_res_221610 = add64(x_221608, x_221609);
            
            ((int64_t *) mem_221499.mem)[gtid_221580] = defunc_1_op_res_221610;
            x_221608 = defunc_1_op_res_221610;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_235719_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_235719_end -
                 futhark_mc_scan_stage_3_parloop_235719_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_235719_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_235719_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_235719_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_235714(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221579 = tid;
    int num_tasks_221598 = info.nsubtasks;
    struct futhark_mc_task_235713 *futhark_mc_task_235713 =
                                  (struct futhark_mc_task_235713 *) args;
    struct futhark_context *ctx = futhark_mc_task_235713->ctx;
    uint64_t futhark_mc_segscan_task_235714_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_235714_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235713->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235713->free_defunc_0_f_res_203721;
    int64_t gtid_207121 = futhark_mc_task_235713->free_gtid_207121;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_task_235713->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t gtid_221498 = futhark_mc_task_235713->free_gtid_221498;
    struct memblock mem_221499 = {.desc ="mem_221499", .mem =
                                  futhark_mc_task_235713->free_mem_221499,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_221605_cached_sizze_235715 = 0;
    unsigned char *scan_stage_2_accum_mem_221605 = NULL;
    int64_t iter_221599;
    struct futhark_mc_scan_stage_1_parloop_struct_235716
    futhark_mc_scan_stage_1_parloop_struct_235716;
    
    futhark_mc_scan_stage_1_parloop_struct_235716.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_235716.free_n_p_203574 = n_p_203574;
    futhark_mc_scan_stage_1_parloop_struct_235716.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_scan_stage_1_parloop_struct_235716.free_gtid_207121 =
        gtid_207121;
    futhark_mc_scan_stage_1_parloop_struct_235716.free_mem_217532 =
        mem_217532.mem;
    futhark_mc_scan_stage_1_parloop_struct_235716.free_gtid_221498 =
        gtid_221498;
    futhark_mc_scan_stage_1_parloop_struct_235716.free_mem_221499 =
        mem_221499.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_235717_task;
    
    futhark_mc_scan_stage_1_parloop_235717_task.name =
        "futhark_mc_scan_stage_1_parloop_235717";
    futhark_mc_scan_stage_1_parloop_235717_task.fn =
        futhark_mc_scan_stage_1_parloop_235717;
    futhark_mc_scan_stage_1_parloop_235717_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_235716;
    futhark_mc_scan_stage_1_parloop_235717_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_235717_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_235717_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_235717_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_235717_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_235717_task);
    
    if (futhark_mc_scan_stage_1_parloop_235717_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_235717_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_235717_total_end -
                 futhark_mc_scan_stage_1_parloop_235717_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235717_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235717_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_235717_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_221598)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_221600;
        int64_t x_221601;
        int64_t offset_221603 = (int64_t) 0;
        int64_t offset_index_221604 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_221605_cached_sizze_235715 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_221605 =
                realloc(scan_stage_2_accum_mem_221605, (int64_t) 8);
            scan_stage_2_accum_mem_221605_cached_sizze_235715 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_221605)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_221607 = 0; i_221607 < num_tasks_221598 - 1;
             i_221607++) {
            offset_221603 = squot64(defunc_0_f_res_203721,
                                    sext_i32_i64(num_tasks_221598));
            if (slt64(sext_i32_i64(i_221607), srem64(defunc_0_f_res_203721,
                                                     sext_i32_i64(num_tasks_221598)))) {
                offset_221603 += (int64_t) 1;
            }
            offset_index_221604 += offset_221603;
            
            int64_t gtid_221580 = offset_index_221604;
            double x_221584;
            
            x_221584 = ((double *) mem_217532.mem)[gtid_207121 *
                                                   (defunc_0_f_res_203721 *
                                                    n_p_203574) + gtid_221498 *
                                                   defunc_0_f_res_203721 +
                                                   gtid_221580];
            
            bool isnan_res_221585;
            
            isnan_res_221585 = futrts_isnan64(x_221584);
            
            bool defunc_0_p_res_221586 = !isnan_res_221585;
            int64_t defunc_0_f_res_221587 =
                    btoi_bool_i64(defunc_0_p_res_221586);
            
            // Read carry in
            {
                x_221600 =
                    ((int64_t *) scan_stage_2_accum_mem_221605)[(int64_t) 0];
            }
            // Read next values
            {
                x_221601 = ((int64_t *) mem_221499.mem)[offset_index_221604 -
                                                        (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_221602 = add64(x_221600, x_221601);
            
            ((int64_t *) mem_221499.mem)[offset_index_221604 - (int64_t) 1] =
                defunc_1_op_res_221602;
            ((int64_t *) scan_stage_2_accum_mem_221605)[(int64_t) 0] =
                defunc_1_op_res_221602;
        }
        
        int64_t iter_221611 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_235718
        futhark_mc_scan_stage_3_parloop_struct_235718;
        
        futhark_mc_scan_stage_3_parloop_struct_235718.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_235718.free_n_p_203574 =
            n_p_203574;
        futhark_mc_scan_stage_3_parloop_struct_235718.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_scan_stage_3_parloop_struct_235718.free_gtid_207121 =
            gtid_207121;
        futhark_mc_scan_stage_3_parloop_struct_235718.free_mem_217532 =
            mem_217532.mem;
        futhark_mc_scan_stage_3_parloop_struct_235718.free_gtid_221498 =
            gtid_221498;
        futhark_mc_scan_stage_3_parloop_struct_235718.free_mem_221499 =
            mem_221499.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_235719_task;
        
        futhark_mc_scan_stage_3_parloop_235719_task.name =
            "futhark_mc_scan_stage_3_parloop_235719";
        futhark_mc_scan_stage_3_parloop_235719_task.fn =
            futhark_mc_scan_stage_3_parloop_235719;
        futhark_mc_scan_stage_3_parloop_235719_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_235718;
        futhark_mc_scan_stage_3_parloop_235719_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_235719_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_235719_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_235719_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_235719_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_235719_task);
        
        if (futhark_mc_scan_stage_3_parloop_235719_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_235719_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_235719_total_end -
                     futhark_mc_scan_stage_3_parloop_235719_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235719_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235719_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_235719_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_221605);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_235714_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_235714_end -
                 futhark_mc_segscan_task_235714_start;
        
        ctx->futhark_mc_segscan_task_235714_runs[tid]++;
        ctx->futhark_mc_segscan_task_235714_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_235714_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235720 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_207121;
    unsigned char *free_mem_217532;
    int64_t free_gtid_221498;
    unsigned char *free_mem_221499;
    unsigned char *free_mem_221511;
};
struct futhark_mc_segmap_parloop_struct_235722 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_207121;
    unsigned char *free_mem_217532;
    int64_t free_gtid_221498;
    unsigned char *free_mem_221499;
    unsigned char *free_mem_221511;
};
static int futhark_mc_segmap_parloop_235723(void *args, int64_t start,
                                            int64_t end, int flat_tid_221588,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235722
    *futhark_mc_segmap_parloop_struct_235722 =
    (struct futhark_mc_segmap_parloop_struct_235722 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235722->ctx;
    uint64_t futhark_mc_segmap_parloop_235723_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235723_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235722->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235722->free_defunc_0_f_res_203721;
    int64_t gtid_207121 =
            futhark_mc_segmap_parloop_struct_235722->free_gtid_207121;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_segmap_parloop_struct_235722->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t gtid_221498 =
            futhark_mc_segmap_parloop_struct_235722->free_gtid_221498;
    struct memblock mem_221499 = {.desc ="mem_221499", .mem =
                                  futhark_mc_segmap_parloop_struct_235722->free_mem_221499,
                                  .size =0, .references =NULL};
    struct memblock mem_221511 = {.desc ="mem_221511", .mem =
                                  futhark_mc_segmap_parloop_struct_235722->free_mem_221511,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_221614 = start;
    
    for (; iter_221614 < end; iter_221614++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221617 = defunc_0_f_res_203721;
        int64_t gtid_221589 = iter_221614;
        int64_t remnant_221618 = iter_221614 - gtid_221589;
        double x_221590;
        
        x_221590 = ((double *) mem_217532.mem)[gtid_207121 *
                                               (defunc_0_f_res_203721 *
                                                n_p_203574) + gtid_221498 *
                                               defunc_0_f_res_203721 +
                                               gtid_221589];
        
        bool isnan_res_221591;
        
        isnan_res_221591 = futrts_isnan64(x_221590);
        
        bool defunc_0_p_res_221592 = !isnan_res_221591;
        int64_t defunc_1_f_res_221593;
        
        if (defunc_0_p_res_221592) {
            int64_t x_221615;
            
            x_221615 = ((int64_t *) mem_221499.mem)[gtid_221589];
            
            int64_t defunc_1_f_res_t_res_221616 = sub64(x_221615, (int64_t) 1);
            
            defunc_1_f_res_221593 = defunc_1_f_res_t_res_221616;
        } else {
            defunc_1_f_res_221593 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_221593) &&
            slt64(defunc_1_f_res_221593, defunc_0_f_res_203721)) {
            ((int64_t *) mem_221511.mem)[defunc_1_f_res_221593] = gtid_221589;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235723_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235723_end -
                 futhark_mc_segmap_parloop_235723_start;
        
        ctx->futhark_mc_segmap_parloop_235723_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235723_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235723_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235721(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221588 = tid;
    int num_tasks_221613 = info.nsubtasks;
    struct futhark_mc_task_235720 *futhark_mc_task_235720 =
                                  (struct futhark_mc_task_235720 *) args;
    struct futhark_context *ctx = futhark_mc_task_235720->ctx;
    uint64_t futhark_mc_segmap_task_235721_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235721_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235720->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235720->free_defunc_0_f_res_203721;
    int64_t gtid_207121 = futhark_mc_task_235720->free_gtid_207121;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_task_235720->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t gtid_221498 = futhark_mc_task_235720->free_gtid_221498;
    struct memblock mem_221499 = {.desc ="mem_221499", .mem =
                                  futhark_mc_task_235720->free_mem_221499,
                                  .size =0, .references =NULL};
    struct memblock mem_221511 = {.desc ="mem_221511", .mem =
                                  futhark_mc_task_235720->free_mem_221511,
                                  .size =0, .references =NULL};
    int64_t iter_221614;
    struct futhark_mc_segmap_parloop_struct_235722
    futhark_mc_segmap_parloop_struct_235722;
    
    futhark_mc_segmap_parloop_struct_235722.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235722.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235722.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235722.free_gtid_207121 = gtid_207121;
    futhark_mc_segmap_parloop_struct_235722.free_mem_217532 = mem_217532.mem;
    futhark_mc_segmap_parloop_struct_235722.free_gtid_221498 = gtid_221498;
    futhark_mc_segmap_parloop_struct_235722.free_mem_221499 = mem_221499.mem;
    futhark_mc_segmap_parloop_struct_235722.free_mem_221511 = mem_221511.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235723_task;
    
    futhark_mc_segmap_parloop_235723_task.name =
        "futhark_mc_segmap_parloop_235723";
    futhark_mc_segmap_parloop_235723_task.fn = futhark_mc_segmap_parloop_235723;
    futhark_mc_segmap_parloop_235723_task.args =
        &futhark_mc_segmap_parloop_struct_235722;
    futhark_mc_segmap_parloop_235723_task.iterations = iterations;
    futhark_mc_segmap_parloop_235723_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235723_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235723_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235723_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235723_task);
    
    if (futhark_mc_segmap_parloop_235723_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235723_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235723_total_end -
                 futhark_mc_segmap_parloop_235723_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235723_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235723_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235723_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235721_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235721_end -
                 futhark_mc_segmap_task_235721_start;
        
        ctx->futhark_mc_segmap_task_235721_runs[tid]++;
        ctx->futhark_mc_segmap_task_235721_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235721_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235710(void *args, int64_t start,
                                            int64_t end, int flat_tid_221497,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235709
    *futhark_mc_segmap_parloop_struct_235709 =
    (struct futhark_mc_segmap_parloop_struct_235709 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235709->ctx;
    uint64_t futhark_mc_segmap_parloop_235710_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235710_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235709->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235709->free_defunc_0_f_res_203721;
    int64_t i_203808 = futhark_mc_segmap_parloop_struct_235709->free_i_203808;
    int64_t gtid_207121 =
            futhark_mc_segmap_parloop_struct_235709->free_gtid_207121;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235709->free_bytes_217463;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_segmap_parloop_struct_235709->free_mem_217532,
                                  .size =0, .references =NULL};
    struct memblock mem_217572 = {.desc ="mem_217572", .mem =
                                  futhark_mc_segmap_parloop_struct_235709->free_mem_217572,
                                  .size =0, .references =NULL};
    struct memblock mem_217575 = {.desc ="mem_217575", .mem =
                                  futhark_mc_segmap_parloop_struct_235709->free_mem_217575,
                                  .size =0, .references =NULL};
    size_t mem_221499_cached_sizze_235711 = 0;
    unsigned char *mem_221499 = NULL;
    size_t mem_221511_cached_sizze_235712 = 0;
    unsigned char *mem_221511 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221578 = start;
    
    if (mem_221499_cached_sizze_235711 < (size_t) bytes_217463) {
        mem_221499 = realloc(mem_221499, bytes_217463);
        mem_221499_cached_sizze_235711 = bytes_217463;
    }
    if (mem_221511_cached_sizze_235712 < (size_t) bytes_217463) {
        mem_221511 = realloc(mem_221511, bytes_217463);
        mem_221511_cached_sizze_235712 = bytes_217463;
    }
    for (; iter_221578 < end; iter_221578++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221596 = n_p_203574;
        int64_t gtid_221498 = iter_221578;
        int64_t remnant_221597 = iter_221578 - gtid_221498;
        int64_t flat_tid_221579 = (int64_t) 0;
        int32_t num_tasks_221598;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_235713 futhark_mc_task_235713;
        
        futhark_mc_task_235713.ctx = ctx;
        futhark_mc_task_235713.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235713.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235713.free_gtid_207121 = gtid_207121;
        futhark_mc_task_235713.free_mem_217532 = mem_217532.mem;
        futhark_mc_task_235713.free_gtid_221498 = gtid_221498;
        futhark_mc_task_235713.free_mem_221499 = mem_221499;
        
        struct scheduler_segop futhark_mc_task_235713_task;
        
        futhark_mc_task_235713_task.args = &futhark_mc_task_235713;
        futhark_mc_task_235713_task.top_level_fn =
            futhark_mc_segscan_task_235714;
        futhark_mc_task_235713_task.name = "futhark_mc_segscan_task_235714";
        futhark_mc_task_235713_task.iterations = defunc_0_f_res_203721;
        futhark_mc_task_235713_task.task_time =
            &ctx->futhark_mc_segscan_task_235714_total_time;
        futhark_mc_task_235713_task.task_iter =
            &ctx->futhark_mc_segscan_task_235714_total_iter;
        futhark_mc_task_235713_task.sched = STATIC;
        futhark_mc_task_235713_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_235714_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235713_task);
        
        if (futhark_mc_segscan_task_235714_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_221510;
        
        last_res_221510 = ((int64_t *) mem_221499)[i_203808];
        for (int64_t i_221612 = 0; i_221612 < defunc_0_f_res_203721;
             i_221612++) {
            ((int64_t *) mem_221511)[i_221612] = (int64_t) -1;
        }
        
        int64_t flat_tid_221588 = (int64_t) 0;
        int32_t num_tasks_221613;
        struct futhark_mc_task_235720 futhark_mc_task_235720;
        
        futhark_mc_task_235720.ctx = ctx;
        futhark_mc_task_235720.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235720.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235720.free_gtid_207121 = gtid_207121;
        futhark_mc_task_235720.free_mem_217532 = mem_217532.mem;
        futhark_mc_task_235720.free_gtid_221498 = gtid_221498;
        futhark_mc_task_235720.free_mem_221499 = mem_221499;
        futhark_mc_task_235720.free_mem_221511 = mem_221511;
        
        struct scheduler_segop futhark_mc_task_235720_task;
        
        futhark_mc_task_235720_task.args = &futhark_mc_task_235720;
        futhark_mc_task_235720_task.top_level_fn =
            futhark_mc_segmap_task_235721;
        futhark_mc_task_235720_task.name = "futhark_mc_segmap_task_235721";
        futhark_mc_task_235720_task.iterations = defunc_0_f_res_203721;
        futhark_mc_task_235720_task.task_time =
            &ctx->futhark_mc_segmap_task_235721_total_time;
        futhark_mc_task_235720_task.task_iter =
            &ctx->futhark_mc_segmap_task_235721_total_iter;
        futhark_mc_task_235720_task.sched = STATIC;
        futhark_mc_task_235720_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235721_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235720_task);
        
        if (futhark_mc_segmap_task_235721_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_217572.mem + gtid_221498 * defunc_0_f_res_203721 *
                    (int64_t) 8, mem_221511 + (int64_t) 0,
                    defunc_0_f_res_203721 * (int64_t) 8);
        ((int64_t *) mem_217575.mem)[gtid_221498] = last_res_221510;
    }
    
  cleanup:
    { }
    free(mem_221499);
    free(mem_221511);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235710_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235710_end -
                 futhark_mc_segmap_parloop_235710_start;
        
        ctx->futhark_mc_segmap_parloop_235710_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235710_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235710_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235708(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221497 = tid;
    int num_tasks_221552 = info.nsubtasks;
    struct futhark_mc_task_235702 *futhark_mc_task_235702 =
                                  (struct futhark_mc_task_235702 *) args;
    struct futhark_context *ctx = futhark_mc_task_235702->ctx;
    uint64_t futhark_mc_segmap_nested_task_235708_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235708_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235702->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235702->free_defunc_0_f_res_203721;
    int64_t i_203808 = futhark_mc_task_235702->free_i_203808;
    int64_t gtid_207121 = futhark_mc_task_235702->free_gtid_207121;
    int64_t bytes_217463 = futhark_mc_task_235702->free_bytes_217463;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_task_235702->free_mem_217532,
                                  .size =0, .references =NULL};
    struct memblock mem_217572 = {.desc ="mem_217572", .mem =
                                  futhark_mc_task_235702->free_mem_217572,
                                  .size =0, .references =NULL};
    struct memblock mem_217575 = {.desc ="mem_217575", .mem =
                                  futhark_mc_task_235702->free_mem_217575,
                                  .size =0, .references =NULL};
    int64_t iter_221578;
    struct futhark_mc_segmap_parloop_struct_235709
    futhark_mc_segmap_parloop_struct_235709;
    
    futhark_mc_segmap_parloop_struct_235709.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235709.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235709.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235709.free_i_203808 = i_203808;
    futhark_mc_segmap_parloop_struct_235709.free_gtid_207121 = gtid_207121;
    futhark_mc_segmap_parloop_struct_235709.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235709.free_mem_217532 = mem_217532.mem;
    futhark_mc_segmap_parloop_struct_235709.free_mem_217572 = mem_217572.mem;
    futhark_mc_segmap_parloop_struct_235709.free_mem_217575 = mem_217575.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235710_task;
    
    futhark_mc_segmap_parloop_235710_task.name =
        "futhark_mc_segmap_parloop_235710";
    futhark_mc_segmap_parloop_235710_task.fn = futhark_mc_segmap_parloop_235710;
    futhark_mc_segmap_parloop_235710_task.args =
        &futhark_mc_segmap_parloop_struct_235709;
    futhark_mc_segmap_parloop_235710_task.iterations = iterations;
    futhark_mc_segmap_parloop_235710_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235710_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235710_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235710_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235710_task);
    
    if (futhark_mc_segmap_parloop_235710_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235710_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235710_total_end -
                 futhark_mc_segmap_parloop_235710_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235710_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235710_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235710_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235708_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235708_end -
                 futhark_mc_segmap_nested_task_235708_start;
        
        ctx->futhark_mc_segmap_nested_task_235708_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235708_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235708_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235699(void *args, int64_t start,
                                            int64_t end, int flat_tid_207120,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235698
    *futhark_mc_segmap_parloop_struct_235698 =
    (struct futhark_mc_segmap_parloop_struct_235698 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235698->ctx;
    uint64_t futhark_mc_segmap_parloop_235699_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235699_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235698->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235698->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235698->free_defunc_0_f_res_203721;
    int64_t i_203808 = futhark_mc_segmap_parloop_struct_235698->free_i_203808;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235698->free_bytes_217463;
    int64_t bytes_217482 =
            futhark_mc_segmap_parloop_struct_235698->free_bytes_217482;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_segmap_parloop_struct_235698->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t bytes_217574 =
            futhark_mc_segmap_parloop_struct_235698->free_bytes_217574;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235698->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235698->free_mem_217658,
                                  .size =0, .references =NULL};
    size_t mem_217572_cached_sizze_235700 = 0;
    unsigned char *mem_217572 = NULL;
    size_t mem_217575_cached_sizze_235701 = 0;
    unsigned char *mem_217575 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221496 = start;
    
    if (mem_217572_cached_sizze_235700 < (size_t) bytes_217482) {
        mem_217572 = realloc(mem_217572, bytes_217482);
        mem_217572_cached_sizze_235700 = bytes_217482;
    }
    if (mem_217575_cached_sizze_235701 < (size_t) bytes_217574) {
        mem_217575 = realloc(mem_217575, bytes_217574);
        mem_217575_cached_sizze_235701 = bytes_217574;
    }
    for (; iter_221496 < end; iter_221496++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221550 = partition_sizze_203667;
        int64_t gtid_207121 = iter_221496;
        int64_t remnant_221551 = iter_221496 - gtid_207121;
        int64_t flat_tid_221522 = (int64_t) 0;
        int32_t num_tasks_221552;
        int64_t flat_tid_221497 = (int64_t) 0;
        struct futhark_mc_task_235702 futhark_mc_task_235702;
        
        futhark_mc_task_235702.ctx = ctx;
        futhark_mc_task_235702.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235702.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235702.free_i_203808 = i_203808;
        futhark_mc_task_235702.free_gtid_207121 = gtid_207121;
        futhark_mc_task_235702.free_bytes_217463 = bytes_217463;
        futhark_mc_task_235702.free_mem_217532 = mem_217532.mem;
        futhark_mc_task_235702.free_mem_217572 = mem_217572;
        futhark_mc_task_235702.free_mem_217575 = mem_217575;
        
        struct scheduler_segop futhark_mc_task_235702_task;
        
        futhark_mc_task_235702_task.args = &futhark_mc_task_235702;
        futhark_mc_task_235702_task.top_level_fn =
            futhark_mc_segmap_task_235703;
        futhark_mc_task_235702_task.name = "futhark_mc_segmap_task_235703";
        futhark_mc_task_235702_task.iterations = n_p_203574;
        futhark_mc_task_235702_task.task_time =
            &ctx->futhark_mc_segmap_task_235703_total_time;
        futhark_mc_task_235702_task.task_iter =
            &ctx->futhark_mc_segmap_task_235703_total_iter;
        futhark_mc_task_235702_task.sched = STATIC;
        futhark_mc_task_235702_task.nested_fn =
            futhark_mc_segmap_nested_task_235708;
        
        int futhark_mc_segmap_task_235703_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235702_task);
        
        if (futhark_mc_segmap_task_235703_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_217654.mem + gtid_207121 * (defunc_0_f_res_203721 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_217572 + (int64_t) 0, n_p_203574 *
                    defunc_0_f_res_203721 * (int64_t) 8);
        if (n_p_203574 * (int64_t) 8 > 0)
            memmove(mem_217658.mem + gtid_207121 * n_p_203574 * (int64_t) 8,
                    mem_217575 + (int64_t) 0, n_p_203574 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217572);
    free(mem_217575);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235699_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235699_end -
                 futhark_mc_segmap_parloop_235699_start;
        
        ctx->futhark_mc_segmap_parloop_235699_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235699_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235699_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235697(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207120 = tid;
    int num_tasks_221458 = info.nsubtasks;
    struct futhark_mc_task_235689 *futhark_mc_task_235689 =
                                  (struct futhark_mc_task_235689 *) args;
    struct futhark_context *ctx = futhark_mc_task_235689->ctx;
    uint64_t futhark_mc_segmap_nested_task_235697_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235697_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235689->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235689->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235689->free_defunc_0_f_res_203721;
    int64_t i_203808 = futhark_mc_task_235689->free_i_203808;
    int64_t bytes_217463 = futhark_mc_task_235689->free_bytes_217463;
    int64_t bytes_217482 = futhark_mc_task_235689->free_bytes_217482;
    struct memblock mem_217532 = {.desc ="mem_217532", .mem =
                                  futhark_mc_task_235689->free_mem_217532,
                                  .size =0, .references =NULL};
    int64_t bytes_217574 = futhark_mc_task_235689->free_bytes_217574;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235689->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235689->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t iter_221496;
    struct futhark_mc_segmap_parloop_struct_235698
    futhark_mc_segmap_parloop_struct_235698;
    
    futhark_mc_segmap_parloop_struct_235698.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235698.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235698.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235698.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235698.free_i_203808 = i_203808;
    futhark_mc_segmap_parloop_struct_235698.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235698.free_bytes_217482 = bytes_217482;
    futhark_mc_segmap_parloop_struct_235698.free_mem_217532 = mem_217532.mem;
    futhark_mc_segmap_parloop_struct_235698.free_bytes_217574 = bytes_217574;
    futhark_mc_segmap_parloop_struct_235698.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235698.free_mem_217658 = mem_217658.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235699_task;
    
    futhark_mc_segmap_parloop_235699_task.name =
        "futhark_mc_segmap_parloop_235699";
    futhark_mc_segmap_parloop_235699_task.fn = futhark_mc_segmap_parloop_235699;
    futhark_mc_segmap_parloop_235699_task.args =
        &futhark_mc_segmap_parloop_struct_235698;
    futhark_mc_segmap_parloop_235699_task.iterations = iterations;
    futhark_mc_segmap_parloop_235699_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235699_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235699_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235699_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235699_task);
    
    if (futhark_mc_segmap_parloop_235699_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235699_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235699_total_end -
                 futhark_mc_segmap_parloop_235699_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235699_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235699_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235699_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235697_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235697_end -
                 futhark_mc_segmap_nested_task_235697_start;
        
        ctx->futhark_mc_segmap_nested_task_235697_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235697_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235697_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235724 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_i_203808;
    bool free_x_203809;
    int64_t free_min_res_203839;
    bool free_loop_cond_203844;
    double free_i64_res_203845;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
};
struct futhark_mc_segmap_parloop_struct_235726 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_i_203808;
    bool free_x_203809;
    int64_t free_min_res_203839;
    bool free_loop_cond_203844;
    double free_i64_res_203845;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
};
static int futhark_mc_segmap_parloop_235727(void *args, int64_t start,
                                            int64_t end, int flat_tid_207171,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235726
    *futhark_mc_segmap_parloop_struct_235726 =
    (struct futhark_mc_segmap_parloop_struct_235726 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235726->ctx;
    uint64_t futhark_mc_segmap_parloop_235727_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235727_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235726->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235726->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235726->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235726->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235726->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235726->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235726->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_segmap_parloop_struct_235726->free_i_203808;
    bool x_203809 = futhark_mc_segmap_parloop_struct_235726->free_x_203809;
    int64_t min_res_203839 =
            futhark_mc_segmap_parloop_struct_235726->free_min_res_203839;
    bool loop_cond_203844 =
         futhark_mc_segmap_parloop_struct_235726->free_loop_cond_203844;
    double i64_res_203845 =
           futhark_mc_segmap_parloop_struct_235726->free_i64_res_203845;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235726->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235726->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235726->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235726->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235726->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235726->free_mem_217833,
                                  .size =0, .references =NULL};
    size_t mem_217724_cached_sizze_235728 = 0;
    unsigned char *mem_217724 = NULL;
    size_t mem_217728_cached_sizze_235729 = 0;
    unsigned char *mem_217728 = NULL;
    size_t mem_217751_cached_sizze_235730 = 0;
    unsigned char *mem_217751 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221620 = start;
    
    if (mem_217724_cached_sizze_235728 < (size_t) bytes_217715) {
        mem_217724 = realloc(mem_217724, bytes_217715);
        mem_217724_cached_sizze_235728 = bytes_217715;
    }
    if (mem_217728_cached_sizze_235729 < (size_t) bytes_217715) {
        mem_217728 = realloc(mem_217728, bytes_217715);
        mem_217728_cached_sizze_235729 = bytes_217715;
    }
    if (mem_217751_cached_sizze_235730 < (size_t) bytes_217463) {
        mem_217751 = realloc(mem_217751, bytes_217463);
        mem_217751_cached_sizze_235730 = bytes_217463;
    }
    for (; iter_221620 < end; iter_221620++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_221748 = partition_sizze_203667;
        int64_t gtid_207172 = iter_221620;
        int64_t remnant_221749 = iter_221620 - gtid_207172;
        
        for (int64_t i_221621 = 0; i_221621 < n_p_203574; i_221621++) {
            int64_t x_221624;
            
            x_221624 = ((int64_t *) mem_217658.mem)[gtid_207172 * n_p_203574 +
                                                    i_221621];
            for (int64_t i_221627 = 0; i_221627 < defunc_0_f_res_203721;
                 i_221627++) {
                int64_t x_221629;
                
                x_221629 = ((int64_t *) mem_217654.mem)[gtid_207172 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_221621 *
                                                        defunc_0_f_res_203721 +
                                                        i_221627];
                
                int64_t defunc_0_f_res_221630 = add64((int64_t) 1, x_221629);
                
                ((int64_t *) mem_217751)[i_221627] = defunc_0_f_res_221630;
            }
            
            int64_t min_arg_221632 = sub64(x_221624, (int64_t) 1);
            int64_t min_arg_221633 = sub64(x_221624, min_res_203839);
            int64_t min_res_221634 = smin64(q_s_203575, x_221624);
            double i64_res_221635 = sitofp_i64_f64(x_221624);
            double x_221636 = i64_res_203845 - i64_res_221635;
            double max_arg_221637 = x_221636 / 2.0;
            double max_res_221638 = fmax64(0.0, max_arg_221637);
            
            for (int64_t i_221641 = 0; i_221641 < s_n_m_203726; i_221641++) {
                bool cond_221644 = i_221641 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_221645;
                
                if (cond_221644) {
                    defunc_0_m_fun_res_221645 = (int64_t) 0;
                } else {
                    int64_t y_221646 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_221647 = i_221641 == y_221646;
                    int64_t defunc_0_m_fun_res_f_res_221648;
                    
                    if (cond_221647) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_221649 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_221648 =
                            defunc_0_m_fun_res_f_res_t_res_221649;
                    } else {
                        int64_t x_221650 = sub64(i_221641, (int64_t) 1);
                        int64_t x_221651 = mul64(jump_s_203581, x_221650);
                        int64_t min_arg_221652 = add64((int64_t) 1, x_221651);
                        int64_t min_res_221653 = smin64(defunc_0_f_res_203721,
                                                        min_arg_221652);
                        
                        defunc_0_m_fun_res_f_res_221648 = min_res_221653;
                    }
                    defunc_0_m_fun_res_221645 = defunc_0_m_fun_res_f_res_221648;
                }
                
                bool init_idx_221654;
                int64_t init_idx_221655;
                int64_t init_idx_221656;
                bool loop_while_221657;
                int64_t low_221658;
                int64_t high_221659;
                
                loop_while_221657 = x_203809;
                low_221658 = (int64_t) 0;
                high_221659 = i_203808;
                while (loop_while_221657) {
                    int64_t x_221660 = add64(low_221658, high_221659);
                    int64_t mid_221661 = sdiv64(x_221660, (int64_t) 2);
                    bool x_221662 = sle64((int64_t) 0, mid_221661);
                    bool y_221663 = slt64(mid_221661, defunc_0_f_res_203721);
                    bool bounds_check_221664 = x_221662 && y_221663;
                    bool index_certs_221665;
                    
                    if (!bounds_check_221664) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) mid_221661,
                                      "] out of bounds for array of shape [",
                                      (long long) defunc_0_f_res_203721, "].",
                                      "-> #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_221666;
                    
                    mid_id_221666 = ((int64_t *) mem_217751)[mid_221661];
                    
                    bool cond_221667 = slt64(mid_id_221666, (int64_t) 0);
                    int64_t mid_idx_221668;
                    
                    if (cond_221667) {
                        mid_idx_221668 = (int64_t) 9223372036854775807;
                    } else {
                        mid_idx_221668 = mid_id_221666;
                    }
                    
                    bool cond_221669 = sle64(defunc_0_m_fun_res_221645,
                                             mid_idx_221668);
                    int64_t loopres_221670;
                    int64_t loopres_221671;
                    
                    if (cond_221669) {
                        int64_t loopres_t_res_221672 = sub64(mid_221661,
                                                             (int64_t) 1);
                        
                        loopres_221670 = low_221658;
                        loopres_221671 = loopres_t_res_221672;
                    } else {
                        int64_t loopres_f_res_221673 = add64((int64_t) 1,
                                                             mid_221661);
                        
                        loopres_221670 = loopres_f_res_221673;
                        loopres_221671 = high_221659;
                    }
                    
                    bool loop_cond_221674 = sle64(loopres_221670,
                                                  loopres_221671);
                    bool loop_while_tmp_221755 = loop_cond_221674;
                    int64_t low_tmp_221756 = loopres_221670;
                    int64_t high_tmp_221757 = loopres_221671;
                    
                    loop_while_221657 = loop_while_tmp_221755;
                    low_221658 = low_tmp_221756;
                    high_221659 = high_tmp_221757;
                }
                init_idx_221654 = loop_while_221657;
                init_idx_221655 = low_221658;
                init_idx_221656 = high_221659;
                
                bool idx_221675;
                int64_t idx_221676;
                int64_t idx_221677;
                int64_t idx_221678;
                bool loop_while_221679;
                int64_t l_idx_221680;
                int64_t r_idx_221681;
                int64_t span_221682;
                
                loop_while_221679 = loop_cond_203844;
                l_idx_221680 = init_idx_221655;
                r_idx_221681 = init_idx_221655;
                span_221682 = (int64_t) 1;
                while (loop_while_221679) {
                    int64_t max_arg_221683 = sub64(l_idx_221680, (int64_t) 1);
                    int64_t max_res_221684 = smax64((int64_t) 0,
                                                    max_arg_221683);
                    int64_t min_arg_221685 = add64((int64_t) 1, r_idx_221681);
                    int64_t min_res_221686 = smin64(min_arg_221632,
                                                    min_arg_221685);
                    bool x_221687 = sle64((int64_t) 0, max_res_221684);
                    bool y_221688 = slt64(max_res_221684,
                                          defunc_0_f_res_203721);
                    bool bounds_check_221689 = x_221687 && y_221688;
                    bool index_certs_221690;
                    
                    if (!bounds_check_221689) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) max_res_221684,
                                      "] out of bounds for array of shape [",
                                      (long long) defunc_0_f_res_203721, "].",
                                      "-> #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_221691;
                    
                    x_221691 = ((int64_t *) mem_217751)[max_res_221684];
                    
                    int64_t abs_arg_221692 = sub64(x_221691,
                                                   defunc_0_m_fun_res_221645);
                    int64_t abs_res_221693 = abs64(abs_arg_221692);
                    bool x_221694 = sle64((int64_t) 0, min_res_221686);
                    bool y_221695 = slt64(min_res_221686,
                                          defunc_0_f_res_203721);
                    bool bounds_check_221696 = x_221694 && y_221695;
                    bool index_certs_221697;
                    
                    if (!bounds_check_221696) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) min_res_221686,
                                      "] out of bounds for array of shape [",
                                      (long long) defunc_0_f_res_203721, "].",
                                      "-> #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_221698;
                    
                    x_221698 = ((int64_t *) mem_217751)[min_res_221686];
                    
                    int64_t abs_arg_221699 = sub64(x_221698,
                                                   defunc_0_m_fun_res_221645);
                    int64_t abs_res_221700 = abs64(abs_arg_221699);
                    bool cond_221701 = max_res_221684 == l_idx_221680;
                    int64_t loopres_221702;
                    int64_t loopres_221703;
                    int64_t loopres_221704;
                    
                    if (cond_221701) {
                        loopres_221702 = l_idx_221680;
                        loopres_221703 = r_idx_221681;
                        loopres_221704 = min_res_203839;
                    } else {
                        bool cond_221705 = slt64(abs_res_221693,
                                                 abs_res_221700);
                        bool cond_f_res_221706 = min_res_221686 == r_idx_221681;
                        bool x_221707 = !cond_221705;
                        bool y_221708 = cond_f_res_221706 && x_221707;
                        bool cond_221709 = cond_221705 || y_221708;
                        int64_t loopres_f_res_221710;
                        
                        if (cond_221709) {
                            loopres_f_res_221710 = max_res_221684;
                        } else {
                            loopres_f_res_221710 = l_idx_221680;
                        }
                        
                        int64_t loopres_f_res_221711;
                        
                        if (cond_221709) {
                            loopres_f_res_221711 = r_idx_221681;
                        } else {
                            loopres_f_res_221711 = min_res_221686;
                        }
                        
                        int64_t loopres_f_res_221712;
                        
                        if (cond_221709) {
                            int64_t loopres_f_res_t_res_221713 =
                                    add64((int64_t) 1, span_221682);
                            
                            loopres_f_res_221712 = loopres_f_res_t_res_221713;
                        } else {
                            int64_t loopres_f_res_f_res_221714 =
                                    add64((int64_t) 1, span_221682);
                            
                            loopres_f_res_221712 = loopres_f_res_f_res_221714;
                        }
                        loopres_221702 = loopres_f_res_221710;
                        loopres_221703 = loopres_f_res_221711;
                        loopres_221704 = loopres_f_res_221712;
                    }
                    
                    bool loop_cond_221715 = slt64(loopres_221704,
                                                  min_res_203839);
                    bool loop_while_tmp_221758 = loop_cond_221715;
                    int64_t l_idx_tmp_221759 = loopres_221702;
                    int64_t r_idx_tmp_221760 = loopres_221703;
                    int64_t span_tmp_221761 = loopres_221704;
                    
                    loop_while_221679 = loop_while_tmp_221758;
                    l_idx_221680 = l_idx_tmp_221759;
                    r_idx_221681 = r_idx_tmp_221760;
                    span_221682 = span_tmp_221761;
                }
                idx_221675 = loop_while_221679;
                idx_221676 = l_idx_221680;
                idx_221677 = r_idx_221681;
                idx_221678 = span_221682;
                
                int64_t min_res_221716 = smin64(min_arg_221633, idx_221676);
                int64_t max_res_221717 = smax64((int64_t) 0, min_res_221716);
                int64_t defunc_0_m_fun_res_221718;
                
                if (cond_221644) {
                    defunc_0_m_fun_res_221718 = (int64_t) 0;
                } else {
                    int64_t y_221719 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_221720 = i_221641 == y_221719;
                    int64_t defunc_0_m_fun_res_f_res_221721;
                    
                    if (cond_221720) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_221722 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_221721 =
                            defunc_0_m_fun_res_f_res_t_res_221722;
                    } else {
                        int64_t x_221723 = sub64(i_221641, (int64_t) 1);
                        int64_t x_221724 = mul64(jump_s_203581, x_221723);
                        int64_t min_arg_221725 = add64((int64_t) 1, x_221724);
                        int64_t min_res_221726 = smin64(defunc_0_f_res_203721,
                                                        min_arg_221725);
                        
                        defunc_0_m_fun_res_f_res_221721 = min_res_221726;
                    }
                    defunc_0_m_fun_res_221718 = defunc_0_m_fun_res_f_res_221721;
                }
                
                int64_t x_221727 = add64(min_res_221634, max_res_221717);
                int64_t r_221728 = sub64(x_221727, (int64_t) 1);
                bool x_221729 = sle64((int64_t) 0, r_221728);
                bool y_221730 = slt64(r_221728, defunc_0_f_res_203721);
                bool bounds_check_221731 = x_221729 && y_221730;
                bool index_certs_221732;
                
                if (!bounds_check_221731) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) r_221728,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203721, "].",
                                  "-> #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_221733;
                
                x_221733 = ((int64_t *) mem_217751)[r_221728];
                
                int64_t abs_arg_221734 = sub64(x_221733,
                                               defunc_0_m_fun_res_221718);
                int64_t abs_res_221735 = abs64(abs_arg_221734);
                bool x_221736 = sle64((int64_t) 0, max_res_221717);
                bool y_221737 = slt64(max_res_221717, defunc_0_f_res_203721);
                bool bounds_check_221738 = x_221736 && y_221737;
                bool index_certs_221739;
                
                if (!bounds_check_221738) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_221717,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203721, "].",
                                  "-> #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_221740;
                
                x_221740 = ((int64_t *) mem_217751)[max_res_221717];
                
                int64_t abs_arg_221741 = sub64(x_221740,
                                               defunc_0_m_fun_res_221718);
                int64_t abs_res_221742 = abs64(abs_arg_221741);
                int64_t max_res_221743 = smax64(abs_res_221735, abs_res_221742);
                double defunc_0_f_res_221744 = sitofp_i64_f64(max_res_221743);
                double defunc_1_f_res_221745 = max_res_221638 +
                       defunc_0_f_res_221744;
                
                ((double *) mem_217728)[i_221621 * s_n_m_203726 + i_221641] =
                    defunc_1_f_res_221745;
                ((int64_t *) mem_217724)[i_221621 * s_n_m_203726 + i_221641] =
                    max_res_221717;
            }
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_217828.mem + gtid_207172 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_217724 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_217833.mem + gtid_207172 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_217728 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217724);
    free(mem_217728);
    free(mem_217751);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235727_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235727_end -
                 futhark_mc_segmap_parloop_235727_start;
        
        ctx->futhark_mc_segmap_parloop_235727_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235727_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235727_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235725(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207171 = tid;
    int num_tasks_221619 = info.nsubtasks;
    struct futhark_mc_task_235724 *futhark_mc_task_235724 =
                                  (struct futhark_mc_task_235724 *) args;
    struct futhark_context *ctx = futhark_mc_task_235724->ctx;
    uint64_t futhark_mc_segmap_task_235725_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235725_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235724->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235724->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235724->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235724->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235724->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235724->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235724->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_task_235724->free_i_203808;
    bool x_203809 = futhark_mc_task_235724->free_x_203809;
    int64_t min_res_203839 = futhark_mc_task_235724->free_min_res_203839;
    bool loop_cond_203844 = futhark_mc_task_235724->free_loop_cond_203844;
    double i64_res_203845 = futhark_mc_task_235724->free_i64_res_203845;
    int64_t bytes_217463 = futhark_mc_task_235724->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235724->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235724->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235724->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235724->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235724->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235724->free_mem_217833,
                                  .size =0, .references =NULL};
    int64_t iter_221620;
    struct futhark_mc_segmap_parloop_struct_235726
    futhark_mc_segmap_parloop_struct_235726;
    
    futhark_mc_segmap_parloop_struct_235726.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235726.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235726.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235726.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235726.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235726.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235726.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235726.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235726.free_i_203808 = i_203808;
    futhark_mc_segmap_parloop_struct_235726.free_x_203809 = x_203809;
    futhark_mc_segmap_parloop_struct_235726.free_min_res_203839 =
        min_res_203839;
    futhark_mc_segmap_parloop_struct_235726.free_loop_cond_203844 =
        loop_cond_203844;
    futhark_mc_segmap_parloop_struct_235726.free_i64_res_203845 =
        i64_res_203845;
    futhark_mc_segmap_parloop_struct_235726.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235726.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235726.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235726.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235726.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235726.free_mem_217833 = mem_217833.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235727_task;
    
    futhark_mc_segmap_parloop_235727_task.name =
        "futhark_mc_segmap_parloop_235727";
    futhark_mc_segmap_parloop_235727_task.fn = futhark_mc_segmap_parloop_235727;
    futhark_mc_segmap_parloop_235727_task.args =
        &futhark_mc_segmap_parloop_struct_235726;
    futhark_mc_segmap_parloop_235727_task.iterations = iterations;
    futhark_mc_segmap_parloop_235727_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235727_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235727_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235727_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235727_task);
    
    if (futhark_mc_segmap_parloop_235727_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235727_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235727_total_end -
                 futhark_mc_segmap_parloop_235727_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235727_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235727_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235727_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235725_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235725_end -
                 futhark_mc_segmap_task_235725_start;
        
        ctx->futhark_mc_segmap_task_235725_runs[tid]++;
        ctx->futhark_mc_segmap_task_235725_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235725_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235732 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_i_203808;
    bool free_x_203809;
    int64_t free_min_res_203839;
    bool free_loop_cond_203844;
    double free_i64_res_203845;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
};
struct futhark_mc_task_235736 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_i_203808;
    bool free_x_203809;
    int64_t free_min_res_203839;
    bool free_loop_cond_203844;
    double free_i64_res_203845;
    int64_t free_gtid_207307;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217716;
    unsigned char *free_mem_217720;
};
struct futhark_mc_segmap_parloop_struct_235738 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_i_203808;
    bool free_x_203809;
    int64_t free_min_res_203839;
    bool free_loop_cond_203844;
    double free_i64_res_203845;
    int64_t free_gtid_207307;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217716;
    unsigned char *free_mem_217720;
};
static int futhark_mc_segmap_parloop_235739(void *args, int64_t start,
                                            int64_t end, int flat_tid_221887,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235738
    *futhark_mc_segmap_parloop_struct_235738 =
    (struct futhark_mc_segmap_parloop_struct_235738 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235738->ctx;
    uint64_t futhark_mc_segmap_parloop_235739_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235739_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235738->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235738->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235738->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235738->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235738->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235738->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_segmap_parloop_struct_235738->free_i_203808;
    bool x_203809 = futhark_mc_segmap_parloop_struct_235738->free_x_203809;
    int64_t min_res_203839 =
            futhark_mc_segmap_parloop_struct_235738->free_min_res_203839;
    bool loop_cond_203844 =
         futhark_mc_segmap_parloop_struct_235738->free_loop_cond_203844;
    double i64_res_203845 =
           futhark_mc_segmap_parloop_struct_235738->free_i64_res_203845;
    int64_t gtid_207307 =
            futhark_mc_segmap_parloop_struct_235738->free_gtid_207307;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235738->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235738->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235738->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235738->free_bytes_217663;
    struct memblock mem_217716 = {.desc ="mem_217716", .mem =
                                  futhark_mc_segmap_parloop_struct_235738->free_mem_217716,
                                  .size =0, .references =NULL};
    struct memblock mem_217720 = {.desc ="mem_217720", .mem =
                                  futhark_mc_segmap_parloop_struct_235738->free_mem_217720,
                                  .size =0, .references =NULL};
    size_t mem_221890_cached_sizze_235740 = 0;
    unsigned char *mem_221890 = NULL;
    size_t mem_221905_cached_sizze_235741 = 0;
    unsigned char *mem_221905 = NULL;
    size_t mem_221907_cached_sizze_235742 = 0;
    unsigned char *mem_221907 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222021 = start;
    
    if (mem_221890_cached_sizze_235740 < (size_t) bytes_217463) {
        mem_221890 = realloc(mem_221890, bytes_217463);
        mem_221890_cached_sizze_235740 = bytes_217463;
    }
    if (mem_221905_cached_sizze_235741 < (size_t) bytes_217663) {
        mem_221905 = realloc(mem_221905, bytes_217663);
        mem_221905_cached_sizze_235741 = bytes_217663;
    }
    if (mem_221907_cached_sizze_235742 < (size_t) bytes_217663) {
        mem_221907 = realloc(mem_221907, bytes_217663);
        mem_221907_cached_sizze_235742 = bytes_217663;
    }
    for (; iter_222021 < end; iter_222021++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222134 = n_p_203574;
        int64_t gtid_221888 = iter_222021;
        int64_t remnant_222135 = iter_222021 - gtid_221888;
        int64_t x_221889;
        
        x_221889 = ((int64_t *) mem_217658.mem)[gtid_207307 * n_p_203574 +
                                                gtid_221888];
        for (int64_t i_222022 = 0; i_222022 < defunc_0_f_res_203721;
             i_222022++) {
            int64_t x_222024;
            
            x_222024 = ((int64_t *) mem_217654.mem)[gtid_207307 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_221888 *
                                                    defunc_0_f_res_203721 +
                                                    i_222022];
            
            int64_t defunc_0_f_res_222025 = add64((int64_t) 1, x_222024);
            
            ((int64_t *) mem_221890)[i_222022] = defunc_0_f_res_222025;
        }
        
        int64_t min_arg_221898 = sub64(x_221889, (int64_t) 1);
        int64_t min_arg_221899 = sub64(x_221889, min_res_203839);
        int64_t min_res_221900 = smin64(q_s_203575, x_221889);
        double i64_res_221901 = sitofp_i64_f64(x_221889);
        double x_221902 = i64_res_203845 - i64_res_221901;
        double max_arg_221903 = x_221902 / 2.0;
        double max_res_221904 = fmax64(0.0, max_arg_221903);
        
        for (int64_t i_222027 = 0; i_222027 < s_n_m_203726; i_222027++) {
            bool cond_222030 = i_222027 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_222031;
            
            if (cond_222030) {
                defunc_0_m_fun_res_222031 = (int64_t) 0;
            } else {
                int64_t y_222032 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_222033 = i_222027 == y_222032;
                int64_t defunc_0_m_fun_res_f_res_222034;
                
                if (cond_222033) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_222035 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_222034 =
                        defunc_0_m_fun_res_f_res_t_res_222035;
                } else {
                    int64_t x_222036 = sub64(i_222027, (int64_t) 1);
                    int64_t x_222037 = mul64(jump_s_203581, x_222036);
                    int64_t min_arg_222038 = add64((int64_t) 1, x_222037);
                    int64_t min_res_222039 = smin64(defunc_0_f_res_203721,
                                                    min_arg_222038);
                    
                    defunc_0_m_fun_res_f_res_222034 = min_res_222039;
                }
                defunc_0_m_fun_res_222031 = defunc_0_m_fun_res_f_res_222034;
            }
            
            bool init_idx_222040;
            int64_t init_idx_222041;
            int64_t init_idx_222042;
            bool loop_while_222043;
            int64_t low_222044;
            int64_t high_222045;
            
            loop_while_222043 = x_203809;
            low_222044 = (int64_t) 0;
            high_222045 = i_203808;
            while (loop_while_222043) {
                int64_t x_222046 = add64(low_222044, high_222045);
                int64_t mid_222047 = sdiv64(x_222046, (int64_t) 2);
                bool x_222048 = sle64((int64_t) 0, mid_222047);
                bool y_222049 = slt64(mid_222047, defunc_0_f_res_203721);
                bool bounds_check_222050 = x_222048 && y_222049;
                bool index_certs_222051;
                
                if (!bounds_check_222050) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_222047,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203721, "].",
                                  "-> #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_222052;
                
                mid_id_222052 = ((int64_t *) mem_221890)[mid_222047];
                
                bool cond_222053 = slt64(mid_id_222052, (int64_t) 0);
                int64_t mid_idx_222054;
                
                if (cond_222053) {
                    mid_idx_222054 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_222054 = mid_id_222052;
                }
                
                bool cond_222055 = sle64(defunc_0_m_fun_res_222031,
                                         mid_idx_222054);
                int64_t loopres_222056;
                int64_t loopres_222057;
                
                if (cond_222055) {
                    int64_t loopres_t_res_222058 = sub64(mid_222047,
                                                         (int64_t) 1);
                    
                    loopres_222056 = low_222044;
                    loopres_222057 = loopres_t_res_222058;
                } else {
                    int64_t loopres_f_res_222059 = add64((int64_t) 1,
                                                         mid_222047);
                    
                    loopres_222056 = loopres_f_res_222059;
                    loopres_222057 = high_222045;
                }
                
                bool loop_cond_222060 = sle64(loopres_222056, loopres_222057);
                bool loop_while_tmp_222139 = loop_cond_222060;
                int64_t low_tmp_222140 = loopres_222056;
                int64_t high_tmp_222141 = loopres_222057;
                
                loop_while_222043 = loop_while_tmp_222139;
                low_222044 = low_tmp_222140;
                high_222045 = high_tmp_222141;
            }
            init_idx_222040 = loop_while_222043;
            init_idx_222041 = low_222044;
            init_idx_222042 = high_222045;
            
            bool idx_222061;
            int64_t idx_222062;
            int64_t idx_222063;
            int64_t idx_222064;
            bool loop_while_222065;
            int64_t l_idx_222066;
            int64_t r_idx_222067;
            int64_t span_222068;
            
            loop_while_222065 = loop_cond_203844;
            l_idx_222066 = init_idx_222041;
            r_idx_222067 = init_idx_222041;
            span_222068 = (int64_t) 1;
            while (loop_while_222065) {
                int64_t max_arg_222069 = sub64(l_idx_222066, (int64_t) 1);
                int64_t max_res_222070 = smax64((int64_t) 0, max_arg_222069);
                int64_t min_arg_222071 = add64((int64_t) 1, r_idx_222067);
                int64_t min_res_222072 = smin64(min_arg_221898, min_arg_222071);
                bool x_222073 = sle64((int64_t) 0, max_res_222070);
                bool y_222074 = slt64(max_res_222070, defunc_0_f_res_203721);
                bool bounds_check_222075 = x_222073 && y_222074;
                bool index_certs_222076;
                
                if (!bounds_check_222075) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_222070,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203721, "].",
                                  "-> #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_222077;
                
                x_222077 = ((int64_t *) mem_221890)[max_res_222070];
                
                int64_t abs_arg_222078 = sub64(x_222077,
                                               defunc_0_m_fun_res_222031);
                int64_t abs_res_222079 = abs64(abs_arg_222078);
                bool x_222080 = sle64((int64_t) 0, min_res_222072);
                bool y_222081 = slt64(min_res_222072, defunc_0_f_res_203721);
                bool bounds_check_222082 = x_222080 && y_222081;
                bool index_certs_222083;
                
                if (!bounds_check_222082) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_222072,
                                  "] out of bounds for array of shape [",
                                  (long long) defunc_0_f_res_203721, "].",
                                  "-> #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_222084;
                
                x_222084 = ((int64_t *) mem_221890)[min_res_222072];
                
                int64_t abs_arg_222085 = sub64(x_222084,
                                               defunc_0_m_fun_res_222031);
                int64_t abs_res_222086 = abs64(abs_arg_222085);
                bool cond_222087 = max_res_222070 == l_idx_222066;
                int64_t loopres_222088;
                int64_t loopres_222089;
                int64_t loopres_222090;
                
                if (cond_222087) {
                    loopres_222088 = l_idx_222066;
                    loopres_222089 = r_idx_222067;
                    loopres_222090 = min_res_203839;
                } else {
                    bool cond_222091 = slt64(abs_res_222079, abs_res_222086);
                    bool cond_f_res_222092 = min_res_222072 == r_idx_222067;
                    bool x_222093 = !cond_222091;
                    bool y_222094 = cond_f_res_222092 && x_222093;
                    bool cond_222095 = cond_222091 || y_222094;
                    int64_t loopres_f_res_222096;
                    
                    if (cond_222095) {
                        loopres_f_res_222096 = max_res_222070;
                    } else {
                        loopres_f_res_222096 = l_idx_222066;
                    }
                    
                    int64_t loopres_f_res_222097;
                    
                    if (cond_222095) {
                        loopres_f_res_222097 = r_idx_222067;
                    } else {
                        loopres_f_res_222097 = min_res_222072;
                    }
                    
                    int64_t loopres_f_res_222098;
                    
                    if (cond_222095) {
                        int64_t loopres_f_res_t_res_222099 = add64((int64_t) 1,
                                                                   span_222068);
                        
                        loopres_f_res_222098 = loopres_f_res_t_res_222099;
                    } else {
                        int64_t loopres_f_res_f_res_222100 = add64((int64_t) 1,
                                                                   span_222068);
                        
                        loopres_f_res_222098 = loopres_f_res_f_res_222100;
                    }
                    loopres_222088 = loopres_f_res_222096;
                    loopres_222089 = loopres_f_res_222097;
                    loopres_222090 = loopres_f_res_222098;
                }
                
                bool loop_cond_222101 = slt64(loopres_222090, min_res_203839);
                bool loop_while_tmp_222142 = loop_cond_222101;
                int64_t l_idx_tmp_222143 = loopres_222088;
                int64_t r_idx_tmp_222144 = loopres_222089;
                int64_t span_tmp_222145 = loopres_222090;
                
                loop_while_222065 = loop_while_tmp_222142;
                l_idx_222066 = l_idx_tmp_222143;
                r_idx_222067 = r_idx_tmp_222144;
                span_222068 = span_tmp_222145;
            }
            idx_222061 = loop_while_222065;
            idx_222062 = l_idx_222066;
            idx_222063 = r_idx_222067;
            idx_222064 = span_222068;
            
            int64_t min_res_222102 = smin64(min_arg_221899, idx_222062);
            int64_t max_res_222103 = smax64((int64_t) 0, min_res_222102);
            int64_t defunc_0_m_fun_res_222104;
            
            if (cond_222030) {
                defunc_0_m_fun_res_222104 = (int64_t) 0;
            } else {
                int64_t y_222105 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_222106 = i_222027 == y_222105;
                int64_t defunc_0_m_fun_res_f_res_222107;
                
                if (cond_222106) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_222108 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_222107 =
                        defunc_0_m_fun_res_f_res_t_res_222108;
                } else {
                    int64_t x_222109 = sub64(i_222027, (int64_t) 1);
                    int64_t x_222110 = mul64(jump_s_203581, x_222109);
                    int64_t min_arg_222111 = add64((int64_t) 1, x_222110);
                    int64_t min_res_222112 = smin64(defunc_0_f_res_203721,
                                                    min_arg_222111);
                    
                    defunc_0_m_fun_res_f_res_222107 = min_res_222112;
                }
                defunc_0_m_fun_res_222104 = defunc_0_m_fun_res_f_res_222107;
            }
            
            int64_t x_222113 = add64(min_res_221900, max_res_222103);
            int64_t r_222114 = sub64(x_222113, (int64_t) 1);
            bool x_222115 = sle64((int64_t) 0, r_222114);
            bool y_222116 = slt64(r_222114, defunc_0_f_res_203721);
            bool bounds_check_222117 = x_222115 && y_222116;
            bool index_certs_222118;
            
            if (!bounds_check_222117) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_222114,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203721, "].",
                              "-> #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_222119;
            
            x_222119 = ((int64_t *) mem_221890)[r_222114];
            
            int64_t abs_arg_222120 = sub64(x_222119, defunc_0_m_fun_res_222104);
            int64_t abs_res_222121 = abs64(abs_arg_222120);
            bool x_222122 = sle64((int64_t) 0, max_res_222103);
            bool y_222123 = slt64(max_res_222103, defunc_0_f_res_203721);
            bool bounds_check_222124 = x_222122 && y_222123;
            bool index_certs_222125;
            
            if (!bounds_check_222124) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222103,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203721, "].",
                              "-> #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_222126;
            
            x_222126 = ((int64_t *) mem_221890)[max_res_222103];
            
            int64_t abs_arg_222127 = sub64(x_222126, defunc_0_m_fun_res_222104);
            int64_t abs_res_222128 = abs64(abs_arg_222127);
            int64_t max_res_222129 = smax64(abs_res_222121, abs_res_222128);
            double defunc_0_f_res_222130 = sitofp_i64_f64(max_res_222129);
            double defunc_1_f_res_222131 = max_res_221904 +
                   defunc_0_f_res_222130;
            
            ((double *) mem_221905)[i_222027] = defunc_1_f_res_222131;
            ((int64_t *) mem_221907)[i_222027] = max_res_222103;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_217716.mem + gtid_221888 * s_n_m_203726 * (int64_t) 8,
                    mem_221907 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_217720.mem + gtid_221888 * s_n_m_203726 * (int64_t) 8,
                    mem_221905 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_221890);
    free(mem_221905);
    free(mem_221907);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235739_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235739_end -
                 futhark_mc_segmap_parloop_235739_start;
        
        ctx->futhark_mc_segmap_parloop_235739_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235739_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235739_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235737(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221887 = tid;
    int num_tasks_222020 = info.nsubtasks;
    struct futhark_mc_task_235736 *futhark_mc_task_235736 =
                                  (struct futhark_mc_task_235736 *) args;
    struct futhark_context *ctx = futhark_mc_task_235736->ctx;
    uint64_t futhark_mc_segmap_task_235737_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235737_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235736->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235736->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235736->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235736->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235736->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235736->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_task_235736->free_i_203808;
    bool x_203809 = futhark_mc_task_235736->free_x_203809;
    int64_t min_res_203839 = futhark_mc_task_235736->free_min_res_203839;
    bool loop_cond_203844 = futhark_mc_task_235736->free_loop_cond_203844;
    double i64_res_203845 = futhark_mc_task_235736->free_i64_res_203845;
    int64_t gtid_207307 = futhark_mc_task_235736->free_gtid_207307;
    int64_t bytes_217463 = futhark_mc_task_235736->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235736->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235736->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235736->free_bytes_217663;
    struct memblock mem_217716 = {.desc ="mem_217716", .mem =
                                  futhark_mc_task_235736->free_mem_217716,
                                  .size =0, .references =NULL};
    struct memblock mem_217720 = {.desc ="mem_217720", .mem =
                                  futhark_mc_task_235736->free_mem_217720,
                                  .size =0, .references =NULL};
    int64_t iter_222021;
    struct futhark_mc_segmap_parloop_struct_235738
    futhark_mc_segmap_parloop_struct_235738;
    
    futhark_mc_segmap_parloop_struct_235738.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235738.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235738.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235738.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235738.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235738.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235738.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235738.free_i_203808 = i_203808;
    futhark_mc_segmap_parloop_struct_235738.free_x_203809 = x_203809;
    futhark_mc_segmap_parloop_struct_235738.free_min_res_203839 =
        min_res_203839;
    futhark_mc_segmap_parloop_struct_235738.free_loop_cond_203844 =
        loop_cond_203844;
    futhark_mc_segmap_parloop_struct_235738.free_i64_res_203845 =
        i64_res_203845;
    futhark_mc_segmap_parloop_struct_235738.free_gtid_207307 = gtid_207307;
    futhark_mc_segmap_parloop_struct_235738.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235738.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235738.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235738.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235738.free_mem_217716 = mem_217716.mem;
    futhark_mc_segmap_parloop_struct_235738.free_mem_217720 = mem_217720.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235739_task;
    
    futhark_mc_segmap_parloop_235739_task.name =
        "futhark_mc_segmap_parloop_235739";
    futhark_mc_segmap_parloop_235739_task.fn = futhark_mc_segmap_parloop_235739;
    futhark_mc_segmap_parloop_235739_task.args =
        &futhark_mc_segmap_parloop_struct_235738;
    futhark_mc_segmap_parloop_235739_task.iterations = iterations;
    futhark_mc_segmap_parloop_235739_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235739_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235739_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235739_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235739_task);
    
    if (futhark_mc_segmap_parloop_235739_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235739_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235739_total_end -
                 futhark_mc_segmap_parloop_235739_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235739_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235739_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235739_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235737_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235737_end -
                 futhark_mc_segmap_task_235737_start;
        
        ctx->futhark_mc_segmap_task_235737_runs[tid]++;
        ctx->futhark_mc_segmap_task_235737_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235737_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235744 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_i_203808;
    bool free_x_203809;
    int64_t free_min_res_203839;
    bool free_loop_cond_203844;
    double free_i64_res_203845;
    int64_t free_gtid_207307;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217716;
    unsigned char *free_mem_217720;
};
struct futhark_mc_task_235749 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_207307;
    unsigned char *free_mem_217654;
    int64_t free_gtid_221764;
    unsigned char *free_mem_221766;
};
struct futhark_mc_segmap_parloop_struct_235751 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_207307;
    unsigned char *free_mem_217654;
    int64_t free_gtid_221764;
    unsigned char *free_mem_221766;
};
static int futhark_mc_segmap_parloop_235752(void *args, int64_t start,
                                            int64_t end, int flat_tid_222147,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235751
    *futhark_mc_segmap_parloop_struct_235751 =
    (struct futhark_mc_segmap_parloop_struct_235751 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235751->ctx;
    uint64_t futhark_mc_segmap_parloop_235752_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235752_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235751->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235751->free_defunc_0_f_res_203721;
    int64_t gtid_207307 =
            futhark_mc_segmap_parloop_struct_235751->free_gtid_207307;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235751->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t gtid_221764 =
            futhark_mc_segmap_parloop_struct_235751->free_gtid_221764;
    struct memblock mem_221766 = {.desc ="mem_221766", .mem =
                                  futhark_mc_segmap_parloop_struct_235751->free_mem_221766,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222258 = start;
    
    for (; iter_222258 < end; iter_222258++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222259 = defunc_0_f_res_203721;
        int64_t gtid_222148 = iter_222258;
        int64_t remnant_222260 = iter_222258 - gtid_222148;
        int64_t x_222149;
        
        x_222149 = ((int64_t *) mem_217654.mem)[gtid_207307 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_221764 *
                                                defunc_0_f_res_203721 +
                                                gtid_222148];
        
        int64_t defunc_0_f_res_222150 = add64((int64_t) 1, x_222149);
        
        ((int64_t *) mem_221766.mem)[gtid_222148] = defunc_0_f_res_222150;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235752_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235752_end -
                 futhark_mc_segmap_parloop_235752_start;
        
        ctx->futhark_mc_segmap_parloop_235752_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235752_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235752_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235750(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222147 = tid;
    int num_tasks_222257 = info.nsubtasks;
    struct futhark_mc_task_235749 *futhark_mc_task_235749 =
                                  (struct futhark_mc_task_235749 *) args;
    struct futhark_context *ctx = futhark_mc_task_235749->ctx;
    uint64_t futhark_mc_segmap_task_235750_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235750_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235749->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235749->free_defunc_0_f_res_203721;
    int64_t gtid_207307 = futhark_mc_task_235749->free_gtid_207307;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235749->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t gtid_221764 = futhark_mc_task_235749->free_gtid_221764;
    struct memblock mem_221766 = {.desc ="mem_221766", .mem =
                                  futhark_mc_task_235749->free_mem_221766,
                                  .size =0, .references =NULL};
    int64_t iter_222258;
    struct futhark_mc_segmap_parloop_struct_235751
    futhark_mc_segmap_parloop_struct_235751;
    
    futhark_mc_segmap_parloop_struct_235751.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235751.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235751.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235751.free_gtid_207307 = gtid_207307;
    futhark_mc_segmap_parloop_struct_235751.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235751.free_gtid_221764 = gtid_221764;
    futhark_mc_segmap_parloop_struct_235751.free_mem_221766 = mem_221766.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235752_task;
    
    futhark_mc_segmap_parloop_235752_task.name =
        "futhark_mc_segmap_parloop_235752";
    futhark_mc_segmap_parloop_235752_task.fn = futhark_mc_segmap_parloop_235752;
    futhark_mc_segmap_parloop_235752_task.args =
        &futhark_mc_segmap_parloop_struct_235751;
    futhark_mc_segmap_parloop_235752_task.iterations = iterations;
    futhark_mc_segmap_parloop_235752_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235752_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235752_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235752_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235752_task);
    
    if (futhark_mc_segmap_parloop_235752_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235752_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235752_total_end -
                 futhark_mc_segmap_parloop_235752_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235752_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235752_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235752_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235750_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235750_end -
                 futhark_mc_segmap_task_235750_start;
        
        ctx->futhark_mc_segmap_task_235750_runs[tid]++;
        ctx->futhark_mc_segmap_task_235750_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235750_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235753 {
    struct futhark_context *ctx;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_i_203808;
    bool free_x_203809;
    int64_t free_min_res_203839;
    bool free_loop_cond_203844;
    unsigned char *free_mem_221766;
    int64_t free_min_arg_221772;
    int64_t free_min_arg_221773;
    int64_t free_min_res_221774;
    double free_max_res_221778;
    unsigned char *free_mem_221779;
    unsigned char *free_mem_221780;
};
struct futhark_mc_segmap_parloop_struct_235755 {
    struct futhark_context *ctx;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_i_203808;
    bool free_x_203809;
    int64_t free_min_res_203839;
    bool free_loop_cond_203844;
    unsigned char *free_mem_221766;
    int64_t free_min_arg_221772;
    int64_t free_min_arg_221773;
    int64_t free_min_res_221774;
    double free_max_res_221778;
    unsigned char *free_mem_221779;
    unsigned char *free_mem_221780;
};
static int futhark_mc_segmap_parloop_235756(void *args, int64_t start,
                                            int64_t end, int flat_tid_222151,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235755
    *futhark_mc_segmap_parloop_struct_235755 =
    (struct futhark_mc_segmap_parloop_struct_235755 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235755->ctx;
    uint64_t futhark_mc_segmap_parloop_235756_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235756_start = get_wall_time();
    
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235755->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235755->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235755->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235755->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_segmap_parloop_struct_235755->free_i_203808;
    bool x_203809 = futhark_mc_segmap_parloop_struct_235755->free_x_203809;
    int64_t min_res_203839 =
            futhark_mc_segmap_parloop_struct_235755->free_min_res_203839;
    bool loop_cond_203844 =
         futhark_mc_segmap_parloop_struct_235755->free_loop_cond_203844;
    struct memblock mem_221766 = {.desc ="mem_221766", .mem =
                                  futhark_mc_segmap_parloop_struct_235755->free_mem_221766,
                                  .size =0, .references =NULL};
    int64_t min_arg_221772 =
            futhark_mc_segmap_parloop_struct_235755->free_min_arg_221772;
    int64_t min_arg_221773 =
            futhark_mc_segmap_parloop_struct_235755->free_min_arg_221773;
    int64_t min_res_221774 =
            futhark_mc_segmap_parloop_struct_235755->free_min_res_221774;
    double max_res_221778 =
           futhark_mc_segmap_parloop_struct_235755->free_max_res_221778;
    struct memblock mem_221779 = {.desc ="mem_221779", .mem =
                                  futhark_mc_segmap_parloop_struct_235755->free_mem_221779,
                                  .size =0, .references =NULL};
    struct memblock mem_221780 = {.desc ="mem_221780", .mem =
                                  futhark_mc_segmap_parloop_struct_235755->free_mem_221780,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222262 = start;
    
    for (; iter_222262 < end; iter_222262++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222334 = s_n_m_203726;
        int64_t gtid_222152 = iter_222262;
        int64_t remnant_222335 = iter_222262 - gtid_222152;
        bool cond_222153 = gtid_222152 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_222154;
        
        if (cond_222153) {
            defunc_0_m_fun_res_222154 = (int64_t) 0;
        } else {
            int64_t y_222263 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_222264 = gtid_222152 == y_222263;
            int64_t defunc_0_m_fun_res_f_res_222265;
            
            if (cond_222264) {
                int64_t defunc_0_m_fun_res_f_res_t_res_222266 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_222265 =
                    defunc_0_m_fun_res_f_res_t_res_222266;
            } else {
                int64_t x_222267 = sub64(gtid_222152, (int64_t) 1);
                int64_t x_222268 = mul64(jump_s_203581, x_222267);
                int64_t min_arg_222269 = add64((int64_t) 1, x_222268);
                int64_t min_res_222270 = smin64(defunc_0_f_res_203721,
                                                min_arg_222269);
                
                defunc_0_m_fun_res_f_res_222265 = min_res_222270;
            }
            defunc_0_m_fun_res_222154 = defunc_0_m_fun_res_f_res_222265;
        }
        
        bool init_idx_222163;
        int64_t init_idx_222164;
        int64_t init_idx_222165;
        bool loop_while_222271;
        int64_t low_222272;
        int64_t high_222273;
        
        loop_while_222271 = x_203809;
        low_222272 = (int64_t) 0;
        high_222273 = i_203808;
        while (loop_while_222271) {
            int64_t x_222274 = add64(low_222272, high_222273);
            int64_t mid_222275 = sdiv64(x_222274, (int64_t) 2);
            bool x_222276 = sle64((int64_t) 0, mid_222275);
            bool y_222277 = slt64(mid_222275, defunc_0_f_res_203721);
            bool bounds_check_222278 = x_222276 && y_222277;
            bool index_certs_222279;
            
            if (!bounds_check_222278) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_222275,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203721, "].",
                              "-> #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_222280;
            
            mid_id_222280 = ((int64_t *) mem_221766.mem)[mid_222275];
            
            bool cond_222281 = slt64(mid_id_222280, (int64_t) 0);
            int64_t mid_idx_222282;
            
            if (cond_222281) {
                mid_idx_222282 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_222282 = mid_id_222280;
            }
            
            bool cond_222283 = sle64(defunc_0_m_fun_res_222154, mid_idx_222282);
            int64_t loopres_222284;
            int64_t loopres_222285;
            
            if (cond_222283) {
                int64_t loopres_t_res_222286 = sub64(mid_222275, (int64_t) 1);
                
                loopres_222284 = low_222272;
                loopres_222285 = loopres_t_res_222286;
            } else {
                int64_t loopres_f_res_222287 = add64((int64_t) 1, mid_222275);
                
                loopres_222284 = loopres_f_res_222287;
                loopres_222285 = high_222273;
            }
            
            bool loop_cond_222288 = sle64(loopres_222284, loopres_222285);
            bool loop_while_tmp_222336 = loop_cond_222288;
            int64_t low_tmp_222337 = loopres_222284;
            int64_t high_tmp_222338 = loopres_222285;
            
            loop_while_222271 = loop_while_tmp_222336;
            low_222272 = low_tmp_222337;
            high_222273 = high_tmp_222338;
        }
        init_idx_222163 = loop_while_222271;
        init_idx_222164 = low_222272;
        init_idx_222165 = high_222273;
        
        bool idx_222184;
        int64_t idx_222185;
        int64_t idx_222186;
        int64_t idx_222187;
        bool loop_while_222289;
        int64_t l_idx_222290;
        int64_t r_idx_222291;
        int64_t span_222292;
        
        loop_while_222289 = loop_cond_203844;
        l_idx_222290 = init_idx_222164;
        r_idx_222291 = init_idx_222164;
        span_222292 = (int64_t) 1;
        while (loop_while_222289) {
            int64_t max_arg_222293 = sub64(l_idx_222290, (int64_t) 1);
            int64_t max_res_222294 = smax64((int64_t) 0, max_arg_222293);
            int64_t min_arg_222295 = add64((int64_t) 1, r_idx_222291);
            int64_t min_res_222296 = smin64(min_arg_221772, min_arg_222295);
            bool x_222297 = sle64((int64_t) 0, max_res_222294);
            bool y_222298 = slt64(max_res_222294, defunc_0_f_res_203721);
            bool bounds_check_222299 = x_222297 && y_222298;
            bool index_certs_222300;
            
            if (!bounds_check_222299) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222294,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203721, "].",
                              "-> #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_222301;
            
            x_222301 = ((int64_t *) mem_221766.mem)[max_res_222294];
            
            int64_t abs_arg_222302 = sub64(x_222301, defunc_0_m_fun_res_222154);
            int64_t abs_res_222303 = abs64(abs_arg_222302);
            bool x_222304 = sle64((int64_t) 0, min_res_222296);
            bool y_222305 = slt64(min_res_222296, defunc_0_f_res_203721);
            bool bounds_check_222306 = x_222304 && y_222305;
            bool index_certs_222307;
            
            if (!bounds_check_222306) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_222296,
                              "] out of bounds for array of shape [",
                              (long long) defunc_0_f_res_203721, "].",
                              "-> #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_222308;
            
            x_222308 = ((int64_t *) mem_221766.mem)[min_res_222296];
            
            int64_t abs_arg_222309 = sub64(x_222308, defunc_0_m_fun_res_222154);
            int64_t abs_res_222310 = abs64(abs_arg_222309);
            bool cond_222311 = max_res_222294 == l_idx_222290;
            int64_t loopres_222312;
            int64_t loopres_222313;
            int64_t loopres_222314;
            
            if (cond_222311) {
                loopres_222312 = l_idx_222290;
                loopres_222313 = r_idx_222291;
                loopres_222314 = min_res_203839;
            } else {
                bool cond_222315 = slt64(abs_res_222303, abs_res_222310);
                bool cond_f_res_222316 = min_res_222296 == r_idx_222291;
                bool x_222317 = !cond_222315;
                bool y_222318 = cond_f_res_222316 && x_222317;
                bool cond_222319 = cond_222315 || y_222318;
                int64_t loopres_f_res_222320;
                
                if (cond_222319) {
                    loopres_f_res_222320 = max_res_222294;
                } else {
                    loopres_f_res_222320 = l_idx_222290;
                }
                
                int64_t loopres_f_res_222321;
                
                if (cond_222319) {
                    loopres_f_res_222321 = r_idx_222291;
                } else {
                    loopres_f_res_222321 = min_res_222296;
                }
                
                int64_t loopres_f_res_222322;
                
                if (cond_222319) {
                    int64_t loopres_f_res_t_res_222323 = add64((int64_t) 1,
                                                               span_222292);
                    
                    loopres_f_res_222322 = loopres_f_res_t_res_222323;
                } else {
                    int64_t loopres_f_res_f_res_222324 = add64((int64_t) 1,
                                                               span_222292);
                    
                    loopres_f_res_222322 = loopres_f_res_f_res_222324;
                }
                loopres_222312 = loopres_f_res_222320;
                loopres_222313 = loopres_f_res_222321;
                loopres_222314 = loopres_f_res_222322;
            }
            
            bool loop_cond_222325 = slt64(loopres_222314, min_res_203839);
            bool loop_while_tmp_222339 = loop_cond_222325;
            int64_t l_idx_tmp_222340 = loopres_222312;
            int64_t r_idx_tmp_222341 = loopres_222313;
            int64_t span_tmp_222342 = loopres_222314;
            
            loop_while_222289 = loop_while_tmp_222339;
            l_idx_222290 = l_idx_tmp_222340;
            r_idx_222291 = r_idx_tmp_222341;
            span_222292 = span_tmp_222342;
        }
        idx_222184 = loop_while_222289;
        idx_222185 = l_idx_222290;
        idx_222186 = r_idx_222291;
        idx_222187 = span_222292;
        
        int64_t min_res_222225 = smin64(min_arg_221773, idx_222185);
        int64_t max_res_222226 = smax64((int64_t) 0, min_res_222225);
        int64_t defunc_0_m_fun_res_222227;
        
        if (cond_222153) {
            defunc_0_m_fun_res_222227 = (int64_t) 0;
        } else {
            int64_t y_222326 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_222327 = gtid_222152 == y_222326;
            int64_t defunc_0_m_fun_res_f_res_222328;
            
            if (cond_222327) {
                int64_t defunc_0_m_fun_res_f_res_t_res_222329 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_222328 =
                    defunc_0_m_fun_res_f_res_t_res_222329;
            } else {
                int64_t x_222330 = sub64(gtid_222152, (int64_t) 1);
                int64_t x_222331 = mul64(jump_s_203581, x_222330);
                int64_t min_arg_222332 = add64((int64_t) 1, x_222331);
                int64_t min_res_222333 = smin64(defunc_0_f_res_203721,
                                                min_arg_222332);
                
                defunc_0_m_fun_res_f_res_222328 = min_res_222333;
            }
            defunc_0_m_fun_res_222227 = defunc_0_m_fun_res_f_res_222328;
        }
        
        int64_t x_222236 = add64(min_res_221774, max_res_222226);
        int64_t r_222237 = sub64(x_222236, (int64_t) 1);
        bool x_222238 = sle64((int64_t) 0, r_222237);
        bool y_222239 = slt64(r_222237, defunc_0_f_res_203721);
        bool bounds_check_222240 = x_222238 && y_222239;
        bool index_certs_222241;
        
        if (!bounds_check_222240) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_222237,
                                   "] out of bounds for array of shape [",
                                   (long long) defunc_0_f_res_203721, "].",
                                   "-> #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_222242;
        
        x_222242 = ((int64_t *) mem_221766.mem)[r_222237];
        
        int64_t abs_arg_222243 = sub64(x_222242, defunc_0_m_fun_res_222227);
        int64_t abs_res_222244 = abs64(abs_arg_222243);
        bool x_222245 = sle64((int64_t) 0, max_res_222226);
        bool y_222246 = slt64(max_res_222226, defunc_0_f_res_203721);
        bool bounds_check_222247 = x_222245 && y_222246;
        bool index_certs_222248;
        
        if (!bounds_check_222247) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_222226,
                                   "] out of bounds for array of shape [",
                                   (long long) defunc_0_f_res_203721, "].",
                                   "-> #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_222249;
        
        x_222249 = ((int64_t *) mem_221766.mem)[max_res_222226];
        
        int64_t abs_arg_222250 = sub64(x_222249, defunc_0_m_fun_res_222227);
        int64_t abs_res_222251 = abs64(abs_arg_222250);
        int64_t max_res_222252 = smax64(abs_res_222244, abs_res_222251);
        double defunc_0_f_res_222253 = sitofp_i64_f64(max_res_222252);
        double defunc_1_f_res_222254 = max_res_221778 + defunc_0_f_res_222253;
        
        ((double *) mem_221779.mem)[gtid_222152] = defunc_1_f_res_222254;
        ((int64_t *) mem_221780.mem)[gtid_222152] = max_res_222226;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235756_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235756_end -
                 futhark_mc_segmap_parloop_235756_start;
        
        ctx->futhark_mc_segmap_parloop_235756_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235756_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235756_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235754(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222151 = tid;
    int num_tasks_222261 = info.nsubtasks;
    struct futhark_mc_task_235753 *futhark_mc_task_235753 =
                                  (struct futhark_mc_task_235753 *) args;
    struct futhark_context *ctx = futhark_mc_task_235753->ctx;
    uint64_t futhark_mc_segmap_task_235754_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235754_start = get_wall_time();
    
    int64_t jump_s_203581 = futhark_mc_task_235753->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235753->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235753->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235753->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_task_235753->free_i_203808;
    bool x_203809 = futhark_mc_task_235753->free_x_203809;
    int64_t min_res_203839 = futhark_mc_task_235753->free_min_res_203839;
    bool loop_cond_203844 = futhark_mc_task_235753->free_loop_cond_203844;
    struct memblock mem_221766 = {.desc ="mem_221766", .mem =
                                  futhark_mc_task_235753->free_mem_221766,
                                  .size =0, .references =NULL};
    int64_t min_arg_221772 = futhark_mc_task_235753->free_min_arg_221772;
    int64_t min_arg_221773 = futhark_mc_task_235753->free_min_arg_221773;
    int64_t min_res_221774 = futhark_mc_task_235753->free_min_res_221774;
    double max_res_221778 = futhark_mc_task_235753->free_max_res_221778;
    struct memblock mem_221779 = {.desc ="mem_221779", .mem =
                                  futhark_mc_task_235753->free_mem_221779,
                                  .size =0, .references =NULL};
    struct memblock mem_221780 = {.desc ="mem_221780", .mem =
                                  futhark_mc_task_235753->free_mem_221780,
                                  .size =0, .references =NULL};
    int64_t iter_222262;
    struct futhark_mc_segmap_parloop_struct_235755
    futhark_mc_segmap_parloop_struct_235755;
    
    futhark_mc_segmap_parloop_struct_235755.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235755.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235755.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235755.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235755.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235755.free_i_203808 = i_203808;
    futhark_mc_segmap_parloop_struct_235755.free_x_203809 = x_203809;
    futhark_mc_segmap_parloop_struct_235755.free_min_res_203839 =
        min_res_203839;
    futhark_mc_segmap_parloop_struct_235755.free_loop_cond_203844 =
        loop_cond_203844;
    futhark_mc_segmap_parloop_struct_235755.free_mem_221766 = mem_221766.mem;
    futhark_mc_segmap_parloop_struct_235755.free_min_arg_221772 =
        min_arg_221772;
    futhark_mc_segmap_parloop_struct_235755.free_min_arg_221773 =
        min_arg_221773;
    futhark_mc_segmap_parloop_struct_235755.free_min_res_221774 =
        min_res_221774;
    futhark_mc_segmap_parloop_struct_235755.free_max_res_221778 =
        max_res_221778;
    futhark_mc_segmap_parloop_struct_235755.free_mem_221779 = mem_221779.mem;
    futhark_mc_segmap_parloop_struct_235755.free_mem_221780 = mem_221780.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235756_task;
    
    futhark_mc_segmap_parloop_235756_task.name =
        "futhark_mc_segmap_parloop_235756";
    futhark_mc_segmap_parloop_235756_task.fn = futhark_mc_segmap_parloop_235756;
    futhark_mc_segmap_parloop_235756_task.args =
        &futhark_mc_segmap_parloop_struct_235755;
    futhark_mc_segmap_parloop_235756_task.iterations = iterations;
    futhark_mc_segmap_parloop_235756_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235756_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235756_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235756_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235756_task);
    
    if (futhark_mc_segmap_parloop_235756_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235756_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235756_total_end -
                 futhark_mc_segmap_parloop_235756_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235756_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235756_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235756_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235754_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235754_end -
                 futhark_mc_segmap_task_235754_start;
        
        ctx->futhark_mc_segmap_task_235754_runs[tid]++;
        ctx->futhark_mc_segmap_task_235754_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235754_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235745(void *args, int64_t start,
                                            int64_t end, int flat_tid_221763,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235744
    *futhark_mc_segmap_parloop_struct_235744 =
    (struct futhark_mc_segmap_parloop_struct_235744 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235744->ctx;
    uint64_t futhark_mc_segmap_parloop_235745_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235745_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235744->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235744->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235744->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235744->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235744->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235744->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_segmap_parloop_struct_235744->free_i_203808;
    bool x_203809 = futhark_mc_segmap_parloop_struct_235744->free_x_203809;
    int64_t min_res_203839 =
            futhark_mc_segmap_parloop_struct_235744->free_min_res_203839;
    bool loop_cond_203844 =
         futhark_mc_segmap_parloop_struct_235744->free_loop_cond_203844;
    double i64_res_203845 =
           futhark_mc_segmap_parloop_struct_235744->free_i64_res_203845;
    int64_t gtid_207307 =
            futhark_mc_segmap_parloop_struct_235744->free_gtid_207307;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235744->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235744->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235744->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235744->free_bytes_217663;
    struct memblock mem_217716 = {.desc ="mem_217716", .mem =
                                  futhark_mc_segmap_parloop_struct_235744->free_mem_217716,
                                  .size =0, .references =NULL};
    struct memblock mem_217720 = {.desc ="mem_217720", .mem =
                                  futhark_mc_segmap_parloop_struct_235744->free_mem_217720,
                                  .size =0, .references =NULL};
    size_t mem_221766_cached_sizze_235746 = 0;
    unsigned char *mem_221766 = NULL;
    size_t mem_221779_cached_sizze_235747 = 0;
    unsigned char *mem_221779 = NULL;
    size_t mem_221780_cached_sizze_235748 = 0;
    unsigned char *mem_221780 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222146 = start;
    
    if (mem_221766_cached_sizze_235746 < (size_t) bytes_217463) {
        mem_221766 = realloc(mem_221766, bytes_217463);
        mem_221766_cached_sizze_235746 = bytes_217463;
    }
    if (mem_221779_cached_sizze_235747 < (size_t) bytes_217663) {
        mem_221779 = realloc(mem_221779, bytes_217663);
        mem_221779_cached_sizze_235747 = bytes_217663;
    }
    if (mem_221780_cached_sizze_235748 < (size_t) bytes_217663) {
        mem_221780 = realloc(mem_221780, bytes_217663);
        mem_221780_cached_sizze_235748 = bytes_217663;
    }
    for (; iter_222146 < end; iter_222146++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222255 = n_p_203574;
        int64_t gtid_221764 = iter_222146;
        int64_t remnant_222256 = iter_222146 - gtid_221764;
        int64_t x_221765;
        
        x_221765 = ((int64_t *) mem_217658.mem)[gtid_207307 * n_p_203574 +
                                                gtid_221764];
        
        int64_t flat_tid_222147 = (int64_t) 0;
        int32_t num_tasks_222257;
        struct futhark_mc_task_235749 futhark_mc_task_235749;
        
        futhark_mc_task_235749.ctx = ctx;
        futhark_mc_task_235749.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235749.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235749.free_gtid_207307 = gtid_207307;
        futhark_mc_task_235749.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235749.free_gtid_221764 = gtid_221764;
        futhark_mc_task_235749.free_mem_221766 = mem_221766;
        
        struct scheduler_segop futhark_mc_task_235749_task;
        
        futhark_mc_task_235749_task.args = &futhark_mc_task_235749;
        futhark_mc_task_235749_task.top_level_fn =
            futhark_mc_segmap_task_235750;
        futhark_mc_task_235749_task.name = "futhark_mc_segmap_task_235750";
        futhark_mc_task_235749_task.iterations = defunc_0_f_res_203721;
        futhark_mc_task_235749_task.task_time =
            &ctx->futhark_mc_segmap_task_235750_total_time;
        futhark_mc_task_235749_task.task_iter =
            &ctx->futhark_mc_segmap_task_235750_total_iter;
        futhark_mc_task_235749_task.sched = STATIC;
        futhark_mc_task_235749_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235750_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235749_task);
        
        if (futhark_mc_segmap_task_235750_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_221772 = sub64(x_221765, (int64_t) 1);
        int64_t min_arg_221773 = sub64(x_221765, min_res_203839);
        int64_t min_res_221774 = smin64(q_s_203575, x_221765);
        double i64_res_221775 = sitofp_i64_f64(x_221765);
        double x_221776 = i64_res_203845 - i64_res_221775;
        double max_arg_221777 = x_221776 / 2.0;
        double max_res_221778 = fmax64(0.0, max_arg_221777);
        int64_t flat_tid_222151 = (int64_t) 0;
        int32_t num_tasks_222261;
        struct futhark_mc_task_235753 futhark_mc_task_235753;
        
        futhark_mc_task_235753.ctx = ctx;
        futhark_mc_task_235753.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235753.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235753.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235753.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235753.free_i_203808 = i_203808;
        futhark_mc_task_235753.free_x_203809 = x_203809;
        futhark_mc_task_235753.free_min_res_203839 = min_res_203839;
        futhark_mc_task_235753.free_loop_cond_203844 = loop_cond_203844;
        futhark_mc_task_235753.free_mem_221766 = mem_221766;
        futhark_mc_task_235753.free_min_arg_221772 = min_arg_221772;
        futhark_mc_task_235753.free_min_arg_221773 = min_arg_221773;
        futhark_mc_task_235753.free_min_res_221774 = min_res_221774;
        futhark_mc_task_235753.free_max_res_221778 = max_res_221778;
        futhark_mc_task_235753.free_mem_221779 = mem_221779;
        futhark_mc_task_235753.free_mem_221780 = mem_221780;
        
        struct scheduler_segop futhark_mc_task_235753_task;
        
        futhark_mc_task_235753_task.args = &futhark_mc_task_235753;
        futhark_mc_task_235753_task.top_level_fn =
            futhark_mc_segmap_task_235754;
        futhark_mc_task_235753_task.name = "futhark_mc_segmap_task_235754";
        futhark_mc_task_235753_task.iterations = s_n_m_203726;
        futhark_mc_task_235753_task.task_time =
            &ctx->futhark_mc_segmap_task_235754_total_time;
        futhark_mc_task_235753_task.task_iter =
            &ctx->futhark_mc_segmap_task_235754_total_iter;
        futhark_mc_task_235753_task.sched = DYNAMIC;
        futhark_mc_task_235753_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235754_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235753_task);
        
        if (futhark_mc_segmap_task_235754_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_217716.mem + gtid_221764 * s_n_m_203726 * (int64_t) 8,
                    mem_221780 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_217720.mem + gtid_221764 * s_n_m_203726 * (int64_t) 8,
                    mem_221779 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_221766);
    free(mem_221779);
    free(mem_221780);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235745_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235745_end -
                 futhark_mc_segmap_parloop_235745_start;
        
        ctx->futhark_mc_segmap_parloop_235745_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235745_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235745_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235743(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_221763 = tid;
    int num_tasks_222020 = info.nsubtasks;
    struct futhark_mc_task_235736 *futhark_mc_task_235736 =
                                  (struct futhark_mc_task_235736 *) args;
    struct futhark_context *ctx = futhark_mc_task_235736->ctx;
    uint64_t futhark_mc_segmap_nested_task_235743_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235743_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235736->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235736->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235736->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235736->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235736->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235736->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_task_235736->free_i_203808;
    bool x_203809 = futhark_mc_task_235736->free_x_203809;
    int64_t min_res_203839 = futhark_mc_task_235736->free_min_res_203839;
    bool loop_cond_203844 = futhark_mc_task_235736->free_loop_cond_203844;
    double i64_res_203845 = futhark_mc_task_235736->free_i64_res_203845;
    int64_t gtid_207307 = futhark_mc_task_235736->free_gtid_207307;
    int64_t bytes_217463 = futhark_mc_task_235736->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235736->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235736->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235736->free_bytes_217663;
    struct memblock mem_217716 = {.desc ="mem_217716", .mem =
                                  futhark_mc_task_235736->free_mem_217716,
                                  .size =0, .references =NULL};
    struct memblock mem_217720 = {.desc ="mem_217720", .mem =
                                  futhark_mc_task_235736->free_mem_217720,
                                  .size =0, .references =NULL};
    int64_t iter_222146;
    struct futhark_mc_segmap_parloop_struct_235744
    futhark_mc_segmap_parloop_struct_235744;
    
    futhark_mc_segmap_parloop_struct_235744.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235744.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235744.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235744.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235744.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235744.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235744.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235744.free_i_203808 = i_203808;
    futhark_mc_segmap_parloop_struct_235744.free_x_203809 = x_203809;
    futhark_mc_segmap_parloop_struct_235744.free_min_res_203839 =
        min_res_203839;
    futhark_mc_segmap_parloop_struct_235744.free_loop_cond_203844 =
        loop_cond_203844;
    futhark_mc_segmap_parloop_struct_235744.free_i64_res_203845 =
        i64_res_203845;
    futhark_mc_segmap_parloop_struct_235744.free_gtid_207307 = gtid_207307;
    futhark_mc_segmap_parloop_struct_235744.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235744.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235744.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235744.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235744.free_mem_217716 = mem_217716.mem;
    futhark_mc_segmap_parloop_struct_235744.free_mem_217720 = mem_217720.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235745_task;
    
    futhark_mc_segmap_parloop_235745_task.name =
        "futhark_mc_segmap_parloop_235745";
    futhark_mc_segmap_parloop_235745_task.fn = futhark_mc_segmap_parloop_235745;
    futhark_mc_segmap_parloop_235745_task.args =
        &futhark_mc_segmap_parloop_struct_235744;
    futhark_mc_segmap_parloop_235745_task.iterations = iterations;
    futhark_mc_segmap_parloop_235745_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235745_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235745_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235745_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235745_task);
    
    if (futhark_mc_segmap_parloop_235745_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235745_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235745_total_end -
                 futhark_mc_segmap_parloop_235745_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235745_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235745_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235745_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235743_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235743_end -
                 futhark_mc_segmap_nested_task_235743_start;
        
        ctx->futhark_mc_segmap_nested_task_235743_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235743_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235743_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235733(void *args, int64_t start,
                                            int64_t end, int flat_tid_207306,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235732
    *futhark_mc_segmap_parloop_struct_235732 =
    (struct futhark_mc_segmap_parloop_struct_235732 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235732->ctx;
    uint64_t futhark_mc_segmap_parloop_235733_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235733_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235732->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235732->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235732->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235732->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235732->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235732->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235732->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_segmap_parloop_struct_235732->free_i_203808;
    bool x_203809 = futhark_mc_segmap_parloop_struct_235732->free_x_203809;
    int64_t min_res_203839 =
            futhark_mc_segmap_parloop_struct_235732->free_min_res_203839;
    bool loop_cond_203844 =
         futhark_mc_segmap_parloop_struct_235732->free_loop_cond_203844;
    double i64_res_203845 =
           futhark_mc_segmap_parloop_struct_235732->free_i64_res_203845;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235732->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235732->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235732->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235732->free_bytes_217663;
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235732->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235732->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235732->free_mem_217833,
                                  .size =0, .references =NULL};
    size_t mem_217716_cached_sizze_235734 = 0;
    unsigned char *mem_217716 = NULL;
    size_t mem_217720_cached_sizze_235735 = 0;
    unsigned char *mem_217720 = NULL;
    int64_t iterations = end - start;
    int64_t iter_221762 = start;
    
    if (mem_217716_cached_sizze_235734 < (size_t) bytes_217715) {
        mem_217716 = realloc(mem_217716, bytes_217715);
        mem_217716_cached_sizze_235734 = bytes_217715;
    }
    if (mem_217720_cached_sizze_235735 < (size_t) bytes_217715) {
        mem_217720 = realloc(mem_217720, bytes_217715);
        mem_217720_cached_sizze_235735 = bytes_217715;
    }
    for (; iter_221762 < end; iter_221762++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222018 = partition_sizze_203667;
        int64_t gtid_207307 = iter_221762;
        int64_t remnant_222019 = iter_221762 - gtid_207307;
        int64_t flat_tid_221887 = (int64_t) 0;
        int32_t num_tasks_222020;
        int64_t flat_tid_221763 = (int64_t) 0;
        struct futhark_mc_task_235736 futhark_mc_task_235736;
        
        futhark_mc_task_235736.ctx = ctx;
        futhark_mc_task_235736.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235736.free_q_s_203575 = q_s_203575;
        futhark_mc_task_235736.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235736.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235736.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235736.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235736.free_i_203808 = i_203808;
        futhark_mc_task_235736.free_x_203809 = x_203809;
        futhark_mc_task_235736.free_min_res_203839 = min_res_203839;
        futhark_mc_task_235736.free_loop_cond_203844 = loop_cond_203844;
        futhark_mc_task_235736.free_i64_res_203845 = i64_res_203845;
        futhark_mc_task_235736.free_gtid_207307 = gtid_207307;
        futhark_mc_task_235736.free_bytes_217463 = bytes_217463;
        futhark_mc_task_235736.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235736.free_mem_217658 = mem_217658.mem;
        futhark_mc_task_235736.free_bytes_217663 = bytes_217663;
        futhark_mc_task_235736.free_mem_217716 = mem_217716;
        futhark_mc_task_235736.free_mem_217720 = mem_217720;
        
        struct scheduler_segop futhark_mc_task_235736_task;
        
        futhark_mc_task_235736_task.args = &futhark_mc_task_235736;
        futhark_mc_task_235736_task.top_level_fn =
            futhark_mc_segmap_task_235737;
        futhark_mc_task_235736_task.name = "futhark_mc_segmap_task_235737";
        futhark_mc_task_235736_task.iterations = n_p_203574;
        futhark_mc_task_235736_task.task_time =
            &ctx->futhark_mc_segmap_task_235737_total_time;
        futhark_mc_task_235736_task.task_iter =
            &ctx->futhark_mc_segmap_task_235737_total_iter;
        futhark_mc_task_235736_task.sched = DYNAMIC;
        futhark_mc_task_235736_task.nested_fn =
            futhark_mc_segmap_nested_task_235743;
        
        int futhark_mc_segmap_task_235737_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235736_task);
        
        if (futhark_mc_segmap_task_235737_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_217828.mem + gtid_207307 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_217716 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_217833.mem + gtid_207307 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_217720 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217716);
    free(mem_217720);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235733_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235733_end -
                 futhark_mc_segmap_parloop_235733_start;
        
        ctx->futhark_mc_segmap_parloop_235733_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235733_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235733_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235731(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207306 = tid;
    int num_tasks_221619 = info.nsubtasks;
    struct futhark_mc_task_235724 *futhark_mc_task_235724 =
                                  (struct futhark_mc_task_235724 *) args;
    struct futhark_context *ctx = futhark_mc_task_235724->ctx;
    uint64_t futhark_mc_segmap_nested_task_235731_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235731_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235724->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235724->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235724->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235724->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235724->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235724->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235724->free_s_n_m_203726;
    int64_t i_203808 = futhark_mc_task_235724->free_i_203808;
    bool x_203809 = futhark_mc_task_235724->free_x_203809;
    int64_t min_res_203839 = futhark_mc_task_235724->free_min_res_203839;
    bool loop_cond_203844 = futhark_mc_task_235724->free_loop_cond_203844;
    double i64_res_203845 = futhark_mc_task_235724->free_i64_res_203845;
    int64_t bytes_217463 = futhark_mc_task_235724->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235724->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235724->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235724->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235724->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235724->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235724->free_mem_217833,
                                  .size =0, .references =NULL};
    int64_t iter_221762;
    struct futhark_mc_segmap_parloop_struct_235732
    futhark_mc_segmap_parloop_struct_235732;
    
    futhark_mc_segmap_parloop_struct_235732.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235732.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235732.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235732.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235732.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235732.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235732.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235732.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235732.free_i_203808 = i_203808;
    futhark_mc_segmap_parloop_struct_235732.free_x_203809 = x_203809;
    futhark_mc_segmap_parloop_struct_235732.free_min_res_203839 =
        min_res_203839;
    futhark_mc_segmap_parloop_struct_235732.free_loop_cond_203844 =
        loop_cond_203844;
    futhark_mc_segmap_parloop_struct_235732.free_i64_res_203845 =
        i64_res_203845;
    futhark_mc_segmap_parloop_struct_235732.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235732.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235732.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235732.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235732.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235732.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235732.free_mem_217833 = mem_217833.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235733_task;
    
    futhark_mc_segmap_parloop_235733_task.name =
        "futhark_mc_segmap_parloop_235733";
    futhark_mc_segmap_parloop_235733_task.fn = futhark_mc_segmap_parloop_235733;
    futhark_mc_segmap_parloop_235733_task.args =
        &futhark_mc_segmap_parloop_struct_235732;
    futhark_mc_segmap_parloop_235733_task.iterations = iterations;
    futhark_mc_segmap_parloop_235733_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235733_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235733_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235733_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235733_task);
    
    if (futhark_mc_segmap_parloop_235733_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235733_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235733_total_end -
                 futhark_mc_segmap_parloop_235733_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235733_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235733_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235733_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235731_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235731_end -
                 futhark_mc_segmap_nested_task_235731_start;
        
        ctx->futhark_mc_segmap_nested_task_235731_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235731_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235731_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235757 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_l_203583;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_203971;
    bool free_loop_cond_203976;
    double free_i64_res_203977;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
};
struct futhark_mc_segmap_parloop_struct_235759 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_l_203583;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_203971;
    bool free_loop_cond_203976;
    double free_i64_res_203977;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
};
static int futhark_mc_segmap_parloop_235760(void *args, int64_t start,
                                            int64_t end, int flat_tid_207554,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235759
    *futhark_mc_segmap_parloop_struct_235759 =
    (struct futhark_mc_segmap_parloop_struct_235759 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235759->ctx;
    uint64_t futhark_mc_segmap_parloop_235760_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235760_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235759->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_235759->free_q_l_203577;
    int64_t jump_l_203583 =
            futhark_mc_segmap_parloop_struct_235759->free_jump_l_203583;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235759->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_235759->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235759->free_i_203760;
    bool x_203761 = futhark_mc_segmap_parloop_struct_235759->free_x_203761;
    int64_t min_res_203971 =
            futhark_mc_segmap_parloop_struct_235759->free_min_res_203971;
    bool loop_cond_203976 =
         futhark_mc_segmap_parloop_struct_235759->free_loop_cond_203976;
    double i64_res_203977 =
           futhark_mc_segmap_parloop_struct_235759->free_i64_res_203977;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_235759->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235759->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_235759->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_235759->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_235759->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_235759->free_mem_217895,
                                  .size =0, .references =NULL};
    size_t mem_217845_cached_sizze_235761 = 0;
    unsigned char *mem_217845 = NULL;
    size_t mem_217860_cached_sizze_235762 = 0;
    unsigned char *mem_217860 = NULL;
    size_t mem_217863_cached_sizze_235763 = 0;
    unsigned char *mem_217863 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222344 = start;
    
    if (mem_217845_cached_sizze_235761 < (size_t) bytes_217420) {
        mem_217845 = realloc(mem_217845, bytes_217420);
        mem_217845_cached_sizze_235761 = bytes_217420;
    }
    if (mem_217860_cached_sizze_235762 < (size_t) bytes_217838) {
        mem_217860 = realloc(mem_217860, bytes_217838);
        mem_217860_cached_sizze_235762 = bytes_217838;
    }
    if (mem_217863_cached_sizze_235763 < (size_t) bytes_217838) {
        mem_217863 = realloc(mem_217863, bytes_217838);
        mem_217863_cached_sizze_235763 = bytes_217838;
    }
    for (; iter_222344 < end; iter_222344++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222441 = partition_sizze_203667;
        int64_t gtid_207555 = iter_222344;
        int64_t remnant_222442 = iter_222344 - gtid_207555;
        int64_t x_203981;
        
        x_203981 = ((int64_t *) mem_217461.mem)[gtid_207555];
        for (int64_t i_222345 = 0; i_222345 < n_203572; i_222345++) {
            int64_t x_222347;
            
            x_222347 = ((int64_t *) mem_217458.mem)[gtid_207555 * n_203572 +
                                                    i_222345];
            
            int64_t defunc_0_f_res_222348 = add64((int64_t) 1, x_222347);
            
            ((int64_t *) mem_217845)[i_222345] = defunc_0_f_res_222348;
        }
        
        int64_t min_arg_203985 = sub64(x_203981, (int64_t) 1);
        int64_t min_arg_203986 = sub64(x_203981, min_res_203971);
        int64_t min_res_203987 = smin64(q_l_203577, x_203981);
        double i64_res_203988 = sitofp_i64_f64(x_203981);
        double x_203989 = i64_res_203977 - i64_res_203988;
        double max_arg_203990 = x_203989 / 2.0;
        double max_res_203991 = fmax64(0.0, max_arg_203990);
        
        for (int64_t i_222350 = 0; i_222350 < l_n_m_203733; i_222350++) {
            int64_t min_arg_222353 = mul64(jump_l_203583, i_222350);
            int64_t min_res_222354 = smin64(i_203760, min_arg_222353);
            int64_t defunc_0_g_res_222355 = add64((int64_t) 1, min_res_222354);
            bool init_idx_222356;
            int64_t init_idx_222357;
            int64_t init_idx_222358;
            bool loop_while_222359;
            int64_t low_222360;
            int64_t high_222361;
            
            loop_while_222359 = x_203761;
            low_222360 = (int64_t) 0;
            high_222361 = i_203760;
            while (loop_while_222359) {
                int64_t x_222362 = add64(low_222360, high_222361);
                int64_t mid_222363 = sdiv64(x_222362, (int64_t) 2);
                bool x_222364 = sle64((int64_t) 0, mid_222363);
                bool y_222365 = slt64(mid_222363, n_203572);
                bool bounds_check_222366 = x_222364 && y_222365;
                bool index_certs_222367;
                
                if (!bounds_check_222366) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_222363,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_222368;
                
                mid_id_222368 = ((int64_t *) mem_217845)[mid_222363];
                
                bool cond_222369 = slt64(mid_id_222368, (int64_t) 0);
                int64_t mid_idx_222370;
                
                if (cond_222369) {
                    mid_idx_222370 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_222370 = mid_id_222368;
                }
                
                bool cond_222371 = sle64(defunc_0_g_res_222355, mid_idx_222370);
                int64_t loopres_222372;
                int64_t loopres_222373;
                
                if (cond_222371) {
                    int64_t loopres_t_res_222374 = sub64(mid_222363,
                                                         (int64_t) 1);
                    
                    loopres_222372 = low_222360;
                    loopres_222373 = loopres_t_res_222374;
                } else {
                    int64_t loopres_f_res_222375 = add64((int64_t) 1,
                                                         mid_222363);
                    
                    loopres_222372 = loopres_f_res_222375;
                    loopres_222373 = high_222361;
                }
                
                bool loop_cond_222376 = sle64(loopres_222372, loopres_222373);
                bool loop_while_tmp_222446 = loop_cond_222376;
                int64_t low_tmp_222447 = loopres_222372;
                int64_t high_tmp_222448 = loopres_222373;
                
                loop_while_222359 = loop_while_tmp_222446;
                low_222360 = low_tmp_222447;
                high_222361 = high_tmp_222448;
            }
            init_idx_222356 = loop_while_222359;
            init_idx_222357 = low_222360;
            init_idx_222358 = high_222361;
            
            bool idx_222377;
            int64_t idx_222378;
            int64_t idx_222379;
            int64_t idx_222380;
            bool loop_while_222381;
            int64_t l_idx_222382;
            int64_t r_idx_222383;
            int64_t span_222384;
            
            loop_while_222381 = loop_cond_203976;
            l_idx_222382 = init_idx_222357;
            r_idx_222383 = init_idx_222357;
            span_222384 = (int64_t) 1;
            while (loop_while_222381) {
                int64_t max_arg_222385 = sub64(l_idx_222382, (int64_t) 1);
                int64_t max_res_222386 = smax64((int64_t) 0, max_arg_222385);
                int64_t min_arg_222387 = add64((int64_t) 1, r_idx_222383);
                int64_t min_res_222388 = smin64(min_arg_203985, min_arg_222387);
                bool x_222389 = sle64((int64_t) 0, max_res_222386);
                bool y_222390 = slt64(max_res_222386, n_203572);
                bool bounds_check_222391 = x_222389 && y_222390;
                bool index_certs_222392;
                
                if (!bounds_check_222391) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_222386,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_222393;
                
                x_222393 = ((int64_t *) mem_217845)[max_res_222386];
                
                int64_t abs_arg_222394 = sub64(x_222393, defunc_0_g_res_222355);
                int64_t abs_res_222395 = abs64(abs_arg_222394);
                bool x_222396 = sle64((int64_t) 0, min_res_222388);
                bool y_222397 = slt64(min_res_222388, n_203572);
                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) min_res_222388,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_222400;
                
                x_222400 = ((int64_t *) mem_217845)[min_res_222388];
                
                int64_t abs_arg_222401 = sub64(x_222400, defunc_0_g_res_222355);
                int64_t abs_res_222402 = abs64(abs_arg_222401);
                bool cond_222403 = max_res_222386 == l_idx_222382;
                int64_t loopres_222404;
                int64_t loopres_222405;
                int64_t loopres_222406;
                
                if (cond_222403) {
                    loopres_222404 = l_idx_222382;
                    loopres_222405 = r_idx_222383;
                    loopres_222406 = min_res_203971;
                } else {
                    bool cond_222407 = slt64(abs_res_222395, abs_res_222402);
                    bool cond_f_res_222408 = min_res_222388 == r_idx_222383;
                    bool x_222409 = !cond_222407;
                    bool y_222410 = cond_f_res_222408 && x_222409;
                    bool cond_222411 = cond_222407 || y_222410;
                    int64_t loopres_f_res_222412;
                    
                    if (cond_222411) {
                        loopres_f_res_222412 = max_res_222386;
                    } else {
                        loopres_f_res_222412 = l_idx_222382;
                    }
                    
                    int64_t loopres_f_res_222413;
                    
                    if (cond_222411) {
                        loopres_f_res_222413 = r_idx_222383;
                    } else {
                        loopres_f_res_222413 = min_res_222388;
                    }
                    
                    int64_t loopres_f_res_222414;
                    
                    if (cond_222411) {
                        int64_t loopres_f_res_t_res_222415 = add64((int64_t) 1,
                                                                   span_222384);
                        
                        loopres_f_res_222414 = loopres_f_res_t_res_222415;
                    } else {
                        int64_t loopres_f_res_f_res_222416 = add64((int64_t) 1,
                                                                   span_222384);
                        
                        loopres_f_res_222414 = loopres_f_res_f_res_222416;
                    }
                    loopres_222404 = loopres_f_res_222412;
                    loopres_222405 = loopres_f_res_222413;
                    loopres_222406 = loopres_f_res_222414;
                }
                
                bool loop_cond_222417 = slt64(loopres_222406, min_res_203971);
                bool loop_while_tmp_222449 = loop_cond_222417;
                int64_t l_idx_tmp_222450 = loopres_222404;
                int64_t r_idx_tmp_222451 = loopres_222405;
                int64_t span_tmp_222452 = loopres_222406;
                
                loop_while_222381 = loop_while_tmp_222449;
                l_idx_222382 = l_idx_tmp_222450;
                r_idx_222383 = r_idx_tmp_222451;
                span_222384 = span_tmp_222452;
            }
            idx_222377 = loop_while_222381;
            idx_222378 = l_idx_222382;
            idx_222379 = r_idx_222383;
            idx_222380 = span_222384;
            
            int64_t min_res_222418 = smin64(min_arg_203986, idx_222378);
            int64_t max_res_222419 = smax64((int64_t) 0, min_res_222418);
            int64_t x_222420 = add64(min_res_203987, max_res_222419);
            int64_t r_222421 = sub64(x_222420, (int64_t) 1);
            bool x_222422 = sle64((int64_t) 0, r_222421);
            bool y_222423 = slt64(r_222421, n_203572);
            bool bounds_check_222424 = x_222422 && y_222423;
            bool index_certs_222425;
            
            if (!bounds_check_222424) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_222421,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222426;
            
            x_222426 = ((int64_t *) mem_217458.mem)[gtid_207555 * n_203572 +
                                                    r_222421];
            
            int64_t abs_arg_222427 = sub64(x_222426, min_res_222354);
            int64_t abs_res_222428 = abs64(abs_arg_222427);
            bool x_222429 = sle64((int64_t) 0, max_res_222419);
            bool y_222430 = slt64(max_res_222419, n_203572);
            bool bounds_check_222431 = x_222429 && y_222430;
            bool index_certs_222432;
            
            if (!bounds_check_222431) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222419,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222433;
            
            x_222433 = ((int64_t *) mem_217458.mem)[gtid_207555 * n_203572 +
                                                    max_res_222419];
            
            int64_t abs_arg_222434 = sub64(x_222433, min_res_222354);
            int64_t abs_res_222435 = abs64(abs_arg_222434);
            int64_t max_res_222436 = smax64(abs_res_222428, abs_res_222435);
            double defunc_0_f_res_222437 = sitofp_i64_f64(max_res_222436);
            double defunc_1_f_res_222438 = max_res_203991 +
                   defunc_0_f_res_222437;
            
            ((double *) mem_217860)[i_222350] = defunc_1_f_res_222438;
            ((int64_t *) mem_217863)[i_222350] = max_res_222419;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_217891.mem + gtid_207555 * l_n_m_203733 * (int64_t) 8,
                    mem_217863 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_217895.mem + gtid_207555 * l_n_m_203733 * (int64_t) 8,
                    mem_217860 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217845);
    free(mem_217860);
    free(mem_217863);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235760_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235760_end -
                 futhark_mc_segmap_parloop_235760_start;
        
        ctx->futhark_mc_segmap_parloop_235760_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235760_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235760_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235758(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207554 = tid;
    int num_tasks_222343 = info.nsubtasks;
    struct futhark_mc_task_235757 *futhark_mc_task_235757 =
                                  (struct futhark_mc_task_235757 *) args;
    struct futhark_context *ctx = futhark_mc_task_235757->ctx;
    uint64_t futhark_mc_segmap_task_235758_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235758_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235757->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_235757->free_q_l_203577;
    int64_t jump_l_203583 = futhark_mc_task_235757->free_jump_l_203583;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235757->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_235757->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_235757->free_i_203760;
    bool x_203761 = futhark_mc_task_235757->free_x_203761;
    int64_t min_res_203971 = futhark_mc_task_235757->free_min_res_203971;
    bool loop_cond_203976 = futhark_mc_task_235757->free_loop_cond_203976;
    double i64_res_203977 = futhark_mc_task_235757->free_i64_res_203977;
    int64_t bytes_217420 = futhark_mc_task_235757->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235757->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_235757->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217838 = futhark_mc_task_235757->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_235757->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_235757->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t iter_222344;
    struct futhark_mc_segmap_parloop_struct_235759
    futhark_mc_segmap_parloop_struct_235759;
    
    futhark_mc_segmap_parloop_struct_235759.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235759.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235759.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_235759.free_jump_l_203583 = jump_l_203583;
    futhark_mc_segmap_parloop_struct_235759.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235759.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_235759.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235759.free_x_203761 = x_203761;
    futhark_mc_segmap_parloop_struct_235759.free_min_res_203971 =
        min_res_203971;
    futhark_mc_segmap_parloop_struct_235759.free_loop_cond_203976 =
        loop_cond_203976;
    futhark_mc_segmap_parloop_struct_235759.free_i64_res_203977 =
        i64_res_203977;
    futhark_mc_segmap_parloop_struct_235759.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_235759.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235759.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_235759.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_235759.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_235759.free_mem_217895 = mem_217895.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235760_task;
    
    futhark_mc_segmap_parloop_235760_task.name =
        "futhark_mc_segmap_parloop_235760";
    futhark_mc_segmap_parloop_235760_task.fn = futhark_mc_segmap_parloop_235760;
    futhark_mc_segmap_parloop_235760_task.args =
        &futhark_mc_segmap_parloop_struct_235759;
    futhark_mc_segmap_parloop_235760_task.iterations = iterations;
    futhark_mc_segmap_parloop_235760_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235760_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235760_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235760_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235760_task);
    
    if (futhark_mc_segmap_parloop_235760_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235760_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235760_total_end -
                 futhark_mc_segmap_parloop_235760_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235760_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235760_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235760_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235758_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235758_end -
                 futhark_mc_segmap_task_235758_start;
        
        ctx->futhark_mc_segmap_task_235758_runs[tid]++;
        ctx->futhark_mc_segmap_task_235758_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235758_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235765 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_l_203583;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_203971;
    bool free_loop_cond_203976;
    double free_i64_res_203977;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
};
struct futhark_mc_task_235770 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_207563;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217836;
};
struct futhark_mc_segmap_parloop_struct_235772 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_207563;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217836;
};
static int futhark_mc_segmap_parloop_235773(void *args, int64_t start,
                                            int64_t end, int flat_tid_222454,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235772
    *futhark_mc_segmap_parloop_struct_235772 =
    (struct futhark_mc_segmap_parloop_struct_235772 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235772->ctx;
    uint64_t futhark_mc_segmap_parloop_235773_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235773_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235772->free_n_203572;
    int64_t gtid_207563 =
            futhark_mc_segmap_parloop_struct_235772->free_gtid_207563;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235772->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217836 = {.desc ="mem_217836", .mem =
                                  futhark_mc_segmap_parloop_struct_235772->free_mem_217836,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222549 = start;
    
    for (; iter_222549 < end; iter_222549++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222550 = n_203572;
        int64_t gtid_222455 = iter_222549;
        int64_t remnant_222551 = iter_222549 - gtid_222455;
        int64_t x_222456;
        
        x_222456 = ((int64_t *) mem_217458.mem)[gtid_207563 * n_203572 +
                                                gtid_222455];
        
        int64_t defunc_0_f_res_222457 = add64((int64_t) 1, x_222456);
        
        ((int64_t *) mem_217836.mem)[gtid_222455] = defunc_0_f_res_222457;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235773_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235773_end -
                 futhark_mc_segmap_parloop_235773_start;
        
        ctx->futhark_mc_segmap_parloop_235773_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235773_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235773_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235771(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222454 = tid;
    int num_tasks_222548 = info.nsubtasks;
    struct futhark_mc_task_235770 *futhark_mc_task_235770 =
                                  (struct futhark_mc_task_235770 *) args;
    struct futhark_context *ctx = futhark_mc_task_235770->ctx;
    uint64_t futhark_mc_segmap_task_235771_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235771_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235770->free_n_203572;
    int64_t gtid_207563 = futhark_mc_task_235770->free_gtid_207563;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235770->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217836 = {.desc ="mem_217836", .mem =
                                  futhark_mc_task_235770->free_mem_217836,
                                  .size =0, .references =NULL};
    int64_t iter_222549;
    struct futhark_mc_segmap_parloop_struct_235772
    futhark_mc_segmap_parloop_struct_235772;
    
    futhark_mc_segmap_parloop_struct_235772.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235772.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235772.free_gtid_207563 = gtid_207563;
    futhark_mc_segmap_parloop_struct_235772.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235772.free_mem_217836 = mem_217836.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235773_task;
    
    futhark_mc_segmap_parloop_235773_task.name =
        "futhark_mc_segmap_parloop_235773";
    futhark_mc_segmap_parloop_235773_task.fn = futhark_mc_segmap_parloop_235773;
    futhark_mc_segmap_parloop_235773_task.args =
        &futhark_mc_segmap_parloop_struct_235772;
    futhark_mc_segmap_parloop_235773_task.iterations = iterations;
    futhark_mc_segmap_parloop_235773_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235773_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235773_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235773_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235773_task);
    
    if (futhark_mc_segmap_parloop_235773_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235773_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235773_total_end -
                 futhark_mc_segmap_parloop_235773_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235773_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235773_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235773_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235771_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235771_end -
                 futhark_mc_segmap_task_235771_start;
        
        ctx->futhark_mc_segmap_task_235771_runs[tid]++;
        ctx->futhark_mc_segmap_task_235771_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235771_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235774 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_l_203583;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_203971;
    bool free_loop_cond_203976;
    int64_t free_gtid_207563;
    int64_t free_min_arg_207571;
    int64_t free_min_arg_207572;
    int64_t free_min_res_207573;
    double free_max_res_207577;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217836;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_217842;
};
struct futhark_mc_segmap_parloop_struct_235776 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_l_203583;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_203971;
    bool free_loop_cond_203976;
    int64_t free_gtid_207563;
    int64_t free_min_arg_207571;
    int64_t free_min_arg_207572;
    int64_t free_min_res_207573;
    double free_max_res_207577;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217836;
    unsigned char *free_mem_217839;
    unsigned char *free_mem_217842;
};
static int futhark_mc_segmap_parloop_235777(void *args, int64_t start,
                                            int64_t end, int flat_tid_222458,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235776
    *futhark_mc_segmap_parloop_struct_235776 =
    (struct futhark_mc_segmap_parloop_struct_235776 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235776->ctx;
    uint64_t futhark_mc_segmap_parloop_235777_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235777_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235776->free_n_203572;
    int64_t jump_l_203583 =
            futhark_mc_segmap_parloop_struct_235776->free_jump_l_203583;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_235776->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235776->free_i_203760;
    bool x_203761 = futhark_mc_segmap_parloop_struct_235776->free_x_203761;
    int64_t min_res_203971 =
            futhark_mc_segmap_parloop_struct_235776->free_min_res_203971;
    bool loop_cond_203976 =
         futhark_mc_segmap_parloop_struct_235776->free_loop_cond_203976;
    int64_t gtid_207563 =
            futhark_mc_segmap_parloop_struct_235776->free_gtid_207563;
    int64_t min_arg_207571 =
            futhark_mc_segmap_parloop_struct_235776->free_min_arg_207571;
    int64_t min_arg_207572 =
            futhark_mc_segmap_parloop_struct_235776->free_min_arg_207572;
    int64_t min_res_207573 =
            futhark_mc_segmap_parloop_struct_235776->free_min_res_207573;
    double max_res_207577 =
           futhark_mc_segmap_parloop_struct_235776->free_max_res_207577;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235776->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217836 = {.desc ="mem_217836", .mem =
                                  futhark_mc_segmap_parloop_struct_235776->free_mem_217836,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_segmap_parloop_struct_235776->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_217842 = {.desc ="mem_217842", .mem =
                                  futhark_mc_segmap_parloop_struct_235776->free_mem_217842,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222553 = start;
    
    for (; iter_222553 < end; iter_222553++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222609 = l_n_m_203733;
        int64_t gtid_222459 = iter_222553;
        int64_t remnant_222610 = iter_222553 - gtid_222459;
        int64_t min_arg_222460 = mul64(jump_l_203583, gtid_222459);
        int64_t min_res_222461 = smin64(i_203760, min_arg_222460);
        int64_t defunc_0_g_res_222462 = add64((int64_t) 1, min_res_222461);
        bool init_idx_222463;
        int64_t init_idx_222464;
        int64_t init_idx_222465;
        bool loop_while_222554;
        int64_t low_222555;
        int64_t high_222556;
        
        loop_while_222554 = x_203761;
        low_222555 = (int64_t) 0;
        high_222556 = i_203760;
        while (loop_while_222554) {
            int64_t x_222557 = add64(low_222555, high_222556);
            int64_t mid_222558 = sdiv64(x_222557, (int64_t) 2);
            bool x_222559 = sle64((int64_t) 0, mid_222558);
            bool y_222560 = slt64(mid_222558, n_203572);
            bool bounds_check_222561 = x_222559 && y_222560;
            bool index_certs_222562;
            
            if (!bounds_check_222561) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_222558,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222563;
            
            mid_id_222563 = ((int64_t *) mem_217836.mem)[mid_222558];
            
            bool cond_222564 = slt64(mid_id_222563, (int64_t) 0);
            int64_t mid_idx_222565;
            
            if (cond_222564) {
                mid_idx_222565 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_222565 = mid_id_222563;
            }
            
            bool cond_222566 = sle64(defunc_0_g_res_222462, mid_idx_222565);
            int64_t loopres_222567;
            int64_t loopres_222568;
            
            if (cond_222566) {
                int64_t loopres_t_res_222569 = sub64(mid_222558, (int64_t) 1);
                
                loopres_222567 = low_222555;
                loopres_222568 = loopres_t_res_222569;
            } else {
                int64_t loopres_f_res_222570 = add64((int64_t) 1, mid_222558);
                
                loopres_222567 = loopres_f_res_222570;
                loopres_222568 = high_222556;
            }
            
            bool loop_cond_222571 = sle64(loopres_222567, loopres_222568);
            bool loop_while_tmp_222611 = loop_cond_222571;
            int64_t low_tmp_222612 = loopres_222567;
            int64_t high_tmp_222613 = loopres_222568;
            
            loop_while_222554 = loop_while_tmp_222611;
            low_222555 = low_tmp_222612;
            high_222556 = high_tmp_222613;
        }
        init_idx_222463 = loop_while_222554;
        init_idx_222464 = low_222555;
        init_idx_222465 = high_222556;
        
        bool idx_222484;
        int64_t idx_222485;
        int64_t idx_222486;
        int64_t idx_222487;
        bool loop_while_222572;
        int64_t l_idx_222573;
        int64_t r_idx_222574;
        int64_t span_222575;
        
        loop_while_222572 = loop_cond_203976;
        l_idx_222573 = init_idx_222464;
        r_idx_222574 = init_idx_222464;
        span_222575 = (int64_t) 1;
        while (loop_while_222572) {
            int64_t max_arg_222576 = sub64(l_idx_222573, (int64_t) 1);
            int64_t max_res_222577 = smax64((int64_t) 0, max_arg_222576);
            int64_t min_arg_222578 = add64((int64_t) 1, r_idx_222574);
            int64_t min_res_222579 = smin64(min_arg_207571, min_arg_222578);
            bool x_222580 = sle64((int64_t) 0, max_res_222577);
            bool y_222581 = slt64(max_res_222577, n_203572);
            bool bounds_check_222582 = x_222580 && y_222581;
            bool index_certs_222583;
            
            if (!bounds_check_222582) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222577,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222584;
            
            x_222584 = ((int64_t *) mem_217836.mem)[max_res_222577];
            
            int64_t abs_arg_222585 = sub64(x_222584, defunc_0_g_res_222462);
            int64_t abs_res_222586 = abs64(abs_arg_222585);
            bool x_222587 = sle64((int64_t) 0, min_res_222579);
            bool y_222588 = slt64(min_res_222579, n_203572);
            bool bounds_check_222589 = x_222587 && y_222588;
            bool index_certs_222590;
            
            if (!bounds_check_222589) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_222579,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222591;
            
            x_222591 = ((int64_t *) mem_217836.mem)[min_res_222579];
            
            int64_t abs_arg_222592 = sub64(x_222591, defunc_0_g_res_222462);
            int64_t abs_res_222593 = abs64(abs_arg_222592);
            bool cond_222594 = max_res_222577 == l_idx_222573;
            int64_t loopres_222595;
            int64_t loopres_222596;
            int64_t loopres_222597;
            
            if (cond_222594) {
                loopres_222595 = l_idx_222573;
                loopres_222596 = r_idx_222574;
                loopres_222597 = min_res_203971;
            } else {
                bool cond_222598 = slt64(abs_res_222586, abs_res_222593);
                bool cond_f_res_222599 = min_res_222579 == r_idx_222574;
                bool x_222600 = !cond_222598;
                bool y_222601 = cond_f_res_222599 && x_222600;
                bool cond_222602 = cond_222598 || y_222601;
                int64_t loopres_f_res_222603;
                
                if (cond_222602) {
                    loopres_f_res_222603 = max_res_222577;
                } else {
                    loopres_f_res_222603 = l_idx_222573;
                }
                
                int64_t loopres_f_res_222604;
                
                if (cond_222602) {
                    loopres_f_res_222604 = r_idx_222574;
                } else {
                    loopres_f_res_222604 = min_res_222579;
                }
                
                int64_t loopres_f_res_222605;
                
                if (cond_222602) {
                    int64_t loopres_f_res_t_res_222606 = add64((int64_t) 1,
                                                               span_222575);
                    
                    loopres_f_res_222605 = loopres_f_res_t_res_222606;
                } else {
                    int64_t loopres_f_res_f_res_222607 = add64((int64_t) 1,
                                                               span_222575);
                    
                    loopres_f_res_222605 = loopres_f_res_f_res_222607;
                }
                loopres_222595 = loopres_f_res_222603;
                loopres_222596 = loopres_f_res_222604;
                loopres_222597 = loopres_f_res_222605;
            }
            
            bool loop_cond_222608 = slt64(loopres_222597, min_res_203971);
            bool loop_while_tmp_222614 = loop_cond_222608;
            int64_t l_idx_tmp_222615 = loopres_222595;
            int64_t r_idx_tmp_222616 = loopres_222596;
            int64_t span_tmp_222617 = loopres_222597;
            
            loop_while_222572 = loop_while_tmp_222614;
            l_idx_222573 = l_idx_tmp_222615;
            r_idx_222574 = r_idx_tmp_222616;
            span_222575 = span_tmp_222617;
        }
        idx_222484 = loop_while_222572;
        idx_222485 = l_idx_222573;
        idx_222486 = r_idx_222574;
        idx_222487 = span_222575;
        
        int64_t min_res_222525 = smin64(min_arg_207572, idx_222485);
        int64_t max_res_222526 = smax64((int64_t) 0, min_res_222525);
        int64_t x_222527 = add64(min_res_207573, max_res_222526);
        int64_t r_222528 = sub64(x_222527, (int64_t) 1);
        bool x_222529 = sle64((int64_t) 0, r_222528);
        bool y_222530 = slt64(r_222528, n_203572);
        bool bounds_check_222531 = x_222529 && y_222530;
        bool index_certs_222532;
        
        if (!bounds_check_222531) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_222528,
                                   "] out of bounds for array of shape [",
                                   (long long) n_203572, "].",
                                   "-> #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_222533;
        
        x_222533 = ((int64_t *) mem_217458.mem)[gtid_207563 * n_203572 +
                                                r_222528];
        
        int64_t abs_arg_222534 = sub64(x_222533, min_res_222461);
        int64_t abs_res_222535 = abs64(abs_arg_222534);
        bool x_222536 = sle64((int64_t) 0, max_res_222526);
        bool y_222537 = slt64(max_res_222526, n_203572);
        bool bounds_check_222538 = x_222536 && y_222537;
        bool index_certs_222539;
        
        if (!bounds_check_222538) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_222526,
                                   "] out of bounds for array of shape [",
                                   (long long) n_203572, "].",
                                   "-> #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_222540;
        
        x_222540 = ((int64_t *) mem_217458.mem)[gtid_207563 * n_203572 +
                                                max_res_222526];
        
        int64_t abs_arg_222541 = sub64(x_222540, min_res_222461);
        int64_t abs_res_222542 = abs64(abs_arg_222541);
        int64_t max_res_222543 = smax64(abs_res_222535, abs_res_222542);
        double defunc_0_f_res_222544 = sitofp_i64_f64(max_res_222543);
        double defunc_1_f_res_222545 = max_res_207577 + defunc_0_f_res_222544;
        
        ((double *) mem_217839.mem)[gtid_222459] = defunc_1_f_res_222545;
        ((int64_t *) mem_217842.mem)[gtid_222459] = max_res_222526;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235777_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235777_end -
                 futhark_mc_segmap_parloop_235777_start;
        
        ctx->futhark_mc_segmap_parloop_235777_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235777_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235777_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235775(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222458 = tid;
    int num_tasks_222552 = info.nsubtasks;
    struct futhark_mc_task_235774 *futhark_mc_task_235774 =
                                  (struct futhark_mc_task_235774 *) args;
    struct futhark_context *ctx = futhark_mc_task_235774->ctx;
    uint64_t futhark_mc_segmap_task_235775_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235775_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235774->free_n_203572;
    int64_t jump_l_203583 = futhark_mc_task_235774->free_jump_l_203583;
    int64_t l_n_m_203733 = futhark_mc_task_235774->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_235774->free_i_203760;
    bool x_203761 = futhark_mc_task_235774->free_x_203761;
    int64_t min_res_203971 = futhark_mc_task_235774->free_min_res_203971;
    bool loop_cond_203976 = futhark_mc_task_235774->free_loop_cond_203976;
    int64_t gtid_207563 = futhark_mc_task_235774->free_gtid_207563;
    int64_t min_arg_207571 = futhark_mc_task_235774->free_min_arg_207571;
    int64_t min_arg_207572 = futhark_mc_task_235774->free_min_arg_207572;
    int64_t min_res_207573 = futhark_mc_task_235774->free_min_res_207573;
    double max_res_207577 = futhark_mc_task_235774->free_max_res_207577;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235774->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217836 = {.desc ="mem_217836", .mem =
                                  futhark_mc_task_235774->free_mem_217836,
                                  .size =0, .references =NULL};
    struct memblock mem_217839 = {.desc ="mem_217839", .mem =
                                  futhark_mc_task_235774->free_mem_217839,
                                  .size =0, .references =NULL};
    struct memblock mem_217842 = {.desc ="mem_217842", .mem =
                                  futhark_mc_task_235774->free_mem_217842,
                                  .size =0, .references =NULL};
    int64_t iter_222553;
    struct futhark_mc_segmap_parloop_struct_235776
    futhark_mc_segmap_parloop_struct_235776;
    
    futhark_mc_segmap_parloop_struct_235776.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235776.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235776.free_jump_l_203583 = jump_l_203583;
    futhark_mc_segmap_parloop_struct_235776.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_235776.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235776.free_x_203761 = x_203761;
    futhark_mc_segmap_parloop_struct_235776.free_min_res_203971 =
        min_res_203971;
    futhark_mc_segmap_parloop_struct_235776.free_loop_cond_203976 =
        loop_cond_203976;
    futhark_mc_segmap_parloop_struct_235776.free_gtid_207563 = gtid_207563;
    futhark_mc_segmap_parloop_struct_235776.free_min_arg_207571 =
        min_arg_207571;
    futhark_mc_segmap_parloop_struct_235776.free_min_arg_207572 =
        min_arg_207572;
    futhark_mc_segmap_parloop_struct_235776.free_min_res_207573 =
        min_res_207573;
    futhark_mc_segmap_parloop_struct_235776.free_max_res_207577 =
        max_res_207577;
    futhark_mc_segmap_parloop_struct_235776.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235776.free_mem_217836 = mem_217836.mem;
    futhark_mc_segmap_parloop_struct_235776.free_mem_217839 = mem_217839.mem;
    futhark_mc_segmap_parloop_struct_235776.free_mem_217842 = mem_217842.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235777_task;
    
    futhark_mc_segmap_parloop_235777_task.name =
        "futhark_mc_segmap_parloop_235777";
    futhark_mc_segmap_parloop_235777_task.fn = futhark_mc_segmap_parloop_235777;
    futhark_mc_segmap_parloop_235777_task.args =
        &futhark_mc_segmap_parloop_struct_235776;
    futhark_mc_segmap_parloop_235777_task.iterations = iterations;
    futhark_mc_segmap_parloop_235777_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235777_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235777_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235777_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235777_task);
    
    if (futhark_mc_segmap_parloop_235777_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235777_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235777_total_end -
                 futhark_mc_segmap_parloop_235777_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235777_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235777_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235777_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235775_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235775_end -
                 futhark_mc_segmap_task_235775_start;
        
        ctx->futhark_mc_segmap_task_235775_runs[tid]++;
        ctx->futhark_mc_segmap_task_235775_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235775_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235766(void *args, int64_t start,
                                            int64_t end, int flat_tid_207562,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235765
    *futhark_mc_segmap_parloop_struct_235765 =
    (struct futhark_mc_segmap_parloop_struct_235765 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235765->ctx;
    uint64_t futhark_mc_segmap_parloop_235766_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235766_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235765->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_235765->free_q_l_203577;
    int64_t jump_l_203583 =
            futhark_mc_segmap_parloop_struct_235765->free_jump_l_203583;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235765->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_235765->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235765->free_i_203760;
    bool x_203761 = futhark_mc_segmap_parloop_struct_235765->free_x_203761;
    int64_t min_res_203971 =
            futhark_mc_segmap_parloop_struct_235765->free_min_res_203971;
    bool loop_cond_203976 =
         futhark_mc_segmap_parloop_struct_235765->free_loop_cond_203976;
    double i64_res_203977 =
           futhark_mc_segmap_parloop_struct_235765->free_i64_res_203977;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_235765->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235765->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_235765->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_235765->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_235765->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_235765->free_mem_217895,
                                  .size =0, .references =NULL};
    size_t mem_217836_cached_sizze_235767 = 0;
    unsigned char *mem_217836 = NULL;
    size_t mem_217839_cached_sizze_235768 = 0;
    unsigned char *mem_217839 = NULL;
    size_t mem_217842_cached_sizze_235769 = 0;
    unsigned char *mem_217842 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222453 = start;
    
    if (mem_217836_cached_sizze_235767 < (size_t) bytes_217420) {
        mem_217836 = realloc(mem_217836, bytes_217420);
        mem_217836_cached_sizze_235767 = bytes_217420;
    }
    if (mem_217839_cached_sizze_235768 < (size_t) bytes_217838) {
        mem_217839 = realloc(mem_217839, bytes_217838);
        mem_217839_cached_sizze_235768 = bytes_217838;
    }
    if (mem_217842_cached_sizze_235769 < (size_t) bytes_217838) {
        mem_217842 = realloc(mem_217842, bytes_217838);
        mem_217842_cached_sizze_235769 = bytes_217838;
    }
    for (; iter_222453 < end; iter_222453++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222546 = partition_sizze_203667;
        int64_t gtid_207563 = iter_222453;
        int64_t remnant_222547 = iter_222453 - gtid_207563;
        int64_t x_207565;
        
        x_207565 = ((int64_t *) mem_217461.mem)[gtid_207563];
        
        int64_t flat_tid_222454 = (int64_t) 0;
        int32_t num_tasks_222548;
        struct futhark_mc_task_235770 futhark_mc_task_235770;
        
        futhark_mc_task_235770.ctx = ctx;
        futhark_mc_task_235770.free_n_203572 = n_203572;
        futhark_mc_task_235770.free_gtid_207563 = gtid_207563;
        futhark_mc_task_235770.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_235770.free_mem_217836 = mem_217836;
        
        struct scheduler_segop futhark_mc_task_235770_task;
        
        futhark_mc_task_235770_task.args = &futhark_mc_task_235770;
        futhark_mc_task_235770_task.top_level_fn =
            futhark_mc_segmap_task_235771;
        futhark_mc_task_235770_task.name = "futhark_mc_segmap_task_235771";
        futhark_mc_task_235770_task.iterations = n_203572;
        futhark_mc_task_235770_task.task_time =
            &ctx->futhark_mc_segmap_task_235771_total_time;
        futhark_mc_task_235770_task.task_iter =
            &ctx->futhark_mc_segmap_task_235771_total_iter;
        futhark_mc_task_235770_task.sched = STATIC;
        futhark_mc_task_235770_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235771_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235770_task);
        
        if (futhark_mc_segmap_task_235771_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_207571 = sub64(x_207565, (int64_t) 1);
        int64_t min_arg_207572 = sub64(x_207565, min_res_203971);
        int64_t min_res_207573 = smin64(q_l_203577, x_207565);
        double i64_res_207574 = sitofp_i64_f64(x_207565);
        double x_207575 = i64_res_203977 - i64_res_207574;
        double max_arg_207576 = x_207575 / 2.0;
        double max_res_207577 = fmax64(0.0, max_arg_207576);
        int64_t flat_tid_222458 = (int64_t) 0;
        int32_t num_tasks_222552;
        struct futhark_mc_task_235774 futhark_mc_task_235774;
        
        futhark_mc_task_235774.ctx = ctx;
        futhark_mc_task_235774.free_n_203572 = n_203572;
        futhark_mc_task_235774.free_jump_l_203583 = jump_l_203583;
        futhark_mc_task_235774.free_l_n_m_203733 = l_n_m_203733;
        futhark_mc_task_235774.free_i_203760 = i_203760;
        futhark_mc_task_235774.free_x_203761 = x_203761;
        futhark_mc_task_235774.free_min_res_203971 = min_res_203971;
        futhark_mc_task_235774.free_loop_cond_203976 = loop_cond_203976;
        futhark_mc_task_235774.free_gtid_207563 = gtid_207563;
        futhark_mc_task_235774.free_min_arg_207571 = min_arg_207571;
        futhark_mc_task_235774.free_min_arg_207572 = min_arg_207572;
        futhark_mc_task_235774.free_min_res_207573 = min_res_207573;
        futhark_mc_task_235774.free_max_res_207577 = max_res_207577;
        futhark_mc_task_235774.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_235774.free_mem_217836 = mem_217836;
        futhark_mc_task_235774.free_mem_217839 = mem_217839;
        futhark_mc_task_235774.free_mem_217842 = mem_217842;
        
        struct scheduler_segop futhark_mc_task_235774_task;
        
        futhark_mc_task_235774_task.args = &futhark_mc_task_235774;
        futhark_mc_task_235774_task.top_level_fn =
            futhark_mc_segmap_task_235775;
        futhark_mc_task_235774_task.name = "futhark_mc_segmap_task_235775";
        futhark_mc_task_235774_task.iterations = l_n_m_203733;
        futhark_mc_task_235774_task.task_time =
            &ctx->futhark_mc_segmap_task_235775_total_time;
        futhark_mc_task_235774_task.task_iter =
            &ctx->futhark_mc_segmap_task_235775_total_iter;
        futhark_mc_task_235774_task.sched = DYNAMIC;
        futhark_mc_task_235774_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235775_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235774_task);
        
        if (futhark_mc_segmap_task_235775_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_217891.mem + gtid_207563 * l_n_m_203733 * (int64_t) 8,
                    mem_217842 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_217895.mem + gtid_207563 * l_n_m_203733 * (int64_t) 8,
                    mem_217839 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217836);
    free(mem_217839);
    free(mem_217842);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235766_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235766_end -
                 futhark_mc_segmap_parloop_235766_start;
        
        ctx->futhark_mc_segmap_parloop_235766_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235766_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235766_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235764(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207562 = tid;
    int num_tasks_222343 = info.nsubtasks;
    struct futhark_mc_task_235757 *futhark_mc_task_235757 =
                                  (struct futhark_mc_task_235757 *) args;
    struct futhark_context *ctx = futhark_mc_task_235757->ctx;
    uint64_t futhark_mc_segmap_nested_task_235764_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235764_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235757->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_235757->free_q_l_203577;
    int64_t jump_l_203583 = futhark_mc_task_235757->free_jump_l_203583;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235757->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_235757->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_235757->free_i_203760;
    bool x_203761 = futhark_mc_task_235757->free_x_203761;
    int64_t min_res_203971 = futhark_mc_task_235757->free_min_res_203971;
    bool loop_cond_203976 = futhark_mc_task_235757->free_loop_cond_203976;
    double i64_res_203977 = futhark_mc_task_235757->free_i64_res_203977;
    int64_t bytes_217420 = futhark_mc_task_235757->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235757->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_235757->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217838 = futhark_mc_task_235757->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_235757->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_235757->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t iter_222453;
    struct futhark_mc_segmap_parloop_struct_235765
    futhark_mc_segmap_parloop_struct_235765;
    
    futhark_mc_segmap_parloop_struct_235765.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235765.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235765.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_235765.free_jump_l_203583 = jump_l_203583;
    futhark_mc_segmap_parloop_struct_235765.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235765.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_235765.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235765.free_x_203761 = x_203761;
    futhark_mc_segmap_parloop_struct_235765.free_min_res_203971 =
        min_res_203971;
    futhark_mc_segmap_parloop_struct_235765.free_loop_cond_203976 =
        loop_cond_203976;
    futhark_mc_segmap_parloop_struct_235765.free_i64_res_203977 =
        i64_res_203977;
    futhark_mc_segmap_parloop_struct_235765.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_235765.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235765.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_235765.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_235765.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_235765.free_mem_217895 = mem_217895.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235766_task;
    
    futhark_mc_segmap_parloop_235766_task.name =
        "futhark_mc_segmap_parloop_235766";
    futhark_mc_segmap_parloop_235766_task.fn = futhark_mc_segmap_parloop_235766;
    futhark_mc_segmap_parloop_235766_task.args =
        &futhark_mc_segmap_parloop_struct_235765;
    futhark_mc_segmap_parloop_235766_task.iterations = iterations;
    futhark_mc_segmap_parloop_235766_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235766_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235766_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235766_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235766_task);
    
    if (futhark_mc_segmap_parloop_235766_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235766_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235766_total_end -
                 futhark_mc_segmap_parloop_235766_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235766_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235766_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235766_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235764_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235764_end -
                 futhark_mc_segmap_nested_task_235764_start;
        
        ctx->futhark_mc_segmap_nested_task_235764_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235764_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235764_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235778 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_204083;
    bool free_loop_cond_204088;
    double free_i64_res_204089;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
};
struct futhark_mc_segmap_parloop_struct_235780 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_204083;
    bool free_loop_cond_204088;
    double free_i64_res_204089;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
};
static int futhark_mc_segmap_parloop_235781(void *args, int64_t start,
                                            int64_t end, int flat_tid_207669,
                                            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_203572 = futhark_mc_segmap_parloop_struct_235780->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_235780->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_235780->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235780->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_235780->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235780->free_i_203760;
    bool x_203761 = futhark_mc_segmap_parloop_struct_235780->free_x_203761;
    int64_t min_res_204083 =
            futhark_mc_segmap_parloop_struct_235780->free_min_res_204083;
    bool loop_cond_204088 =
         futhark_mc_segmap_parloop_struct_235780->free_loop_cond_204088;
    double i64_res_204089 =
           futhark_mc_segmap_parloop_struct_235780->free_i64_res_204089;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_235780->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_235780->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_235780->free_mem_217957,
                                  .size =0, .references =NULL};
    size_t mem_217907_cached_sizze_235782 = 0;
    unsigned char *mem_217907 = NULL;
    size_t mem_217922_cached_sizze_235783 = 0;
    unsigned char *mem_217922 = NULL;
    size_t mem_217925_cached_sizze_235784 = 0;
    unsigned char *mem_217925 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222619 = start;
    
    if (mem_217907_cached_sizze_235782 < (size_t) bytes_217420) {
        mem_217907 = realloc(mem_217907, bytes_217420);
        mem_217907_cached_sizze_235782 = bytes_217420;
    }
    if (mem_217922_cached_sizze_235783 < (size_t) bytes_217900) {
        mem_217922 = realloc(mem_217922, bytes_217900);
        mem_217922_cached_sizze_235783 = bytes_217900;
    }
    if (mem_217925_cached_sizze_235784 < (size_t) bytes_217900) {
        mem_217925 = realloc(mem_217925, bytes_217900);
        mem_217925_cached_sizze_235784 = bytes_217900;
    }
    for (; iter_222619 < end; iter_222619++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222716 = partition_sizze_203667;
        int64_t gtid_207670 = iter_222619;
        int64_t remnant_222717 = iter_222619 - gtid_207670;
        int64_t x_204093;
        
        x_204093 = ((int64_t *) mem_217461.mem)[gtid_207670];
        for (int64_t i_222620 = 0; i_222620 < n_203572; i_222620++) {
            int64_t x_222622;
            
            x_222622 = ((int64_t *) mem_217458.mem)[gtid_207670 * n_203572 +
                                                    i_222620];
            
            int64_t defunc_0_f_res_222623 = add64((int64_t) 1, x_222622);
            
            ((int64_t *) mem_217907)[i_222620] = defunc_0_f_res_222623;
        }
        
        int64_t min_arg_204097 = sub64(x_204093, (int64_t) 1);
        int64_t min_arg_204098 = sub64(x_204093, min_res_204083);
        int64_t min_res_204099 = smin64(q_t_203576, x_204093);
        double i64_res_204100 = sitofp_i64_f64(x_204093);
        double x_204101 = i64_res_204089 - i64_res_204100;
        double max_arg_204102 = x_204101 / 2.0;
        double max_res_204103 = fmax64(0.0, max_arg_204102);
        
        for (int64_t i_222625 = 0; i_222625 < t_n_m_203740; i_222625++) {
            int64_t min_arg_222628 = mul64(jump_t_203582, i_222625);
            int64_t min_res_222629 = smin64(i_203760, min_arg_222628);
            int64_t defunc_0_g_res_222630 = add64((int64_t) 1, min_res_222629);
            bool init_idx_222631;
            int64_t init_idx_222632;
            int64_t init_idx_222633;
            bool loop_while_222634;
            int64_t low_222635;
            int64_t high_222636;
            
            loop_while_222634 = x_203761;
            low_222635 = (int64_t) 0;
            high_222636 = i_203760;
            while (loop_while_222634) {
                int64_t x_222637 = add64(low_222635, high_222636);
                int64_t mid_222638 = sdiv64(x_222637, (int64_t) 2);
                bool x_222639 = sle64((int64_t) 0, mid_222638);
                bool y_222640 = slt64(mid_222638, n_203572);
                bool bounds_check_222641 = x_222639 && y_222640;
                bool index_certs_222642;
                
                if (!bounds_check_222641) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_222638,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_222643;
                
                mid_id_222643 = ((int64_t *) mem_217907)[mid_222638];
                
                bool cond_222644 = slt64(mid_id_222643, (int64_t) 0);
                int64_t mid_idx_222645;
                
                if (cond_222644) {
                    mid_idx_222645 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_222645 = mid_id_222643;
                }
                
                bool cond_222646 = sle64(defunc_0_g_res_222630, mid_idx_222645);
                int64_t loopres_222647;
                int64_t loopres_222648;
                
                if (cond_222646) {
                    int64_t loopres_t_res_222649 = sub64(mid_222638,
                                                         (int64_t) 1);
                    
                    loopres_222647 = low_222635;
                    loopres_222648 = loopres_t_res_222649;
                } else {
                    int64_t loopres_f_res_222650 = add64((int64_t) 1,
                                                         mid_222638);
                    
                    loopres_222647 = loopres_f_res_222650;
                    loopres_222648 = high_222636;
                }
                
                bool loop_cond_222651 = sle64(loopres_222647, loopres_222648);
                bool loop_while_tmp_222721 = loop_cond_222651;
                int64_t low_tmp_222722 = loopres_222647;
                int64_t high_tmp_222723 = loopres_222648;
                
                loop_while_222634 = loop_while_tmp_222721;
                low_222635 = low_tmp_222722;
                high_222636 = high_tmp_222723;
            }
            init_idx_222631 = loop_while_222634;
            init_idx_222632 = low_222635;
            init_idx_222633 = high_222636;
            
            bool idx_222652;
            int64_t idx_222653;
            int64_t idx_222654;
            int64_t idx_222655;
            bool loop_while_222656;
            int64_t l_idx_222657;
            int64_t r_idx_222658;
            int64_t span_222659;
            
            loop_while_222656 = loop_cond_204088;
            l_idx_222657 = init_idx_222632;
            r_idx_222658 = init_idx_222632;
            span_222659 = (int64_t) 1;
            while (loop_while_222656) {
                int64_t max_arg_222660 = sub64(l_idx_222657, (int64_t) 1);
                int64_t max_res_222661 = smax64((int64_t) 0, max_arg_222660);
                int64_t min_arg_222662 = add64((int64_t) 1, r_idx_222658);
                int64_t min_res_222663 = smin64(min_arg_204097, min_arg_222662);
                bool x_222664 = sle64((int64_t) 0, max_res_222661);
                bool y_222665 = slt64(max_res_222661, n_203572);
                bool bounds_check_222666 = x_222664 && y_222665;
                bool index_certs_222667;
                
                if (!bounds_check_222666) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_222661,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_222668;
                
                x_222668 = ((int64_t *) mem_217907)[max_res_222661];
                
                int64_t abs_arg_222669 = sub64(x_222668, defunc_0_g_res_222630);
                int64_t abs_res_222670 = abs64(abs_arg_222669);
                bool x_222671 = sle64((int64_t) 0, min_res_222663);
                bool y_222672 = slt64(min_res_222663, n_203572);
                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) min_res_222663,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_222675;
                
                x_222675 = ((int64_t *) mem_217907)[min_res_222663];
                
                int64_t abs_arg_222676 = sub64(x_222675, defunc_0_g_res_222630);
                int64_t abs_res_222677 = abs64(abs_arg_222676);
                bool cond_222678 = max_res_222661 == l_idx_222657;
                int64_t loopres_222679;
                int64_t loopres_222680;
                int64_t loopres_222681;
                
                if (cond_222678) {
                    loopres_222679 = l_idx_222657;
                    loopres_222680 = r_idx_222658;
                    loopres_222681 = min_res_204083;
                } else {
                    bool cond_222682 = slt64(abs_res_222670, abs_res_222677);
                    bool cond_f_res_222683 = min_res_222663 == r_idx_222658;
                    bool x_222684 = !cond_222682;
                    bool y_222685 = cond_f_res_222683 && x_222684;
                    bool cond_222686 = cond_222682 || y_222685;
                    int64_t loopres_f_res_222687;
                    
                    if (cond_222686) {
                        loopres_f_res_222687 = max_res_222661;
                    } else {
                        loopres_f_res_222687 = l_idx_222657;
                    }
                    
                    int64_t loopres_f_res_222688;
                    
                    if (cond_222686) {
                        loopres_f_res_222688 = r_idx_222658;
                    } else {
                        loopres_f_res_222688 = min_res_222663;
                    }
                    
                    int64_t loopres_f_res_222689;
                    
                    if (cond_222686) {
                        int64_t loopres_f_res_t_res_222690 = add64((int64_t) 1,
                                                                   span_222659);
                        
                        loopres_f_res_222689 = loopres_f_res_t_res_222690;
                    } else {
                        int64_t loopres_f_res_f_res_222691 = add64((int64_t) 1,
                                                                   span_222659);
                        
                        loopres_f_res_222689 = loopres_f_res_f_res_222691;
                    }
                    loopres_222679 = loopres_f_res_222687;
                    loopres_222680 = loopres_f_res_222688;
                    loopres_222681 = loopres_f_res_222689;
                }
                
                bool loop_cond_222692 = slt64(loopres_222681, min_res_204083);
                bool loop_while_tmp_222724 = loop_cond_222692;
                int64_t l_idx_tmp_222725 = loopres_222679;
                int64_t r_idx_tmp_222726 = loopres_222680;
                int64_t span_tmp_222727 = loopres_222681;
                
                loop_while_222656 = loop_while_tmp_222724;
                l_idx_222657 = l_idx_tmp_222725;
                r_idx_222658 = r_idx_tmp_222726;
                span_222659 = span_tmp_222727;
            }
            idx_222652 = loop_while_222656;
            idx_222653 = l_idx_222657;
            idx_222654 = r_idx_222658;
            idx_222655 = span_222659;
            
            int64_t min_res_222693 = smin64(min_arg_204098, idx_222653);
            int64_t max_res_222694 = smax64((int64_t) 0, min_res_222693);
            int64_t x_222695 = add64(min_res_204099, max_res_222694);
            int64_t r_222696 = sub64(x_222695, (int64_t) 1);
            bool x_222697 = sle64((int64_t) 0, r_222696);
            bool y_222698 = slt64(r_222696, n_203572);
            bool bounds_check_222699 = x_222697 && y_222698;
            bool index_certs_222700;
            
            if (!bounds_check_222699) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_222696,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222701;
            
            x_222701 = ((int64_t *) mem_217458.mem)[gtid_207670 * n_203572 +
                                                    r_222696];
            
            int64_t abs_arg_222702 = sub64(x_222701, min_res_222629);
            int64_t abs_res_222703 = abs64(abs_arg_222702);
            bool x_222704 = sle64((int64_t) 0, max_res_222694);
            bool y_222705 = slt64(max_res_222694, n_203572);
            bool bounds_check_222706 = x_222704 && y_222705;
            bool index_certs_222707;
            
            if (!bounds_check_222706) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222694,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222708;
            
            x_222708 = ((int64_t *) mem_217458.mem)[gtid_207670 * n_203572 +
                                                    max_res_222694];
            
            int64_t abs_arg_222709 = sub64(x_222708, min_res_222629);
            int64_t abs_res_222710 = abs64(abs_arg_222709);
            int64_t max_res_222711 = smax64(abs_res_222703, abs_res_222710);
            double defunc_0_f_res_222712 = sitofp_i64_f64(max_res_222711);
            double defunc_1_f_res_222713 = max_res_204103 +
                   defunc_0_f_res_222712;
            
            ((double *) mem_217922)[i_222625] = defunc_1_f_res_222713;
            ((int64_t *) mem_217925)[i_222625] = max_res_222694;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_217953.mem + gtid_207670 * t_n_m_203740 * (int64_t) 8,
                    mem_217925 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_217957.mem + gtid_207670 * t_n_m_203740 * (int64_t) 8,
                    mem_217922 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217907);
    free(mem_217922);
    free(mem_217925);
    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_207669 = tid;
    int num_tasks_222618 = 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_203572 = futhark_mc_task_235778->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_235778->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_235778->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235778->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_235778->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_235778->free_i_203760;
    bool x_203761 = futhark_mc_task_235778->free_x_203761;
    int64_t min_res_204083 = futhark_mc_task_235778->free_min_res_204083;
    bool loop_cond_204088 = futhark_mc_task_235778->free_loop_cond_204088;
    double i64_res_204089 = futhark_mc_task_235778->free_i64_res_204089;
    int64_t bytes_217420 = futhark_mc_task_235778->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235778->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_235778->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_235778->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_235778->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_235778->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t iter_222619;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235780.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_235780.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_235780.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235780.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_235780.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235780.free_x_203761 = x_203761;
    futhark_mc_segmap_parloop_struct_235780.free_min_res_204083 =
        min_res_204083;
    futhark_mc_segmap_parloop_struct_235780.free_loop_cond_204088 =
        loop_cond_204088;
    futhark_mc_segmap_parloop_struct_235780.free_i64_res_204089 =
        i64_res_204089;
    futhark_mc_segmap_parloop_struct_235780.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_235780.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235780.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_235780.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_235780.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_235780.free_mem_217957 = mem_217957.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_235786 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_204083;
    bool free_loop_cond_204088;
    double free_i64_res_204089;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
};
struct futhark_mc_task_235791 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_207678;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217898;
};
struct futhark_mc_segmap_parloop_struct_235793 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_207678;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217898;
};
static int futhark_mc_segmap_parloop_235794(void *args, int64_t start,
                                            int64_t end, int flat_tid_222729,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235793
    *futhark_mc_segmap_parloop_struct_235793 =
    (struct futhark_mc_segmap_parloop_struct_235793 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235793->ctx;
    uint64_t futhark_mc_segmap_parloop_235794_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235794_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235793->free_n_203572;
    int64_t gtid_207678 =
            futhark_mc_segmap_parloop_struct_235793->free_gtid_207678;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235793->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217898 = {.desc ="mem_217898", .mem =
                                  futhark_mc_segmap_parloop_struct_235793->free_mem_217898,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222824 = start;
    
    for (; iter_222824 < end; iter_222824++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222825 = n_203572;
        int64_t gtid_222730 = iter_222824;
        int64_t remnant_222826 = iter_222824 - gtid_222730;
        int64_t x_222731;
        
        x_222731 = ((int64_t *) mem_217458.mem)[gtid_207678 * n_203572 +
                                                gtid_222730];
        
        int64_t defunc_0_f_res_222732 = add64((int64_t) 1, x_222731);
        
        ((int64_t *) mem_217898.mem)[gtid_222730] = defunc_0_f_res_222732;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235794_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235794_end -
                 futhark_mc_segmap_parloop_235794_start;
        
        ctx->futhark_mc_segmap_parloop_235794_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235794_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235794_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235792(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222729 = tid;
    int num_tasks_222823 = info.nsubtasks;
    struct futhark_mc_task_235791 *futhark_mc_task_235791 =
                                  (struct futhark_mc_task_235791 *) args;
    struct futhark_context *ctx = futhark_mc_task_235791->ctx;
    uint64_t futhark_mc_segmap_task_235792_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235792_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235791->free_n_203572;
    int64_t gtid_207678 = futhark_mc_task_235791->free_gtid_207678;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235791->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217898 = {.desc ="mem_217898", .mem =
                                  futhark_mc_task_235791->free_mem_217898,
                                  .size =0, .references =NULL};
    int64_t iter_222824;
    struct futhark_mc_segmap_parloop_struct_235793
    futhark_mc_segmap_parloop_struct_235793;
    
    futhark_mc_segmap_parloop_struct_235793.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235793.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235793.free_gtid_207678 = gtid_207678;
    futhark_mc_segmap_parloop_struct_235793.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235793.free_mem_217898 = mem_217898.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235794_task;
    
    futhark_mc_segmap_parloop_235794_task.name =
        "futhark_mc_segmap_parloop_235794";
    futhark_mc_segmap_parloop_235794_task.fn = futhark_mc_segmap_parloop_235794;
    futhark_mc_segmap_parloop_235794_task.args =
        &futhark_mc_segmap_parloop_struct_235793;
    futhark_mc_segmap_parloop_235794_task.iterations = iterations;
    futhark_mc_segmap_parloop_235794_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235794_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235794_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235794_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235794_task);
    
    if (futhark_mc_segmap_parloop_235794_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235794_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235794_total_end -
                 futhark_mc_segmap_parloop_235794_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235794_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235794_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235794_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235792_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235792_end -
                 futhark_mc_segmap_task_235792_start;
        
        ctx->futhark_mc_segmap_task_235792_runs[tid]++;
        ctx->futhark_mc_segmap_task_235792_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235792_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235795 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_204083;
    bool free_loop_cond_204088;
    int64_t free_gtid_207678;
    int64_t free_min_arg_207686;
    int64_t free_min_arg_207687;
    int64_t free_min_res_207688;
    double free_max_res_207692;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217898;
    unsigned char *free_mem_217901;
    unsigned char *free_mem_217904;
};
struct futhark_mc_segmap_parloop_struct_235797 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    bool free_x_203761;
    int64_t free_min_res_204083;
    bool free_loop_cond_204088;
    int64_t free_gtid_207678;
    int64_t free_min_arg_207686;
    int64_t free_min_arg_207687;
    int64_t free_min_res_207688;
    double free_max_res_207692;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217898;
    unsigned char *free_mem_217901;
    unsigned char *free_mem_217904;
};
static int futhark_mc_segmap_parloop_235798(void *args, int64_t start,
                                            int64_t end, int flat_tid_222733,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235797
    *futhark_mc_segmap_parloop_struct_235797 =
    (struct futhark_mc_segmap_parloop_struct_235797 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235797->ctx;
    uint64_t futhark_mc_segmap_parloop_235798_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235798_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235797->free_n_203572;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_235797->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_235797->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235797->free_i_203760;
    bool x_203761 = futhark_mc_segmap_parloop_struct_235797->free_x_203761;
    int64_t min_res_204083 =
            futhark_mc_segmap_parloop_struct_235797->free_min_res_204083;
    bool loop_cond_204088 =
         futhark_mc_segmap_parloop_struct_235797->free_loop_cond_204088;
    int64_t gtid_207678 =
            futhark_mc_segmap_parloop_struct_235797->free_gtid_207678;
    int64_t min_arg_207686 =
            futhark_mc_segmap_parloop_struct_235797->free_min_arg_207686;
    int64_t min_arg_207687 =
            futhark_mc_segmap_parloop_struct_235797->free_min_arg_207687;
    int64_t min_res_207688 =
            futhark_mc_segmap_parloop_struct_235797->free_min_res_207688;
    double max_res_207692 =
           futhark_mc_segmap_parloop_struct_235797->free_max_res_207692;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235797->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217898 = {.desc ="mem_217898", .mem =
                                  futhark_mc_segmap_parloop_struct_235797->free_mem_217898,
                                  .size =0, .references =NULL};
    struct memblock mem_217901 = {.desc ="mem_217901", .mem =
                                  futhark_mc_segmap_parloop_struct_235797->free_mem_217901,
                                  .size =0, .references =NULL};
    struct memblock mem_217904 = {.desc ="mem_217904", .mem =
                                  futhark_mc_segmap_parloop_struct_235797->free_mem_217904,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222828 = start;
    
    for (; iter_222828 < end; iter_222828++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222884 = t_n_m_203740;
        int64_t gtid_222734 = iter_222828;
        int64_t remnant_222885 = iter_222828 - gtid_222734;
        int64_t min_arg_222735 = mul64(jump_t_203582, gtid_222734);
        int64_t min_res_222736 = smin64(i_203760, min_arg_222735);
        int64_t defunc_0_g_res_222737 = add64((int64_t) 1, min_res_222736);
        bool init_idx_222738;
        int64_t init_idx_222739;
        int64_t init_idx_222740;
        bool loop_while_222829;
        int64_t low_222830;
        int64_t high_222831;
        
        loop_while_222829 = x_203761;
        low_222830 = (int64_t) 0;
        high_222831 = i_203760;
        while (loop_while_222829) {
            int64_t x_222832 = add64(low_222830, high_222831);
            int64_t mid_222833 = sdiv64(x_222832, (int64_t) 2);
            bool x_222834 = sle64((int64_t) 0, mid_222833);
            bool y_222835 = slt64(mid_222833, n_203572);
            bool bounds_check_222836 = x_222834 && y_222835;
            bool index_certs_222837;
            
            if (!bounds_check_222836) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_222833,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222838;
            
            mid_id_222838 = ((int64_t *) mem_217898.mem)[mid_222833];
            
            bool cond_222839 = slt64(mid_id_222838, (int64_t) 0);
            int64_t mid_idx_222840;
            
            if (cond_222839) {
                mid_idx_222840 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_222840 = mid_id_222838;
            }
            
            bool cond_222841 = sle64(defunc_0_g_res_222737, mid_idx_222840);
            int64_t loopres_222842;
            int64_t loopres_222843;
            
            if (cond_222841) {
                int64_t loopres_t_res_222844 = sub64(mid_222833, (int64_t) 1);
                
                loopres_222842 = low_222830;
                loopres_222843 = loopres_t_res_222844;
            } else {
                int64_t loopres_f_res_222845 = add64((int64_t) 1, mid_222833);
                
                loopres_222842 = loopres_f_res_222845;
                loopres_222843 = high_222831;
            }
            
            bool loop_cond_222846 = sle64(loopres_222842, loopres_222843);
            bool loop_while_tmp_222886 = loop_cond_222846;
            int64_t low_tmp_222887 = loopres_222842;
            int64_t high_tmp_222888 = loopres_222843;
            
            loop_while_222829 = loop_while_tmp_222886;
            low_222830 = low_tmp_222887;
            high_222831 = high_tmp_222888;
        }
        init_idx_222738 = loop_while_222829;
        init_idx_222739 = low_222830;
        init_idx_222740 = high_222831;
        
        bool idx_222759;
        int64_t idx_222760;
        int64_t idx_222761;
        int64_t idx_222762;
        bool loop_while_222847;
        int64_t l_idx_222848;
        int64_t r_idx_222849;
        int64_t span_222850;
        
        loop_while_222847 = loop_cond_204088;
        l_idx_222848 = init_idx_222739;
        r_idx_222849 = init_idx_222739;
        span_222850 = (int64_t) 1;
        while (loop_while_222847) {
            int64_t max_arg_222851 = sub64(l_idx_222848, (int64_t) 1);
            int64_t max_res_222852 = smax64((int64_t) 0, max_arg_222851);
            int64_t min_arg_222853 = add64((int64_t) 1, r_idx_222849);
            int64_t min_res_222854 = smin64(min_arg_207686, min_arg_222853);
            bool x_222855 = sle64((int64_t) 0, max_res_222852);
            bool y_222856 = slt64(max_res_222852, n_203572);
            bool bounds_check_222857 = x_222855 && y_222856;
            bool index_certs_222858;
            
            if (!bounds_check_222857) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_222852,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222859;
            
            x_222859 = ((int64_t *) mem_217898.mem)[max_res_222852];
            
            int64_t abs_arg_222860 = sub64(x_222859, defunc_0_g_res_222737);
            int64_t abs_res_222861 = abs64(abs_arg_222860);
            bool x_222862 = sle64((int64_t) 0, min_res_222854);
            bool y_222863 = slt64(min_res_222854, n_203572);
            bool bounds_check_222864 = x_222862 && y_222863;
            bool index_certs_222865;
            
            if (!bounds_check_222864) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_222854,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_222866;
            
            x_222866 = ((int64_t *) mem_217898.mem)[min_res_222854];
            
            int64_t abs_arg_222867 = sub64(x_222866, defunc_0_g_res_222737);
            int64_t abs_res_222868 = abs64(abs_arg_222867);
            bool cond_222869 = max_res_222852 == l_idx_222848;
            int64_t loopres_222870;
            int64_t loopres_222871;
            int64_t loopres_222872;
            
            if (cond_222869) {
                loopres_222870 = l_idx_222848;
                loopres_222871 = r_idx_222849;
                loopres_222872 = min_res_204083;
            } else {
                bool cond_222873 = slt64(abs_res_222861, abs_res_222868);
                bool cond_f_res_222874 = min_res_222854 == r_idx_222849;
                bool x_222875 = !cond_222873;
                bool y_222876 = cond_f_res_222874 && x_222875;
                bool cond_222877 = cond_222873 || y_222876;
                int64_t loopres_f_res_222878;
                
                if (cond_222877) {
                    loopres_f_res_222878 = max_res_222852;
                } else {
                    loopres_f_res_222878 = l_idx_222848;
                }
                
                int64_t loopres_f_res_222879;
                
                if (cond_222877) {
                    loopres_f_res_222879 = r_idx_222849;
                } else {
                    loopres_f_res_222879 = min_res_222854;
                }
                
                int64_t loopres_f_res_222880;
                
                if (cond_222877) {
                    int64_t loopres_f_res_t_res_222881 = add64((int64_t) 1,
                                                               span_222850);
                    
                    loopres_f_res_222880 = loopres_f_res_t_res_222881;
                } else {
                    int64_t loopres_f_res_f_res_222882 = add64((int64_t) 1,
                                                               span_222850);
                    
                    loopres_f_res_222880 = loopres_f_res_f_res_222882;
                }
                loopres_222870 = loopres_f_res_222878;
                loopres_222871 = loopres_f_res_222879;
                loopres_222872 = loopres_f_res_222880;
            }
            
            bool loop_cond_222883 = slt64(loopres_222872, min_res_204083);
            bool loop_while_tmp_222889 = loop_cond_222883;
            int64_t l_idx_tmp_222890 = loopres_222870;
            int64_t r_idx_tmp_222891 = loopres_222871;
            int64_t span_tmp_222892 = loopres_222872;
            
            loop_while_222847 = loop_while_tmp_222889;
            l_idx_222848 = l_idx_tmp_222890;
            r_idx_222849 = r_idx_tmp_222891;
            span_222850 = span_tmp_222892;
        }
        idx_222759 = loop_while_222847;
        idx_222760 = l_idx_222848;
        idx_222761 = r_idx_222849;
        idx_222762 = span_222850;
        
        int64_t min_res_222800 = smin64(min_arg_207687, idx_222760);
        int64_t max_res_222801 = smax64((int64_t) 0, min_res_222800);
        int64_t x_222802 = add64(min_res_207688, max_res_222801);
        int64_t r_222803 = sub64(x_222802, (int64_t) 1);
        bool x_222804 = sle64((int64_t) 0, r_222803);
        bool y_222805 = slt64(r_222803, n_203572);
        bool bounds_check_222806 = x_222804 && y_222805;
        bool index_certs_222807;
        
        if (!bounds_check_222806) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_222803,
                                   "] out of bounds for array of shape [",
                                   (long long) n_203572, "].",
                                   "-> #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_222808;
        
        x_222808 = ((int64_t *) mem_217458.mem)[gtid_207678 * n_203572 +
                                                r_222803];
        
        int64_t abs_arg_222809 = sub64(x_222808, min_res_222736);
        int64_t abs_res_222810 = abs64(abs_arg_222809);
        bool x_222811 = sle64((int64_t) 0, max_res_222801);
        bool y_222812 = slt64(max_res_222801, n_203572);
        bool bounds_check_222813 = x_222811 && y_222812;
        bool index_certs_222814;
        
        if (!bounds_check_222813) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_222801,
                                   "] out of bounds for array of shape [",
                                   (long long) n_203572, "].",
                                   "-> #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_222815;
        
        x_222815 = ((int64_t *) mem_217458.mem)[gtid_207678 * n_203572 +
                                                max_res_222801];
        
        int64_t abs_arg_222816 = sub64(x_222815, min_res_222736);
        int64_t abs_res_222817 = abs64(abs_arg_222816);
        int64_t max_res_222818 = smax64(abs_res_222810, abs_res_222817);
        double defunc_0_f_res_222819 = sitofp_i64_f64(max_res_222818);
        double defunc_1_f_res_222820 = max_res_207692 + defunc_0_f_res_222819;
        
        ((double *) mem_217901.mem)[gtid_222734] = defunc_1_f_res_222820;
        ((int64_t *) mem_217904.mem)[gtid_222734] = max_res_222801;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235798_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235798_end -
                 futhark_mc_segmap_parloop_235798_start;
        
        ctx->futhark_mc_segmap_parloop_235798_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235798_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235798_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235796(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222733 = tid;
    int num_tasks_222827 = info.nsubtasks;
    struct futhark_mc_task_235795 *futhark_mc_task_235795 =
                                  (struct futhark_mc_task_235795 *) args;
    struct futhark_context *ctx = futhark_mc_task_235795->ctx;
    uint64_t futhark_mc_segmap_task_235796_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235796_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235795->free_n_203572;
    int64_t jump_t_203582 = futhark_mc_task_235795->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_235795->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_235795->free_i_203760;
    bool x_203761 = futhark_mc_task_235795->free_x_203761;
    int64_t min_res_204083 = futhark_mc_task_235795->free_min_res_204083;
    bool loop_cond_204088 = futhark_mc_task_235795->free_loop_cond_204088;
    int64_t gtid_207678 = futhark_mc_task_235795->free_gtid_207678;
    int64_t min_arg_207686 = futhark_mc_task_235795->free_min_arg_207686;
    int64_t min_arg_207687 = futhark_mc_task_235795->free_min_arg_207687;
    int64_t min_res_207688 = futhark_mc_task_235795->free_min_res_207688;
    double max_res_207692 = futhark_mc_task_235795->free_max_res_207692;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235795->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217898 = {.desc ="mem_217898", .mem =
                                  futhark_mc_task_235795->free_mem_217898,
                                  .size =0, .references =NULL};
    struct memblock mem_217901 = {.desc ="mem_217901", .mem =
                                  futhark_mc_task_235795->free_mem_217901,
                                  .size =0, .references =NULL};
    struct memblock mem_217904 = {.desc ="mem_217904", .mem =
                                  futhark_mc_task_235795->free_mem_217904,
                                  .size =0, .references =NULL};
    int64_t iter_222828;
    struct futhark_mc_segmap_parloop_struct_235797
    futhark_mc_segmap_parloop_struct_235797;
    
    futhark_mc_segmap_parloop_struct_235797.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235797.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235797.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_235797.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_235797.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235797.free_x_203761 = x_203761;
    futhark_mc_segmap_parloop_struct_235797.free_min_res_204083 =
        min_res_204083;
    futhark_mc_segmap_parloop_struct_235797.free_loop_cond_204088 =
        loop_cond_204088;
    futhark_mc_segmap_parloop_struct_235797.free_gtid_207678 = gtid_207678;
    futhark_mc_segmap_parloop_struct_235797.free_min_arg_207686 =
        min_arg_207686;
    futhark_mc_segmap_parloop_struct_235797.free_min_arg_207687 =
        min_arg_207687;
    futhark_mc_segmap_parloop_struct_235797.free_min_res_207688 =
        min_res_207688;
    futhark_mc_segmap_parloop_struct_235797.free_max_res_207692 =
        max_res_207692;
    futhark_mc_segmap_parloop_struct_235797.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235797.free_mem_217898 = mem_217898.mem;
    futhark_mc_segmap_parloop_struct_235797.free_mem_217901 = mem_217901.mem;
    futhark_mc_segmap_parloop_struct_235797.free_mem_217904 = mem_217904.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235798_task;
    
    futhark_mc_segmap_parloop_235798_task.name =
        "futhark_mc_segmap_parloop_235798";
    futhark_mc_segmap_parloop_235798_task.fn = futhark_mc_segmap_parloop_235798;
    futhark_mc_segmap_parloop_235798_task.args =
        &futhark_mc_segmap_parloop_struct_235797;
    futhark_mc_segmap_parloop_235798_task.iterations = iterations;
    futhark_mc_segmap_parloop_235798_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235798_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235798_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235798_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235798_task);
    
    if (futhark_mc_segmap_parloop_235798_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235798_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235798_total_end -
                 futhark_mc_segmap_parloop_235798_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235798_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235798_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235798_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235796_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235796_end -
                 futhark_mc_segmap_task_235796_start;
        
        ctx->futhark_mc_segmap_task_235796_runs[tid]++;
        ctx->futhark_mc_segmap_task_235796_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235796_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235787(void *args, int64_t start,
                                            int64_t end, int flat_tid_207677,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235786
    *futhark_mc_segmap_parloop_struct_235786 =
    (struct futhark_mc_segmap_parloop_struct_235786 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235786->ctx;
    uint64_t futhark_mc_segmap_parloop_235787_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235787_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235786->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_235786->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_235786->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235786->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_235786->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235786->free_i_203760;
    bool x_203761 = futhark_mc_segmap_parloop_struct_235786->free_x_203761;
    int64_t min_res_204083 =
            futhark_mc_segmap_parloop_struct_235786->free_min_res_204083;
    bool loop_cond_204088 =
         futhark_mc_segmap_parloop_struct_235786->free_loop_cond_204088;
    double i64_res_204089 =
           futhark_mc_segmap_parloop_struct_235786->free_i64_res_204089;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_235786->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_235786->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_235786->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_235786->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_235786->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_235786->free_mem_217957,
                                  .size =0, .references =NULL};
    size_t mem_217898_cached_sizze_235788 = 0;
    unsigned char *mem_217898 = NULL;
    size_t mem_217901_cached_sizze_235789 = 0;
    unsigned char *mem_217901 = NULL;
    size_t mem_217904_cached_sizze_235790 = 0;
    unsigned char *mem_217904 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222728 = start;
    
    if (mem_217898_cached_sizze_235788 < (size_t) bytes_217420) {
        mem_217898 = realloc(mem_217898, bytes_217420);
        mem_217898_cached_sizze_235788 = bytes_217420;
    }
    if (mem_217901_cached_sizze_235789 < (size_t) bytes_217900) {
        mem_217901 = realloc(mem_217901, bytes_217900);
        mem_217901_cached_sizze_235789 = bytes_217900;
    }
    if (mem_217904_cached_sizze_235790 < (size_t) bytes_217900) {
        mem_217904 = realloc(mem_217904, bytes_217900);
        mem_217904_cached_sizze_235790 = bytes_217900;
    }
    for (; iter_222728 < end; iter_222728++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222821 = partition_sizze_203667;
        int64_t gtid_207678 = iter_222728;
        int64_t remnant_222822 = iter_222728 - gtid_207678;
        int64_t x_207680;
        
        x_207680 = ((int64_t *) mem_217461.mem)[gtid_207678];
        
        int64_t flat_tid_222729 = (int64_t) 0;
        int32_t num_tasks_222823;
        struct futhark_mc_task_235791 futhark_mc_task_235791;
        
        futhark_mc_task_235791.ctx = ctx;
        futhark_mc_task_235791.free_n_203572 = n_203572;
        futhark_mc_task_235791.free_gtid_207678 = gtid_207678;
        futhark_mc_task_235791.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_235791.free_mem_217898 = mem_217898;
        
        struct scheduler_segop futhark_mc_task_235791_task;
        
        futhark_mc_task_235791_task.args = &futhark_mc_task_235791;
        futhark_mc_task_235791_task.top_level_fn =
            futhark_mc_segmap_task_235792;
        futhark_mc_task_235791_task.name = "futhark_mc_segmap_task_235792";
        futhark_mc_task_235791_task.iterations = n_203572;
        futhark_mc_task_235791_task.task_time =
            &ctx->futhark_mc_segmap_task_235792_total_time;
        futhark_mc_task_235791_task.task_iter =
            &ctx->futhark_mc_segmap_task_235792_total_iter;
        futhark_mc_task_235791_task.sched = STATIC;
        futhark_mc_task_235791_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235792_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235791_task);
        
        if (futhark_mc_segmap_task_235792_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_207686 = sub64(x_207680, (int64_t) 1);
        int64_t min_arg_207687 = sub64(x_207680, min_res_204083);
        int64_t min_res_207688 = smin64(q_t_203576, x_207680);
        double i64_res_207689 = sitofp_i64_f64(x_207680);
        double x_207690 = i64_res_204089 - i64_res_207689;
        double max_arg_207691 = x_207690 / 2.0;
        double max_res_207692 = fmax64(0.0, max_arg_207691);
        int64_t flat_tid_222733 = (int64_t) 0;
        int32_t num_tasks_222827;
        struct futhark_mc_task_235795 futhark_mc_task_235795;
        
        futhark_mc_task_235795.ctx = ctx;
        futhark_mc_task_235795.free_n_203572 = n_203572;
        futhark_mc_task_235795.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_235795.free_t_n_m_203740 = t_n_m_203740;
        futhark_mc_task_235795.free_i_203760 = i_203760;
        futhark_mc_task_235795.free_x_203761 = x_203761;
        futhark_mc_task_235795.free_min_res_204083 = min_res_204083;
        futhark_mc_task_235795.free_loop_cond_204088 = loop_cond_204088;
        futhark_mc_task_235795.free_gtid_207678 = gtid_207678;
        futhark_mc_task_235795.free_min_arg_207686 = min_arg_207686;
        futhark_mc_task_235795.free_min_arg_207687 = min_arg_207687;
        futhark_mc_task_235795.free_min_res_207688 = min_res_207688;
        futhark_mc_task_235795.free_max_res_207692 = max_res_207692;
        futhark_mc_task_235795.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_235795.free_mem_217898 = mem_217898;
        futhark_mc_task_235795.free_mem_217901 = mem_217901;
        futhark_mc_task_235795.free_mem_217904 = mem_217904;
        
        struct scheduler_segop futhark_mc_task_235795_task;
        
        futhark_mc_task_235795_task.args = &futhark_mc_task_235795;
        futhark_mc_task_235795_task.top_level_fn =
            futhark_mc_segmap_task_235796;
        futhark_mc_task_235795_task.name = "futhark_mc_segmap_task_235796";
        futhark_mc_task_235795_task.iterations = t_n_m_203740;
        futhark_mc_task_235795_task.task_time =
            &ctx->futhark_mc_segmap_task_235796_total_time;
        futhark_mc_task_235795_task.task_iter =
            &ctx->futhark_mc_segmap_task_235796_total_iter;
        futhark_mc_task_235795_task.sched = DYNAMIC;
        futhark_mc_task_235795_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235796_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235795_task);
        
        if (futhark_mc_segmap_task_235796_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_217953.mem + gtid_207678 * t_n_m_203740 * (int64_t) 8,
                    mem_217904 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_217957.mem + gtid_207678 * t_n_m_203740 * (int64_t) 8,
                    mem_217901 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_217898);
    free(mem_217901);
    free(mem_217904);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235787_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235787_end -
                 futhark_mc_segmap_parloop_235787_start;
        
        ctx->futhark_mc_segmap_parloop_235787_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235787_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235787_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235785(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207677 = tid;
    int num_tasks_222618 = 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_235785_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235785_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235778->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_235778->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_235778->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235778->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_235778->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_235778->free_i_203760;
    bool x_203761 = futhark_mc_task_235778->free_x_203761;
    int64_t min_res_204083 = futhark_mc_task_235778->free_min_res_204083;
    bool loop_cond_204088 = futhark_mc_task_235778->free_loop_cond_204088;
    double i64_res_204089 = futhark_mc_task_235778->free_i64_res_204089;
    int64_t bytes_217420 = futhark_mc_task_235778->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_235778->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_235778->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_235778->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_235778->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_235778->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t iter_222728;
    struct futhark_mc_segmap_parloop_struct_235786
    futhark_mc_segmap_parloop_struct_235786;
    
    futhark_mc_segmap_parloop_struct_235786.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235786.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235786.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_235786.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_235786.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235786.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_235786.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235786.free_x_203761 = x_203761;
    futhark_mc_segmap_parloop_struct_235786.free_min_res_204083 =
        min_res_204083;
    futhark_mc_segmap_parloop_struct_235786.free_loop_cond_204088 =
        loop_cond_204088;
    futhark_mc_segmap_parloop_struct_235786.free_i64_res_204089 =
        i64_res_204089;
    futhark_mc_segmap_parloop_struct_235786.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_235786.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_235786.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_235786.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_235786.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_235786.free_mem_217957 = mem_217957.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235787_task;
    
    futhark_mc_segmap_parloop_235787_task.name =
        "futhark_mc_segmap_parloop_235787";
    futhark_mc_segmap_parloop_235787_task.fn = futhark_mc_segmap_parloop_235787;
    futhark_mc_segmap_parloop_235787_task.args =
        &futhark_mc_segmap_parloop_struct_235786;
    futhark_mc_segmap_parloop_235787_task.iterations = iterations;
    futhark_mc_segmap_parloop_235787_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235787_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235787_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235787_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235787_task);
    
    if (futhark_mc_segmap_parloop_235787_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235787_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235787_total_end -
                 futhark_mc_segmap_parloop_235787_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235787_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235787_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235787_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235785_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235785_end -
                 futhark_mc_segmap_nested_task_235785_start;
        
        ctx->futhark_mc_segmap_nested_task_235785_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235785_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235785_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235799 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    int64_t free_ctx_param_ext_218007;
    unsigned char *free_mem_param_218011;
    unsigned char *free_mem_218033;
};
struct futhark_mc_segmap_parloop_struct_235801 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    int64_t free_ctx_param_ext_218007;
    unsigned char *free_mem_param_218011;
    unsigned char *free_mem_218033;
};
static int futhark_mc_segmap_parloop_235802(void *args, int64_t start,
                                            int64_t end, int flat_tid_207784,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235801
    *futhark_mc_segmap_parloop_struct_235801 =
    (struct futhark_mc_segmap_parloop_struct_235801 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235801->ctx;
    uint64_t futhark_mc_segmap_parloop_235802_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235802_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235801->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235801->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235801->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_235801->free_bytes_217420;
    int64_t ctx_param_ext_218007 =
            futhark_mc_segmap_parloop_struct_235801->free_ctx_param_ext_218007;
    struct memblock mem_param_218011 = {.desc ="mem_param_218011", .mem =
                                        futhark_mc_segmap_parloop_struct_235801->free_mem_param_218011,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_segmap_parloop_struct_235801->free_mem_218033,
                                  .size =0, .references =NULL};
    size_t mem_218017_cached_sizze_235803 = 0;
    unsigned char *mem_218017 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222919 = start;
    
    if (mem_218017_cached_sizze_235803 < (size_t) bytes_217420) {
        mem_218017 = realloc(mem_218017, bytes_217420);
        mem_218017_cached_sizze_235803 = bytes_217420;
    }
    for (; iter_222919 < end; iter_222919++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222926 = partition_sizze_203667;
        int64_t gtid_207785 = iter_222919;
        int64_t remnant_222927 = iter_222919 - gtid_207785;
        
        for (int64_t i_222920 = 0; i_222920 < n_203572; i_222920++) {
            double x_222922;
            
            x_222922 = ((double *) mem_217415.mem)[gtid_207785 * n_203572 +
                                                   i_222920];
            
            double x_222923;
            
            x_222923 = ((double *) mem_param_218011.mem)[gtid_207785 *
                                                         ctx_param_ext_218007 +
                                                         i_222920];
            
            double defunc_1_f_res_222924 = x_222922 - x_222923;
            
            ((double *) mem_218017)[i_222920] = defunc_1_f_res_222924;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_218033.mem + gtid_207785 * n_203572 * (int64_t) 8,
                    mem_218017 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218017);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235802_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235802_end -
                 futhark_mc_segmap_parloop_235802_start;
        
        ctx->futhark_mc_segmap_parloop_235802_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235802_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235802_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235800(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207784 = tid;
    int num_tasks_222918 = info.nsubtasks;
    struct futhark_mc_task_235799 *futhark_mc_task_235799 =
                                  (struct futhark_mc_task_235799 *) args;
    struct futhark_context *ctx = futhark_mc_task_235799->ctx;
    uint64_t futhark_mc_segmap_task_235800_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235800_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235799->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235799->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235799->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_235799->free_bytes_217420;
    int64_t ctx_param_ext_218007 =
            futhark_mc_task_235799->free_ctx_param_ext_218007;
    struct memblock mem_param_218011 = {.desc ="mem_param_218011", .mem =
                                        futhark_mc_task_235799->free_mem_param_218011,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_task_235799->free_mem_218033,
                                  .size =0, .references =NULL};
    int64_t iter_222919;
    struct futhark_mc_segmap_parloop_struct_235801
    futhark_mc_segmap_parloop_struct_235801;
    
    futhark_mc_segmap_parloop_struct_235801.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235801.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235801.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235801.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235801.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_235801.free_ctx_param_ext_218007 =
        ctx_param_ext_218007;
    futhark_mc_segmap_parloop_struct_235801.free_mem_param_218011 =
        mem_param_218011.mem;
    futhark_mc_segmap_parloop_struct_235801.free_mem_218033 = mem_218033.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235802_task;
    
    futhark_mc_segmap_parloop_235802_task.name =
        "futhark_mc_segmap_parloop_235802";
    futhark_mc_segmap_parloop_235802_task.fn = futhark_mc_segmap_parloop_235802;
    futhark_mc_segmap_parloop_235802_task.args =
        &futhark_mc_segmap_parloop_struct_235801;
    futhark_mc_segmap_parloop_235802_task.iterations = iterations;
    futhark_mc_segmap_parloop_235802_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235802_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235802_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235802_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235802_task);
    
    if (futhark_mc_segmap_parloop_235802_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235802_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235802_total_end -
                 futhark_mc_segmap_parloop_235802_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235802_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235802_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235802_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235800_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235800_end -
                 futhark_mc_segmap_task_235800_start;
        
        ctx->futhark_mc_segmap_task_235800_runs[tid]++;
        ctx->futhark_mc_segmap_task_235800_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235800_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235805 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    int64_t free_ctx_param_ext_218007;
    unsigned char *free_mem_param_218011;
    unsigned char *free_mem_218033;
};
struct futhark_mc_task_235808 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_207791;
    unsigned char *free_mem_217415;
    int64_t free_ctx_param_ext_218007;
    unsigned char *free_mem_param_218011;
    unsigned char *free_mem_218014;
};
struct futhark_mc_segmap_parloop_struct_235810 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_207791;
    unsigned char *free_mem_217415;
    int64_t free_ctx_param_ext_218007;
    unsigned char *free_mem_param_218011;
    unsigned char *free_mem_218014;
};
static int futhark_mc_segmap_parloop_235811(void *args, int64_t start,
                                            int64_t end, int flat_tid_222930,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235810
    *futhark_mc_segmap_parloop_struct_235810 =
    (struct futhark_mc_segmap_parloop_struct_235810 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235810->ctx;
    uint64_t futhark_mc_segmap_parloop_235811_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235811_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235810->free_n_203572;
    int64_t gtid_207791 =
            futhark_mc_segmap_parloop_struct_235810->free_gtid_207791;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235810->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_218007 =
            futhark_mc_segmap_parloop_struct_235810->free_ctx_param_ext_218007;
    struct memblock mem_param_218011 = {.desc ="mem_param_218011", .mem =
                                        futhark_mc_segmap_parloop_struct_235810->free_mem_param_218011,
                                        .size =0, .references =NULL};
    struct memblock mem_218014 = {.desc ="mem_218014", .mem =
                                  futhark_mc_segmap_parloop_struct_235810->free_mem_218014,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_222938 = start;
    
    for (; iter_222938 < end; iter_222938++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222939 = n_203572;
        int64_t gtid_222931 = iter_222938;
        int64_t remnant_222940 = iter_222938 - gtid_222931;
        double x_222932;
        
        x_222932 = ((double *) mem_217415.mem)[gtid_207791 * n_203572 +
                                               gtid_222931];
        
        double x_222933;
        
        x_222933 = ((double *) mem_param_218011.mem)[gtid_207791 *
                                                     ctx_param_ext_218007 +
                                                     gtid_222931];
        
        double defunc_1_f_res_222934 = x_222932 - x_222933;
        
        ((double *) mem_218014.mem)[gtid_222931] = defunc_1_f_res_222934;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235811_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235811_end -
                 futhark_mc_segmap_parloop_235811_start;
        
        ctx->futhark_mc_segmap_parloop_235811_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235811_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235811_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235809(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222930 = tid;
    int num_tasks_222937 = info.nsubtasks;
    struct futhark_mc_task_235808 *futhark_mc_task_235808 =
                                  (struct futhark_mc_task_235808 *) args;
    struct futhark_context *ctx = futhark_mc_task_235808->ctx;
    uint64_t futhark_mc_segmap_task_235809_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235809_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235808->free_n_203572;
    int64_t gtid_207791 = futhark_mc_task_235808->free_gtid_207791;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235808->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_218007 =
            futhark_mc_task_235808->free_ctx_param_ext_218007;
    struct memblock mem_param_218011 = {.desc ="mem_param_218011", .mem =
                                        futhark_mc_task_235808->free_mem_param_218011,
                                        .size =0, .references =NULL};
    struct memblock mem_218014 = {.desc ="mem_218014", .mem =
                                  futhark_mc_task_235808->free_mem_218014,
                                  .size =0, .references =NULL};
    int64_t iter_222938;
    struct futhark_mc_segmap_parloop_struct_235810
    futhark_mc_segmap_parloop_struct_235810;
    
    futhark_mc_segmap_parloop_struct_235810.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235810.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235810.free_gtid_207791 = gtid_207791;
    futhark_mc_segmap_parloop_struct_235810.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235810.free_ctx_param_ext_218007 =
        ctx_param_ext_218007;
    futhark_mc_segmap_parloop_struct_235810.free_mem_param_218011 =
        mem_param_218011.mem;
    futhark_mc_segmap_parloop_struct_235810.free_mem_218014 = mem_218014.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235811_task;
    
    futhark_mc_segmap_parloop_235811_task.name =
        "futhark_mc_segmap_parloop_235811";
    futhark_mc_segmap_parloop_235811_task.fn = futhark_mc_segmap_parloop_235811;
    futhark_mc_segmap_parloop_235811_task.args =
        &futhark_mc_segmap_parloop_struct_235810;
    futhark_mc_segmap_parloop_235811_task.iterations = iterations;
    futhark_mc_segmap_parloop_235811_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235811_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235811_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235811_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235811_task);
    
    if (futhark_mc_segmap_parloop_235811_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235811_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235811_total_end -
                 futhark_mc_segmap_parloop_235811_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235811_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235811_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235811_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235809_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235809_end -
                 futhark_mc_segmap_task_235809_start;
        
        ctx->futhark_mc_segmap_task_235809_runs[tid]++;
        ctx->futhark_mc_segmap_task_235809_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235809_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235806(void *args, int64_t start,
                                            int64_t end, int flat_tid_207790,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235805
    *futhark_mc_segmap_parloop_struct_235805 =
    (struct futhark_mc_segmap_parloop_struct_235805 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235805->ctx;
    uint64_t futhark_mc_segmap_parloop_235806_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235806_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235805->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235805->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_235805->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_235805->free_bytes_217420;
    int64_t ctx_param_ext_218007 =
            futhark_mc_segmap_parloop_struct_235805->free_ctx_param_ext_218007;
    struct memblock mem_param_218011 = {.desc ="mem_param_218011", .mem =
                                        futhark_mc_segmap_parloop_struct_235805->free_mem_param_218011,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_segmap_parloop_struct_235805->free_mem_218033,
                                  .size =0, .references =NULL};
    size_t mem_218014_cached_sizze_235807 = 0;
    unsigned char *mem_218014 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222929 = start;
    
    if (mem_218014_cached_sizze_235807 < (size_t) bytes_217420) {
        mem_218014 = realloc(mem_218014, bytes_217420);
        mem_218014_cached_sizze_235807 = bytes_217420;
    }
    for (; iter_222929 < end; iter_222929++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222935 = partition_sizze_203667;
        int64_t gtid_207791 = iter_222929;
        int64_t remnant_222936 = iter_222929 - gtid_207791;
        int64_t flat_tid_222930 = (int64_t) 0;
        int32_t num_tasks_222937;
        struct futhark_mc_task_235808 futhark_mc_task_235808;
        
        futhark_mc_task_235808.ctx = ctx;
        futhark_mc_task_235808.free_n_203572 = n_203572;
        futhark_mc_task_235808.free_gtid_207791 = gtid_207791;
        futhark_mc_task_235808.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_235808.free_ctx_param_ext_218007 = ctx_param_ext_218007;
        futhark_mc_task_235808.free_mem_param_218011 = mem_param_218011.mem;
        futhark_mc_task_235808.free_mem_218014 = mem_218014;
        
        struct scheduler_segop futhark_mc_task_235808_task;
        
        futhark_mc_task_235808_task.args = &futhark_mc_task_235808;
        futhark_mc_task_235808_task.top_level_fn =
            futhark_mc_segmap_task_235809;
        futhark_mc_task_235808_task.name = "futhark_mc_segmap_task_235809";
        futhark_mc_task_235808_task.iterations = n_203572;
        futhark_mc_task_235808_task.task_time =
            &ctx->futhark_mc_segmap_task_235809_total_time;
        futhark_mc_task_235808_task.task_iter =
            &ctx->futhark_mc_segmap_task_235809_total_iter;
        futhark_mc_task_235808_task.sched = STATIC;
        futhark_mc_task_235808_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235809_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235808_task);
        
        if (futhark_mc_segmap_task_235809_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_218033.mem + gtid_207791 * n_203572 * (int64_t) 8,
                    mem_218014 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218014);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235806_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235806_end -
                 futhark_mc_segmap_parloop_235806_start;
        
        ctx->futhark_mc_segmap_parloop_235806_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235806_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235806_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235804(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207790 = tid;
    int num_tasks_222918 = info.nsubtasks;
    struct futhark_mc_task_235799 *futhark_mc_task_235799 =
                                  (struct futhark_mc_task_235799 *) args;
    struct futhark_context *ctx = futhark_mc_task_235799->ctx;
    uint64_t futhark_mc_segmap_nested_task_235804_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235804_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235799->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235799->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_235799->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_235799->free_bytes_217420;
    int64_t ctx_param_ext_218007 =
            futhark_mc_task_235799->free_ctx_param_ext_218007;
    struct memblock mem_param_218011 = {.desc ="mem_param_218011", .mem =
                                        futhark_mc_task_235799->free_mem_param_218011,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_task_235799->free_mem_218033,
                                  .size =0, .references =NULL};
    int64_t iter_222929;
    struct futhark_mc_segmap_parloop_struct_235805
    futhark_mc_segmap_parloop_struct_235805;
    
    futhark_mc_segmap_parloop_struct_235805.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235805.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235805.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235805.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_235805.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_235805.free_ctx_param_ext_218007 =
        ctx_param_ext_218007;
    futhark_mc_segmap_parloop_struct_235805.free_mem_param_218011 =
        mem_param_218011.mem;
    futhark_mc_segmap_parloop_struct_235805.free_mem_218033 = mem_218033.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235806_task;
    
    futhark_mc_segmap_parloop_235806_task.name =
        "futhark_mc_segmap_parloop_235806";
    futhark_mc_segmap_parloop_235806_task.fn = futhark_mc_segmap_parloop_235806;
    futhark_mc_segmap_parloop_235806_task.args =
        &futhark_mc_segmap_parloop_struct_235805;
    futhark_mc_segmap_parloop_235806_task.iterations = iterations;
    futhark_mc_segmap_parloop_235806_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235806_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235806_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235806_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235806_task);
    
    if (futhark_mc_segmap_parloop_235806_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235806_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235806_total_end -
                 futhark_mc_segmap_parloop_235806_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235806_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235806_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235806_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235804_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235804_end -
                 futhark_mc_segmap_nested_task_235804_start;
        
        ctx->futhark_mc_segmap_nested_task_235804_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235804_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235804_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235812 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_bytes_217463;
    int64_t free_bytes_217482;
    unsigned char *free_mem_217654;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_218033;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
};
struct futhark_mc_segmap_parloop_struct_235814 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_bytes_217482;
    unsigned char *free_mem_217654;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_218033;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
};
static int futhark_mc_segmap_parloop_235815(void *args, int64_t start,
                                            int64_t end, int flat_tid_207800,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235814
    *futhark_mc_segmap_parloop_struct_235814 =
    (struct futhark_mc_segmap_parloop_struct_235814 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235814->ctx;
    uint64_t futhark_mc_segmap_parloop_235815_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235815_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235814->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235814->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235814->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235814->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235814->free_i_203760;
    int64_t bytes_217482 =
            futhark_mc_segmap_parloop_struct_235814->free_bytes_217482;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235814->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_235814->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_235814->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_235814->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_235814->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_segmap_parloop_struct_235814->free_mem_218033,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235814->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235814->free_mem_218175,
                                  .size =0, .references =NULL};
    size_t mem_218081_cached_sizze_235816 = 0;
    unsigned char *mem_218081 = NULL;
    size_t mem_218085_cached_sizze_235817 = 0;
    unsigned char *mem_218085 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222942 = start;
    
    if (mem_218081_cached_sizze_235816 < (size_t) bytes_217482) {
        mem_218081 = realloc(mem_218081, bytes_217482);
        mem_218081_cached_sizze_235816 = bytes_217482;
    }
    if (mem_218085_cached_sizze_235817 < (size_t) bytes_217482) {
        mem_218085 = realloc(mem_218085, bytes_217482);
        mem_218085_cached_sizze_235817 = bytes_217482;
    }
    for (; iter_222942 < end; iter_222942++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_222969 = partition_sizze_203667;
        int64_t gtid_207801 = iter_222942;
        int64_t remnant_222970 = iter_222942 - gtid_207801;
        
        for (int64_t i_222943 = 0; i_222943 < n_p_203574; i_222943++) {
            for (int64_t i_222948 = 0; i_222948 < defunc_0_f_res_203721;
                 i_222948++) {
                int64_t x_222951;
                
                x_222951 = ((int64_t *) mem_217654.mem)[gtid_207801 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_222943 *
                                                        defunc_0_f_res_203721 +
                                                        i_222948];
                
                int64_t x_222952 = mul64(n_p_203574, x_222951);
                int64_t idx_222953 = add64(x_222952, i_222943);
                bool cond_222954 = slt64(i_203760, idx_222953);
                bool cond_f_res_222955 = slt64(x_222951, (int64_t) 0);
                bool x_222956 = !cond_222954;
                bool y_222957 = cond_f_res_222955 && x_222956;
                bool cond_222958 = cond_222954 || y_222957;
                double defunc_0_f_res_222959;
                double defunc_0_f_res_222960;
                
                if (cond_222958) {
                    defunc_0_f_res_222959 = 0.0;
                    defunc_0_f_res_222960 = 0.0;
                } else {
                    bool x_222961 = sle64((int64_t) 0, idx_222953);
                    bool y_222962 = slt64(idx_222953, n_203572);
                    bool bounds_check_222963 = x_222961 && y_222962;
                    bool index_certs_222964;
                    
                    if (!bounds_check_222963) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) idx_222953,
                                      "] out of bounds for array of shape [",
                                      (long long) n_203572, "].",
                                      "-> #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_222965;
                    
                    defunc_0_f_res_f_res_222965 =
                        ((double *) mem_218033.mem)[gtid_207801 * n_203572 +
                                                    idx_222953];
                    
                    double defunc_0_f_res_f_res_222966;
                    
                    defunc_0_f_res_f_res_222966 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_207801 *
                                                           ctx_param_ext_217985 +
                                                           idx_222953 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_222959 = defunc_0_f_res_f_res_222965;
                    defunc_0_f_res_222960 = defunc_0_f_res_f_res_222966;
                }
                ((double *) mem_218081)[i_222943 * defunc_0_f_res_203721 +
                                        i_222948] = defunc_0_f_res_222959;
                ((double *) mem_218085)[i_222943 * defunc_0_f_res_203721 +
                                        i_222948] = defunc_0_f_res_222960;
            }
        }
        if (n_p_203574 * defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_218170.mem + gtid_207801 * (defunc_0_f_res_203721 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_218081 + (int64_t) 0, n_p_203574 *
                    defunc_0_f_res_203721 * (int64_t) 8);
        if (n_p_203574 * defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_218175.mem + gtid_207801 * (defunc_0_f_res_203721 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_218085 + (int64_t) 0, n_p_203574 *
                    defunc_0_f_res_203721 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218081);
    free(mem_218085);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235815_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235815_end -
                 futhark_mc_segmap_parloop_235815_start;
        
        ctx->futhark_mc_segmap_parloop_235815_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235815_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235815_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235813(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207800 = tid;
    int num_tasks_222941 = 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_segmap_task_235813_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235813_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235812->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235812->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235812->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235812->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235812->free_i_203760;
    int64_t bytes_217463 = futhark_mc_task_235812->free_bytes_217463;
    int64_t bytes_217482 = futhark_mc_task_235812->free_bytes_217482;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235812->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_235812->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_235812->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_235812->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_235812->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_task_235812->free_mem_218033,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235812->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235812->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t iter_222942;
    struct futhark_mc_segmap_parloop_struct_235814
    futhark_mc_segmap_parloop_struct_235814;
    
    futhark_mc_segmap_parloop_struct_235814.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235814.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235814.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235814.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235814.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235814.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235814.free_bytes_217482 = bytes_217482;
    futhark_mc_segmap_parloop_struct_235814.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235814.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_235814.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_235814.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_235814.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_235814.free_mem_218033 = mem_218033.mem;
    futhark_mc_segmap_parloop_struct_235814.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235814.free_mem_218175 = mem_218175.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235815_task;
    
    futhark_mc_segmap_parloop_235815_task.name =
        "futhark_mc_segmap_parloop_235815";
    futhark_mc_segmap_parloop_235815_task.fn = futhark_mc_segmap_parloop_235815;
    futhark_mc_segmap_parloop_235815_task.args =
        &futhark_mc_segmap_parloop_struct_235814;
    futhark_mc_segmap_parloop_235815_task.iterations = iterations;
    futhark_mc_segmap_parloop_235815_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235815_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235815_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235815_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235815_task);
    
    if (futhark_mc_segmap_parloop_235815_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235815_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235815_total_end -
                 futhark_mc_segmap_parloop_235815_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235815_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235815_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235815_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235813_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235813_end -
                 futhark_mc_segmap_task_235813_start;
        
        ctx->futhark_mc_segmap_task_235813_runs[tid]++;
        ctx->futhark_mc_segmap_task_235813_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235813_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235819 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_bytes_217463;
    int64_t free_bytes_217482;
    unsigned char *free_mem_217654;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_218033;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
};
struct futhark_mc_task_235823 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207835;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217654;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_218033;
    unsigned char *free_mem_218073;
    unsigned char *free_mem_218077;
};
struct futhark_mc_segmap_parloop_struct_235825 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207835;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217654;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_218033;
    unsigned char *free_mem_218073;
    unsigned char *free_mem_218077;
};
static int futhark_mc_segmap_parloop_235826(void *args, int64_t start,
                                            int64_t end, int flat_tid_223000,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235825
    *futhark_mc_segmap_parloop_struct_235825 =
    (struct futhark_mc_segmap_parloop_struct_235825 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235825->ctx;
    uint64_t futhark_mc_segmap_parloop_235826_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235826_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235825->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235825->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235825->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235825->free_i_203760;
    int64_t gtid_207835 =
            futhark_mc_segmap_parloop_struct_235825->free_gtid_207835;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235825->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235825->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_235825->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_235825->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_235825->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_235825->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_segmap_parloop_struct_235825->free_mem_218033,
                                  .size =0, .references =NULL};
    struct memblock mem_218073 = {.desc ="mem_218073", .mem =
                                  futhark_mc_segmap_parloop_struct_235825->free_mem_218073,
                                  .size =0, .references =NULL};
    struct memblock mem_218077 = {.desc ="mem_218077", .mem =
                                  futhark_mc_segmap_parloop_struct_235825->free_mem_218077,
                                  .size =0, .references =NULL};
    size_t mem_223002_cached_sizze_235827 = 0;
    unsigned char *mem_223002 = NULL;
    size_t mem_223004_cached_sizze_235828 = 0;
    unsigned char *mem_223004 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223032 = start;
    
    if (mem_223002_cached_sizze_235827 < (size_t) bytes_217463) {
        mem_223002 = realloc(mem_223002, bytes_217463);
        mem_223002_cached_sizze_235827 = bytes_217463;
    }
    if (mem_223004_cached_sizze_235828 < (size_t) bytes_217463) {
        mem_223004 = realloc(mem_223004, bytes_217463);
        mem_223004_cached_sizze_235828 = bytes_217463;
    }
    for (; iter_223032 < end; iter_223032++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223054 = n_p_203574;
        int64_t gtid_223001 = iter_223032;
        int64_t remnant_223055 = iter_223032 - gtid_223001;
        
        for (int64_t i_223033 = 0; i_223033 < defunc_0_f_res_203721;
             i_223033++) {
            int64_t x_223036;
            
            x_223036 = ((int64_t *) mem_217654.mem)[gtid_207835 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_223001 *
                                                    defunc_0_f_res_203721 +
                                                    i_223033];
            
            int64_t x_223037 = mul64(n_p_203574, x_223036);
            int64_t idx_223038 = add64(gtid_223001, x_223037);
            bool cond_223039 = slt64(i_203760, idx_223038);
            bool cond_f_res_223040 = slt64(x_223036, (int64_t) 0);
            bool x_223041 = !cond_223039;
            bool y_223042 = cond_f_res_223040 && x_223041;
            bool cond_223043 = cond_223039 || y_223042;
            double defunc_0_f_res_223044;
            double defunc_0_f_res_223045;
            
            if (cond_223043) {
                defunc_0_f_res_223044 = 0.0;
                defunc_0_f_res_223045 = 0.0;
            } else {
                bool x_223046 = sle64((int64_t) 0, idx_223038);
                bool y_223047 = slt64(idx_223038, n_203572);
                bool bounds_check_223048 = x_223046 && y_223047;
                bool index_certs_223049;
                
                if (!bounds_check_223048) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) idx_223038,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_223050;
                
                defunc_0_f_res_f_res_223050 =
                    ((double *) mem_218033.mem)[gtid_207835 * n_203572 +
                                                idx_223038];
                
                double defunc_0_f_res_f_res_223051;
                
                defunc_0_f_res_f_res_223051 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_207835 *
                                                       ctx_param_ext_217985 +
                                                       idx_223038 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_223044 = defunc_0_f_res_f_res_223050;
                defunc_0_f_res_223045 = defunc_0_f_res_f_res_223051;
            }
            ((double *) mem_223002)[i_223033] = defunc_0_f_res_223044;
            ((double *) mem_223004)[i_223033] = defunc_0_f_res_223045;
        }
        if (defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_218073.mem + gtid_223001 * defunc_0_f_res_203721 *
                    (int64_t) 8, mem_223002 + (int64_t) 0,
                    defunc_0_f_res_203721 * (int64_t) 8);
        if (defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_218077.mem + gtid_223001 * defunc_0_f_res_203721 *
                    (int64_t) 8, mem_223004 + (int64_t) 0,
                    defunc_0_f_res_203721 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_223002);
    free(mem_223004);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235826_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235826_end -
                 futhark_mc_segmap_parloop_235826_start;
        
        ctx->futhark_mc_segmap_parloop_235826_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235826_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235826_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235824(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223000 = tid;
    int num_tasks_223031 = info.nsubtasks;
    struct futhark_mc_task_235823 *futhark_mc_task_235823 =
                                  (struct futhark_mc_task_235823 *) args;
    struct futhark_context *ctx = futhark_mc_task_235823->ctx;
    uint64_t futhark_mc_segmap_task_235824_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235824_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235823->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235823->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235823->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235823->free_i_203760;
    int64_t gtid_207835 = futhark_mc_task_235823->free_gtid_207835;
    int64_t bytes_217463 = futhark_mc_task_235823->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235823->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_235823->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_235823->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_235823->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_235823->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_task_235823->free_mem_218033,
                                  .size =0, .references =NULL};
    struct memblock mem_218073 = {.desc ="mem_218073", .mem =
                                  futhark_mc_task_235823->free_mem_218073,
                                  .size =0, .references =NULL};
    struct memblock mem_218077 = {.desc ="mem_218077", .mem =
                                  futhark_mc_task_235823->free_mem_218077,
                                  .size =0, .references =NULL};
    int64_t iter_223032;
    struct futhark_mc_segmap_parloop_struct_235825
    futhark_mc_segmap_parloop_struct_235825;
    
    futhark_mc_segmap_parloop_struct_235825.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235825.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235825.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235825.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235825.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235825.free_gtid_207835 = gtid_207835;
    futhark_mc_segmap_parloop_struct_235825.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235825.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235825.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_235825.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_235825.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_235825.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_235825.free_mem_218033 = mem_218033.mem;
    futhark_mc_segmap_parloop_struct_235825.free_mem_218073 = mem_218073.mem;
    futhark_mc_segmap_parloop_struct_235825.free_mem_218077 = mem_218077.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235826_task;
    
    futhark_mc_segmap_parloop_235826_task.name =
        "futhark_mc_segmap_parloop_235826";
    futhark_mc_segmap_parloop_235826_task.fn = futhark_mc_segmap_parloop_235826;
    futhark_mc_segmap_parloop_235826_task.args =
        &futhark_mc_segmap_parloop_struct_235825;
    futhark_mc_segmap_parloop_235826_task.iterations = iterations;
    futhark_mc_segmap_parloop_235826_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235826_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235826_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235826_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235826_task);
    
    if (futhark_mc_segmap_parloop_235826_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235826_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235826_total_end -
                 futhark_mc_segmap_parloop_235826_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235826_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235826_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235826_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235824_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235824_end -
                 futhark_mc_segmap_task_235824_start;
        
        ctx->futhark_mc_segmap_task_235824_runs[tid]++;
        ctx->futhark_mc_segmap_task_235824_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235824_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235830 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207835;
    int64_t free_bytes_217463;
    unsigned char *free_mem_217654;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_218033;
    unsigned char *free_mem_218073;
    unsigned char *free_mem_218077;
};
struct futhark_mc_task_235834 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207835;
    unsigned char *free_mem_217654;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_218033;
    int64_t free_gtid_222977;
    unsigned char *free_mem_222978;
    unsigned char *free_mem_222979;
};
struct futhark_mc_segmap_parloop_struct_235836 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_i_203760;
    int64_t free_gtid_207835;
    unsigned char *free_mem_217654;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_218033;
    int64_t free_gtid_222977;
    unsigned char *free_mem_222978;
    unsigned char *free_mem_222979;
};
static int futhark_mc_segmap_parloop_235837(void *args, int64_t start,
                                            int64_t end, int flat_tid_223059,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235836
    *futhark_mc_segmap_parloop_struct_235836 =
    (struct futhark_mc_segmap_parloop_struct_235836 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235836->ctx;
    uint64_t futhark_mc_segmap_parloop_235837_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235837_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235836->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235836->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235836->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235836->free_i_203760;
    int64_t gtid_207835 =
            futhark_mc_segmap_parloop_struct_235836->free_gtid_207835;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235836->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_235836->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_235836->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_235836->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_235836->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_segmap_parloop_struct_235836->free_mem_218033,
                                  .size =0, .references =NULL};
    int64_t gtid_222977 =
            futhark_mc_segmap_parloop_struct_235836->free_gtid_222977;
    struct memblock mem_222978 = {.desc ="mem_222978", .mem =
                                  futhark_mc_segmap_parloop_struct_235836->free_mem_222978,
                                  .size =0, .references =NULL};
    struct memblock mem_222979 = {.desc ="mem_222979", .mem =
                                  futhark_mc_segmap_parloop_struct_235836->free_mem_222979,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_223080 = start;
    
    for (; iter_223080 < end; iter_223080++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223087 = defunc_0_f_res_203721;
        int64_t gtid_223060 = iter_223080;
        int64_t remnant_223088 = iter_223080 - gtid_223060;
        int64_t x_223061;
        
        x_223061 = ((int64_t *) mem_217654.mem)[gtid_207835 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_222977 *
                                                defunc_0_f_res_203721 +
                                                gtid_223060];
        
        int64_t x_223062 = mul64(n_p_203574, x_223061);
        int64_t idx_223063 = add64(gtid_222977, x_223062);
        bool cond_223064 = slt64(i_203760, idx_223063);
        bool cond_f_res_223065 = slt64(x_223061, (int64_t) 0);
        bool x_223066 = !cond_223064;
        bool y_223067 = cond_f_res_223065 && x_223066;
        bool cond_223068 = cond_223064 || y_223067;
        double defunc_0_f_res_223069;
        double defunc_0_f_res_223070;
        
        if (cond_223068) {
            defunc_0_f_res_223069 = 0.0;
            defunc_0_f_res_223070 = 0.0;
        } else {
            bool x_223081 = sle64((int64_t) 0, idx_223063);
            bool y_223082 = slt64(idx_223063, n_203572);
            bool bounds_check_223083 = x_223081 && y_223082;
            bool index_certs_223084;
            
            if (!bounds_check_223083) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) idx_223063,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_223085;
            
            defunc_0_f_res_f_res_223085 =
                ((double *) mem_218033.mem)[gtid_207835 * n_203572 +
                                            idx_223063];
            
            double defunc_0_f_res_f_res_223086;
            
            defunc_0_f_res_f_res_223086 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_207835 *
                                                   ctx_param_ext_217985 +
                                                   idx_223063 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_223069 = defunc_0_f_res_f_res_223085;
            defunc_0_f_res_223070 = defunc_0_f_res_f_res_223086;
        }
        ((double *) mem_222978.mem)[gtid_223060] = defunc_0_f_res_223069;
        ((double *) mem_222979.mem)[gtid_223060] = defunc_0_f_res_223070;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235837_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235837_end -
                 futhark_mc_segmap_parloop_235837_start;
        
        ctx->futhark_mc_segmap_parloop_235837_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235837_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235837_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235835(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223059 = tid;
    int num_tasks_223079 = info.nsubtasks;
    struct futhark_mc_task_235834 *futhark_mc_task_235834 =
                                  (struct futhark_mc_task_235834 *) args;
    struct futhark_context *ctx = futhark_mc_task_235834->ctx;
    uint64_t futhark_mc_segmap_task_235835_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235835_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235834->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235834->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235834->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235834->free_i_203760;
    int64_t gtid_207835 = futhark_mc_task_235834->free_gtid_207835;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235834->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_235834->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_235834->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_235834->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_235834->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_task_235834->free_mem_218033,
                                  .size =0, .references =NULL};
    int64_t gtid_222977 = futhark_mc_task_235834->free_gtid_222977;
    struct memblock mem_222978 = {.desc ="mem_222978", .mem =
                                  futhark_mc_task_235834->free_mem_222978,
                                  .size =0, .references =NULL};
    struct memblock mem_222979 = {.desc ="mem_222979", .mem =
                                  futhark_mc_task_235834->free_mem_222979,
                                  .size =0, .references =NULL};
    int64_t iter_223080;
    struct futhark_mc_segmap_parloop_struct_235836
    futhark_mc_segmap_parloop_struct_235836;
    
    futhark_mc_segmap_parloop_struct_235836.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235836.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235836.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235836.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235836.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235836.free_gtid_207835 = gtid_207835;
    futhark_mc_segmap_parloop_struct_235836.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235836.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_235836.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_235836.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_235836.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_235836.free_mem_218033 = mem_218033.mem;
    futhark_mc_segmap_parloop_struct_235836.free_gtid_222977 = gtid_222977;
    futhark_mc_segmap_parloop_struct_235836.free_mem_222978 = mem_222978.mem;
    futhark_mc_segmap_parloop_struct_235836.free_mem_222979 = mem_222979.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235837_task;
    
    futhark_mc_segmap_parloop_235837_task.name =
        "futhark_mc_segmap_parloop_235837";
    futhark_mc_segmap_parloop_235837_task.fn = futhark_mc_segmap_parloop_235837;
    futhark_mc_segmap_parloop_235837_task.args =
        &futhark_mc_segmap_parloop_struct_235836;
    futhark_mc_segmap_parloop_235837_task.iterations = iterations;
    futhark_mc_segmap_parloop_235837_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235837_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235837_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235837_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235837_task);
    
    if (futhark_mc_segmap_parloop_235837_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235837_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235837_total_end -
                 futhark_mc_segmap_parloop_235837_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235837_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235837_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235837_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235835_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235835_end -
                 futhark_mc_segmap_task_235835_start;
        
        ctx->futhark_mc_segmap_task_235835_runs[tid]++;
        ctx->futhark_mc_segmap_task_235835_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235835_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235831(void *args, int64_t start,
                                            int64_t end, int flat_tid_222976,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235830
    *futhark_mc_segmap_parloop_struct_235830 =
    (struct futhark_mc_segmap_parloop_struct_235830 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235830->ctx;
    uint64_t futhark_mc_segmap_parloop_235831_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235831_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_235830->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235830->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235830->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235830->free_i_203760;
    int64_t gtid_207835 =
            futhark_mc_segmap_parloop_struct_235830->free_gtid_207835;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235830->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235830->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_235830->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_235830->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_235830->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_235830->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_segmap_parloop_struct_235830->free_mem_218033,
                                  .size =0, .references =NULL};
    struct memblock mem_218073 = {.desc ="mem_218073", .mem =
                                  futhark_mc_segmap_parloop_struct_235830->free_mem_218073,
                                  .size =0, .references =NULL};
    struct memblock mem_218077 = {.desc ="mem_218077", .mem =
                                  futhark_mc_segmap_parloop_struct_235830->free_mem_218077,
                                  .size =0, .references =NULL};
    size_t mem_222978_cached_sizze_235832 = 0;
    unsigned char *mem_222978 = NULL;
    size_t mem_222979_cached_sizze_235833 = 0;
    unsigned char *mem_222979 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223058 = start;
    
    if (mem_222978_cached_sizze_235832 < (size_t) bytes_217463) {
        mem_222978 = realloc(mem_222978, bytes_217463);
        mem_222978_cached_sizze_235832 = bytes_217463;
    }
    if (mem_222979_cached_sizze_235833 < (size_t) bytes_217463) {
        mem_222979 = realloc(mem_222979, bytes_217463);
        mem_222979_cached_sizze_235833 = bytes_217463;
    }
    for (; iter_223058 < end; iter_223058++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223077 = n_p_203574;
        int64_t gtid_222977 = iter_223058;
        int64_t remnant_223078 = iter_223058 - gtid_222977;
        int64_t flat_tid_223059 = (int64_t) 0;
        int32_t num_tasks_223079;
        struct futhark_mc_task_235834 futhark_mc_task_235834;
        
        futhark_mc_task_235834.ctx = ctx;
        futhark_mc_task_235834.free_n_203572 = n_203572;
        futhark_mc_task_235834.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235834.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235834.free_i_203760 = i_203760;
        futhark_mc_task_235834.free_gtid_207835 = gtid_207835;
        futhark_mc_task_235834.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235834.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_235834.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_235834.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_235834.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_235834.free_mem_218033 = mem_218033.mem;
        futhark_mc_task_235834.free_gtid_222977 = gtid_222977;
        futhark_mc_task_235834.free_mem_222978 = mem_222978;
        futhark_mc_task_235834.free_mem_222979 = mem_222979;
        
        struct scheduler_segop futhark_mc_task_235834_task;
        
        futhark_mc_task_235834_task.args = &futhark_mc_task_235834;
        futhark_mc_task_235834_task.top_level_fn =
            futhark_mc_segmap_task_235835;
        futhark_mc_task_235834_task.name = "futhark_mc_segmap_task_235835";
        futhark_mc_task_235834_task.iterations = defunc_0_f_res_203721;
        futhark_mc_task_235834_task.task_time =
            &ctx->futhark_mc_segmap_task_235835_total_time;
        futhark_mc_task_235834_task.task_iter =
            &ctx->futhark_mc_segmap_task_235835_total_iter;
        futhark_mc_task_235834_task.sched = STATIC;
        futhark_mc_task_235834_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_235835_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235834_task);
        
        if (futhark_mc_segmap_task_235835_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_218073.mem + gtid_222977 * defunc_0_f_res_203721 *
                    (int64_t) 8, mem_222978 + (int64_t) 0,
                    defunc_0_f_res_203721 * (int64_t) 8);
        if (defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_218077.mem + gtid_222977 * defunc_0_f_res_203721 *
                    (int64_t) 8, mem_222979 + (int64_t) 0,
                    defunc_0_f_res_203721 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_222978);
    free(mem_222979);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235831_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235831_end -
                 futhark_mc_segmap_parloop_235831_start;
        
        ctx->futhark_mc_segmap_parloop_235831_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235831_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235831_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235829(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_222976 = tid;
    int num_tasks_223031 = info.nsubtasks;
    struct futhark_mc_task_235823 *futhark_mc_task_235823 =
                                  (struct futhark_mc_task_235823 *) args;
    struct futhark_context *ctx = futhark_mc_task_235823->ctx;
    uint64_t futhark_mc_segmap_nested_task_235829_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235829_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235823->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235823->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235823->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235823->free_i_203760;
    int64_t gtid_207835 = futhark_mc_task_235823->free_gtid_207835;
    int64_t bytes_217463 = futhark_mc_task_235823->free_bytes_217463;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235823->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_235823->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_235823->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_235823->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_235823->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_task_235823->free_mem_218033,
                                  .size =0, .references =NULL};
    struct memblock mem_218073 = {.desc ="mem_218073", .mem =
                                  futhark_mc_task_235823->free_mem_218073,
                                  .size =0, .references =NULL};
    struct memblock mem_218077 = {.desc ="mem_218077", .mem =
                                  futhark_mc_task_235823->free_mem_218077,
                                  .size =0, .references =NULL};
    int64_t iter_223058;
    struct futhark_mc_segmap_parloop_struct_235830
    futhark_mc_segmap_parloop_struct_235830;
    
    futhark_mc_segmap_parloop_struct_235830.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235830.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235830.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235830.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235830.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235830.free_gtid_207835 = gtid_207835;
    futhark_mc_segmap_parloop_struct_235830.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235830.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235830.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_235830.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_235830.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_235830.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_235830.free_mem_218033 = mem_218033.mem;
    futhark_mc_segmap_parloop_struct_235830.free_mem_218073 = mem_218073.mem;
    futhark_mc_segmap_parloop_struct_235830.free_mem_218077 = mem_218077.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235831_task;
    
    futhark_mc_segmap_parloop_235831_task.name =
        "futhark_mc_segmap_parloop_235831";
    futhark_mc_segmap_parloop_235831_task.fn = futhark_mc_segmap_parloop_235831;
    futhark_mc_segmap_parloop_235831_task.args =
        &futhark_mc_segmap_parloop_struct_235830;
    futhark_mc_segmap_parloop_235831_task.iterations = iterations;
    futhark_mc_segmap_parloop_235831_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235831_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235831_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235831_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235831_task);
    
    if (futhark_mc_segmap_parloop_235831_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235831_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235831_total_end -
                 futhark_mc_segmap_parloop_235831_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235831_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235831_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235831_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235829_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235829_end -
                 futhark_mc_segmap_nested_task_235829_start;
        
        ctx->futhark_mc_segmap_nested_task_235829_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235829_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235829_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235820(void *args, int64_t start,
                                            int64_t end, int flat_tid_207834,
                                            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_203572 = futhark_mc_segmap_parloop_struct_235819->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235819->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235819->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235819->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_235819->free_i_203760;
    int64_t bytes_217463 =
            futhark_mc_segmap_parloop_struct_235819->free_bytes_217463;
    int64_t bytes_217482 =
            futhark_mc_segmap_parloop_struct_235819->free_bytes_217482;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_235819->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_235819->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_235819->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_235819->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_218033,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235819->free_mem_218175,
                                  .size =0, .references =NULL};
    size_t mem_218073_cached_sizze_235821 = 0;
    unsigned char *mem_218073 = NULL;
    size_t mem_218077_cached_sizze_235822 = 0;
    unsigned char *mem_218077 = NULL;
    int64_t iterations = end - start;
    int64_t iter_222975 = start;
    
    if (mem_218073_cached_sizze_235821 < (size_t) bytes_217482) {
        mem_218073 = realloc(mem_218073, bytes_217482);
        mem_218073_cached_sizze_235821 = bytes_217482;
    }
    if (mem_218077_cached_sizze_235822 < (size_t) bytes_217482) {
        mem_218077 = realloc(mem_218077, bytes_217482);
        mem_218077_cached_sizze_235822 = bytes_217482;
    }
    for (; iter_222975 < end; iter_222975++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223029 = partition_sizze_203667;
        int64_t gtid_207835 = iter_222975;
        int64_t remnant_223030 = iter_222975 - gtid_207835;
        int64_t flat_tid_223000 = (int64_t) 0;
        int32_t num_tasks_223031;
        int64_t flat_tid_222976 = (int64_t) 0;
        struct futhark_mc_task_235823 futhark_mc_task_235823;
        
        futhark_mc_task_235823.ctx = ctx;
        futhark_mc_task_235823.free_n_203572 = n_203572;
        futhark_mc_task_235823.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235823.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235823.free_i_203760 = i_203760;
        futhark_mc_task_235823.free_gtid_207835 = gtid_207835;
        futhark_mc_task_235823.free_bytes_217463 = bytes_217463;
        futhark_mc_task_235823.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235823.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_235823.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_235823.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_235823.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_235823.free_mem_218033 = mem_218033.mem;
        futhark_mc_task_235823.free_mem_218073 = mem_218073;
        futhark_mc_task_235823.free_mem_218077 = mem_218077;
        
        struct scheduler_segop futhark_mc_task_235823_task;
        
        futhark_mc_task_235823_task.args = &futhark_mc_task_235823;
        futhark_mc_task_235823_task.top_level_fn =
            futhark_mc_segmap_task_235824;
        futhark_mc_task_235823_task.name = "futhark_mc_segmap_task_235824";
        futhark_mc_task_235823_task.iterations = n_p_203574;
        futhark_mc_task_235823_task.task_time =
            &ctx->futhark_mc_segmap_task_235824_total_time;
        futhark_mc_task_235823_task.task_iter =
            &ctx->futhark_mc_segmap_task_235824_total_iter;
        futhark_mc_task_235823_task.sched = STATIC;
        futhark_mc_task_235823_task.nested_fn =
            futhark_mc_segmap_nested_task_235829;
        
        int futhark_mc_segmap_task_235824_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235823_task);
        
        if (futhark_mc_segmap_task_235824_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_218170.mem + gtid_207835 * (defunc_0_f_res_203721 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_218073 + (int64_t) 0, n_p_203574 *
                    defunc_0_f_res_203721 * (int64_t) 8);
        if (n_p_203574 * defunc_0_f_res_203721 * (int64_t) 8 > 0)
            memmove(mem_218175.mem + gtid_207835 * (defunc_0_f_res_203721 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_218077 + (int64_t) 0, n_p_203574 *
                    defunc_0_f_res_203721 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218073);
    free(mem_218077);
    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_nested_task_235818(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207834 = tid;
    int num_tasks_222941 = 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_segmap_nested_task_235818_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235818_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_235812->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_235812->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235812->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235812->free_defunc_0_f_res_203721;
    int64_t i_203760 = futhark_mc_task_235812->free_i_203760;
    int64_t bytes_217463 = futhark_mc_task_235812->free_bytes_217463;
    int64_t bytes_217482 = futhark_mc_task_235812->free_bytes_217482;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235812->free_mem_217654,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_235812->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_235812->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_235812->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_235812->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_218033 = {.desc ="mem_218033", .mem =
                                  futhark_mc_task_235812->free_mem_218033,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235812->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235812->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t iter_222975;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_235819.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235819.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235819.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235819.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_235819.free_bytes_217463 = bytes_217463;
    futhark_mc_segmap_parloop_struct_235819.free_bytes_217482 = bytes_217482;
    futhark_mc_segmap_parloop_struct_235819.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235819.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_235819.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_235819.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_235819.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_235819.free_mem_218033 = mem_218033.mem;
    futhark_mc_segmap_parloop_struct_235819.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235819.free_mem_218175 = mem_218175.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_nested_task_235818_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235818_end -
                 futhark_mc_segmap_nested_task_235818_start;
        
        ctx->futhark_mc_segmap_nested_task_235818_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235818_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235818_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235838 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218251;
};
struct futhark_mc_segmap_parloop_struct_235840 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218251;
};
static int futhark_mc_segmap_parloop_235841(void *args, int64_t start,
                                            int64_t end, int flat_tid_207887,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235840
    *futhark_mc_segmap_parloop_struct_235840 =
    (struct futhark_mc_segmap_parloop_struct_235840 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235840->ctx;
    uint64_t futhark_mc_segmap_parloop_235841_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235841_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235840->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235840->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235840->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235840->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235840->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235840->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235840->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235840->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235840->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235840->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235840->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235840->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235840->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235840->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218251 = {.desc ="mem_218251", .mem =
                                  futhark_mc_segmap_parloop_struct_235840->free_mem_218251,
                                  .size =0, .references =NULL};
    size_t mem_218206_cached_sizze_235842 = 0;
    unsigned char *mem_218206 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223093 = start;
    
    if (mem_218206_cached_sizze_235842 < (size_t) bytes_217715) {
        mem_218206 = realloc(mem_218206, bytes_217715);
        mem_218206_cached_sizze_235842 = bytes_217715;
    }
    for (; iter_223093 < end; iter_223093++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223172 = partition_sizze_203667;
        int64_t gtid_207888 = iter_223093;
        int64_t remnant_223173 = iter_223093 - gtid_207888;
        
        for (int64_t i_223094 = 0; i_223094 < n_p_203574; i_223094++) {
            int64_t x_223096;
            
            x_223096 = ((int64_t *) mem_217658.mem)[gtid_207888 * n_p_203574 +
                                                    i_223094];
            for (int64_t i_223098 = 0; i_223098 < s_n_m_203726; i_223098++) {
                int64_t x_223100;
                
                x_223100 = ((int64_t *) mem_217828.mem)[gtid_207888 *
                                                        (s_n_m_203726 *
                                                         n_p_203574) +
                                                        i_223094 *
                                                        s_n_m_203726 +
                                                        i_223098];
                
                double x_223101;
                
                x_223101 = ((double *) mem_217833.mem)[gtid_207888 *
                                                       (s_n_m_203726 *
                                                        n_p_203574) + i_223094 *
                                                       s_n_m_203726 + i_223098];
                
                bool cond_223102 = i_223098 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_223103;
                
                if (cond_223102) {
                    defunc_0_m_fun_res_223103 = (int64_t) 0;
                } else {
                    int64_t y_223104 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_223105 = i_223098 == y_223104;
                    int64_t defunc_0_m_fun_res_f_res_223106;
                    
                    if (cond_223105) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_223107 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_223106 =
                            defunc_0_m_fun_res_f_res_t_res_223107;
                    } else {
                        int64_t x_223108 = sub64(i_223098, (int64_t) 1);
                        int64_t x_223109 = mul64(jump_s_203581, x_223108);
                        int64_t min_arg_223110 = add64((int64_t) 1, x_223109);
                        int64_t min_res_223111 = smin64(defunc_0_f_res_203721,
                                                        min_arg_223110);
                        
                        defunc_0_m_fun_res_f_res_223106 = min_res_223111;
                    }
                    defunc_0_m_fun_res_223103 = defunc_0_m_fun_res_f_res_223106;
                }
                
                double defunc_2_reduce_res_223112;
                double redout_223114 = 0.0;
                
                for (int64_t i_223113 = 0; i_223113 < q_s_203575; i_223113++) {
                    bool cond_223115 = sle64(x_223096, i_223113);
                    int64_t defunc_0_f_res_223116;
                    
                    if (cond_223115) {
                        defunc_0_f_res_223116 = (int64_t) 0;
                    } else {
                        int64_t i_223117 = add64(x_223100, i_223113);
                        int64_t defunc_0_add_arg_223118;
                        
                        defunc_0_add_arg_223118 =
                            ((int64_t *) mem_217654.mem)[gtid_207888 *
                                                         (defunc_0_f_res_203721 *
                                                          n_p_203574) +
                                                         i_223094 *
                                                         defunc_0_f_res_203721 +
                                                         i_223117];
                        
                        int64_t defunc_1_add_res_223119 = add64((int64_t) 1,
                                                                defunc_0_add_arg_223118);
                        
                        defunc_0_f_res_223116 = defunc_1_add_res_223119;
                    }
                    
                    double defunc_0_f_res_223120;
                    
                    if (cond_223115) {
                        defunc_0_f_res_223120 = 0.0;
                    } else {
                        int64_t i_223121 = add64(x_223100, i_223113);
                        double defunc_0_add_arg_223122;
                        
                        defunc_0_add_arg_223122 =
                            ((double *) mem_218175.mem)[gtid_207888 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_223094 *
                                                        defunc_0_f_res_203721 +
                                                        i_223121];
                        defunc_0_f_res_223120 = defunc_0_add_arg_223122;
                    }
                    
                    int64_t binop_p_223123 = sub64(defunc_0_f_res_223116,
                                                   defunc_0_m_fun_res_223103);
                    double defunc_0_f_res_223124 =
                           sitofp_i64_f64(binop_p_223123);
                    double abs_res_223125 = fabs(defunc_0_f_res_223124);
                    double tmp1_223126 = abs_res_223125 / x_223101;
                    double x_223127 = tmp1_223126 * tmp1_223126;
                    double y_223128 = tmp1_223126 * x_223127;
                    double tmp2_223129 = 1.0 - y_223128;
                    double x_223130 = tmp2_223129 * tmp2_223129;
                    double tmp3_223131 = tmp2_223129 * x_223130;
                    double w_j_223132 = defunc_0_f_res_223120 * tmp3_223131;
                    double defunc_1_op_res_223133 = w_j_223132 + redout_223114;
                    double redout_tmp_223176 = defunc_1_op_res_223133;
                    
                    redout_223114 = redout_tmp_223176;
                }
                defunc_2_reduce_res_223112 = redout_223114;
                
                double a0_223134 = 1.0 / defunc_2_reduce_res_223112;
                int64_t defunc_0_m_fun_res_223135;
                
                if (cond_223102) {
                    defunc_0_m_fun_res_223135 = (int64_t) 0;
                } else {
                    int64_t y_223136 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_223137 = i_223098 == y_223136;
                    int64_t defunc_0_m_fun_res_f_res_223138;
                    
                    if (cond_223137) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_223139 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_223138 =
                            defunc_0_m_fun_res_f_res_t_res_223139;
                    } else {
                        int64_t x_223140 = sub64(i_223098, (int64_t) 1);
                        int64_t x_223141 = mul64(jump_s_203581, x_223140);
                        int64_t min_arg_223142 = add64((int64_t) 1, x_223141);
                        int64_t min_res_223143 = smin64(defunc_0_f_res_203721,
                                                        min_arg_223142);
                        
                        defunc_0_m_fun_res_f_res_223138 = min_res_223143;
                    }
                    defunc_0_m_fun_res_223135 = defunc_0_m_fun_res_f_res_223138;
                }
                
                double defunc_2_reduce_res_223144;
                double redout_223146 = 0.0;
                
                for (int64_t i_223145 = 0; i_223145 < q_s_203575; i_223145++) {
                    bool cond_223147 = sle64(x_223096, i_223145);
                    int64_t defunc_0_f_res_223148;
                    
                    if (cond_223147) {
                        defunc_0_f_res_223148 = (int64_t) 0;
                    } else {
                        int64_t i_223149 = add64(x_223100, i_223145);
                        int64_t defunc_0_add_arg_223150;
                        
                        defunc_0_add_arg_223150 =
                            ((int64_t *) mem_217654.mem)[gtid_207888 *
                                                         (defunc_0_f_res_203721 *
                                                          n_p_203574) +
                                                         i_223094 *
                                                         defunc_0_f_res_203721 +
                                                         i_223149];
                        
                        int64_t defunc_1_add_res_223151 = add64((int64_t) 1,
                                                                defunc_0_add_arg_223150);
                        
                        defunc_0_f_res_223148 = defunc_1_add_res_223151;
                    }
                    
                    double defunc_0_f_res_223152;
                    
                    if (cond_223147) {
                        defunc_0_f_res_223152 = 0.0;
                    } else {
                        int64_t i_223153 = add64(x_223100, i_223145);
                        double defunc_0_add_arg_223154;
                        
                        defunc_0_add_arg_223154 =
                            ((double *) mem_218175.mem)[gtid_207888 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_223094 *
                                                        defunc_0_f_res_203721 +
                                                        i_223153];
                        defunc_0_f_res_223152 = defunc_0_add_arg_223154;
                    }
                    
                    int64_t binop_p_223155 = sub64(defunc_0_f_res_223148,
                                                   defunc_0_m_fun_res_223135);
                    double defunc_0_f_res_223156 =
                           sitofp_i64_f64(binop_p_223155);
                    double abs_res_223157 = fabs(defunc_0_f_res_223156);
                    double tmp1_223158 = abs_res_223157 / x_223101;
                    double x_223159 = tmp1_223158 * tmp1_223158;
                    double y_223160 = tmp1_223158 * x_223159;
                    double tmp2_223161 = 1.0 - y_223160;
                    double x_223162 = tmp2_223161 * tmp2_223161;
                    double tmp3_223163 = tmp2_223161 * x_223162;
                    double tmp4_223164 = defunc_0_f_res_223152 * tmp3_223163;
                    double defunc_0_f_res_223165;
                    
                    if (cond_223147) {
                        defunc_0_f_res_223165 = 0.0;
                    } else {
                        int64_t i_223166 = add64(x_223100, i_223145);
                        double defunc_0_add_arg_223167;
                        
                        defunc_0_add_arg_223167 =
                            ((double *) mem_218170.mem)[gtid_207888 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_223094 *
                                                        defunc_0_f_res_203721 +
                                                        i_223166];
                        defunc_0_f_res_223165 = defunc_0_add_arg_223167;
                    }
                    
                    double x_223168 = a0_223134 * tmp4_223164;
                    double defunc_9_fit_fun_res_223169 = defunc_0_f_res_223165 *
                           x_223168;
                    double defunc_1_op_res_223170 =
                           defunc_9_fit_fun_res_223169 + redout_223146;
                    double redout_tmp_223177 = defunc_1_op_res_223170;
                    
                    redout_223146 = redout_tmp_223177;
                }
                defunc_2_reduce_res_223144 = redout_223146;
                ((double *) mem_218206)[i_223094 * s_n_m_203726 + i_223098] =
                    defunc_2_reduce_res_223144;
            }
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218251.mem + gtid_207888 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218206 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218206);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235841_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235841_end -
                 futhark_mc_segmap_parloop_235841_start;
        
        ctx->futhark_mc_segmap_parloop_235841_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235841_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235841_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235839(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_207887 = tid;
    int num_tasks_223092 = info.nsubtasks;
    struct futhark_mc_task_235838 *futhark_mc_task_235838 =
                                  (struct futhark_mc_task_235838 *) args;
    struct futhark_context *ctx = futhark_mc_task_235838->ctx;
    uint64_t futhark_mc_segmap_task_235839_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235839_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235838->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235838->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235838->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235838->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235838->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235838->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235838->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235838->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235838->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235838->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235838->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235838->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235838->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235838->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235838->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218251 = {.desc ="mem_218251", .mem =
                                  futhark_mc_task_235838->free_mem_218251,
                                  .size =0, .references =NULL};
    int64_t iter_223093;
    struct futhark_mc_segmap_parloop_struct_235840
    futhark_mc_segmap_parloop_struct_235840;
    
    futhark_mc_segmap_parloop_struct_235840.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235840.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235840.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235840.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235840.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235840.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235840.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235840.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235840.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235840.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235840.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235840.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235840.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235840.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235840.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235840.free_mem_218251 = mem_218251.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235841_task;
    
    futhark_mc_segmap_parloop_235841_task.name =
        "futhark_mc_segmap_parloop_235841";
    futhark_mc_segmap_parloop_235841_task.fn = futhark_mc_segmap_parloop_235841;
    futhark_mc_segmap_parloop_235841_task.args =
        &futhark_mc_segmap_parloop_struct_235840;
    futhark_mc_segmap_parloop_235841_task.iterations = iterations;
    futhark_mc_segmap_parloop_235841_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235841_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235841_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235841_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235841_task);
    
    if (futhark_mc_segmap_parloop_235841_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235841_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235841_total_end -
                 futhark_mc_segmap_parloop_235841_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235841_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235841_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235841_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235839_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235839_end -
                 futhark_mc_segmap_task_235839_start;
        
        ctx->futhark_mc_segmap_task_235839_runs[tid]++;
        ctx->futhark_mc_segmap_task_235839_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235839_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235844 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218251;
};
struct futhark_mc_task_235847 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218202;
};
struct futhark_mc_segmap_parloop_struct_235849 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218202;
};
static int futhark_mc_segmap_parloop_235850(void *args, int64_t start,
                                            int64_t end, int flat_tid_223334,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235849
    *futhark_mc_segmap_parloop_struct_235849 =
    (struct futhark_mc_segmap_parloop_struct_235849 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235849->ctx;
    uint64_t futhark_mc_segmap_parloop_235850_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235850_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235849->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235849->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235849->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235849->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235849->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235849->free_s_n_m_203726;
    int64_t gtid_208149 =
            futhark_mc_segmap_parloop_struct_235849->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235849->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235849->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235849->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235849->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235849->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235849->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235849->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218202 = {.desc ="mem_218202", .mem =
                                  futhark_mc_segmap_parloop_struct_235849->free_mem_218202,
                                  .size =0, .references =NULL};
    size_t mem_223337_cached_sizze_235851 = 0;
    unsigned char *mem_223337 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223417 = start;
    
    if (mem_223337_cached_sizze_235851 < (size_t) bytes_217663) {
        mem_223337 = realloc(mem_223337, bytes_217663);
        mem_223337_cached_sizze_235851 = bytes_217663;
    }
    for (; iter_223417 < end; iter_223417++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223492 = n_p_203574;
        int64_t gtid_223335 = iter_223417;
        int64_t remnant_223493 = iter_223417 - gtid_223335;
        int64_t x_223336;
        
        x_223336 = ((int64_t *) mem_217658.mem)[gtid_208149 * n_p_203574 +
                                                gtid_223335];
        for (int64_t i_223418 = 0; i_223418 < s_n_m_203726; i_223418++) {
            int64_t x_223420;
            
            x_223420 = ((int64_t *) mem_217828.mem)[gtid_208149 *
                                                    (s_n_m_203726 *
                                                     n_p_203574) + gtid_223335 *
                                                    s_n_m_203726 + i_223418];
            
            double x_223421;
            
            x_223421 = ((double *) mem_217833.mem)[gtid_208149 * (s_n_m_203726 *
                                                                  n_p_203574) +
                                                   gtid_223335 * s_n_m_203726 +
                                                   i_223418];
            
            bool cond_223422 = i_223418 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_223423;
            
            if (cond_223422) {
                defunc_0_m_fun_res_223423 = (int64_t) 0;
            } else {
                int64_t y_223424 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_223425 = i_223418 == y_223424;
                int64_t defunc_0_m_fun_res_f_res_223426;
                
                if (cond_223425) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_223427 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_223426 =
                        defunc_0_m_fun_res_f_res_t_res_223427;
                } else {
                    int64_t x_223428 = sub64(i_223418, (int64_t) 1);
                    int64_t x_223429 = mul64(jump_s_203581, x_223428);
                    int64_t min_arg_223430 = add64((int64_t) 1, x_223429);
                    int64_t min_res_223431 = smin64(defunc_0_f_res_203721,
                                                    min_arg_223430);
                    
                    defunc_0_m_fun_res_f_res_223426 = min_res_223431;
                }
                defunc_0_m_fun_res_223423 = defunc_0_m_fun_res_f_res_223426;
            }
            
            double defunc_2_reduce_res_223432;
            double redout_223434 = 0.0;
            
            for (int64_t i_223433 = 0; i_223433 < q_s_203575; i_223433++) {
                bool cond_223435 = sle64(x_223336, i_223433);
                int64_t defunc_0_f_res_223436;
                
                if (cond_223435) {
                    defunc_0_f_res_223436 = (int64_t) 0;
                } else {
                    int64_t i_223437 = add64(x_223420, i_223433);
                    int64_t defunc_0_add_arg_223438;
                    
                    defunc_0_add_arg_223438 =
                        ((int64_t *) mem_217654.mem)[gtid_208149 *
                                                     (defunc_0_f_res_203721 *
                                                      n_p_203574) +
                                                     gtid_223335 *
                                                     defunc_0_f_res_203721 +
                                                     i_223437];
                    
                    int64_t defunc_1_add_res_223439 = add64((int64_t) 1,
                                                            defunc_0_add_arg_223438);
                    
                    defunc_0_f_res_223436 = defunc_1_add_res_223439;
                }
                
                double defunc_0_f_res_223440;
                
                if (cond_223435) {
                    defunc_0_f_res_223440 = 0.0;
                } else {
                    int64_t i_223441 = add64(x_223420, i_223433);
                    double defunc_0_add_arg_223442;
                    
                    defunc_0_add_arg_223442 =
                        ((double *) mem_218175.mem)[gtid_208149 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_223335 *
                                                    defunc_0_f_res_203721 +
                                                    i_223441];
                    defunc_0_f_res_223440 = defunc_0_add_arg_223442;
                }
                
                int64_t binop_p_223443 = sub64(defunc_0_f_res_223436,
                                               defunc_0_m_fun_res_223423);
                double defunc_0_f_res_223444 = sitofp_i64_f64(binop_p_223443);
                double abs_res_223445 = fabs(defunc_0_f_res_223444);
                double tmp1_223446 = abs_res_223445 / x_223421;
                double x_223447 = tmp1_223446 * tmp1_223446;
                double y_223448 = tmp1_223446 * x_223447;
                double tmp2_223449 = 1.0 - y_223448;
                double x_223450 = tmp2_223449 * tmp2_223449;
                double tmp3_223451 = tmp2_223449 * x_223450;
                double w_j_223452 = defunc_0_f_res_223440 * tmp3_223451;
                double defunc_1_op_res_223453 = w_j_223452 + redout_223434;
                double redout_tmp_223495 = defunc_1_op_res_223453;
                
                redout_223434 = redout_tmp_223495;
            }
            defunc_2_reduce_res_223432 = redout_223434;
            
            double a0_223454 = 1.0 / defunc_2_reduce_res_223432;
            int64_t defunc_0_m_fun_res_223455;
            
            if (cond_223422) {
                defunc_0_m_fun_res_223455 = (int64_t) 0;
            } else {
                int64_t y_223456 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_223457 = i_223418 == y_223456;
                int64_t defunc_0_m_fun_res_f_res_223458;
                
                if (cond_223457) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_223459 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_223458 =
                        defunc_0_m_fun_res_f_res_t_res_223459;
                } else {
                    int64_t x_223460 = sub64(i_223418, (int64_t) 1);
                    int64_t x_223461 = mul64(jump_s_203581, x_223460);
                    int64_t min_arg_223462 = add64((int64_t) 1, x_223461);
                    int64_t min_res_223463 = smin64(defunc_0_f_res_203721,
                                                    min_arg_223462);
                    
                    defunc_0_m_fun_res_f_res_223458 = min_res_223463;
                }
                defunc_0_m_fun_res_223455 = defunc_0_m_fun_res_f_res_223458;
            }
            
            double defunc_2_reduce_res_223464;
            double redout_223466 = 0.0;
            
            for (int64_t i_223465 = 0; i_223465 < q_s_203575; i_223465++) {
                bool cond_223467 = sle64(x_223336, i_223465);
                int64_t defunc_0_f_res_223468;
                
                if (cond_223467) {
                    defunc_0_f_res_223468 = (int64_t) 0;
                } else {
                    int64_t i_223469 = add64(x_223420, i_223465);
                    int64_t defunc_0_add_arg_223470;
                    
                    defunc_0_add_arg_223470 =
                        ((int64_t *) mem_217654.mem)[gtid_208149 *
                                                     (defunc_0_f_res_203721 *
                                                      n_p_203574) +
                                                     gtid_223335 *
                                                     defunc_0_f_res_203721 +
                                                     i_223469];
                    
                    int64_t defunc_1_add_res_223471 = add64((int64_t) 1,
                                                            defunc_0_add_arg_223470);
                    
                    defunc_0_f_res_223468 = defunc_1_add_res_223471;
                }
                
                double defunc_0_f_res_223472;
                
                if (cond_223467) {
                    defunc_0_f_res_223472 = 0.0;
                } else {
                    int64_t i_223473 = add64(x_223420, i_223465);
                    double defunc_0_add_arg_223474;
                    
                    defunc_0_add_arg_223474 =
                        ((double *) mem_218175.mem)[gtid_208149 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_223335 *
                                                    defunc_0_f_res_203721 +
                                                    i_223473];
                    defunc_0_f_res_223472 = defunc_0_add_arg_223474;
                }
                
                int64_t binop_p_223475 = sub64(defunc_0_f_res_223468,
                                               defunc_0_m_fun_res_223455);
                double defunc_0_f_res_223476 = sitofp_i64_f64(binop_p_223475);
                double abs_res_223477 = fabs(defunc_0_f_res_223476);
                double tmp1_223478 = abs_res_223477 / x_223421;
                double x_223479 = tmp1_223478 * tmp1_223478;
                double y_223480 = tmp1_223478 * x_223479;
                double tmp2_223481 = 1.0 - y_223480;
                double x_223482 = tmp2_223481 * tmp2_223481;
                double tmp3_223483 = tmp2_223481 * x_223482;
                double tmp4_223484 = defunc_0_f_res_223472 * tmp3_223483;
                double defunc_0_f_res_223485;
                
                if (cond_223467) {
                    defunc_0_f_res_223485 = 0.0;
                } else {
                    int64_t i_223486 = add64(x_223420, i_223465);
                    double defunc_0_add_arg_223487;
                    
                    defunc_0_add_arg_223487 =
                        ((double *) mem_218170.mem)[gtid_208149 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_223335 *
                                                    defunc_0_f_res_203721 +
                                                    i_223486];
                    defunc_0_f_res_223485 = defunc_0_add_arg_223487;
                }
                
                double x_223488 = a0_223454 * tmp4_223484;
                double defunc_9_fit_fun_res_223489 = defunc_0_f_res_223485 *
                       x_223488;
                double defunc_1_op_res_223490 = defunc_9_fit_fun_res_223489 +
                       redout_223466;
                double redout_tmp_223496 = defunc_1_op_res_223490;
                
                redout_223466 = redout_tmp_223496;
            }
            defunc_2_reduce_res_223464 = redout_223466;
            ((double *) mem_223337)[i_223418] = defunc_2_reduce_res_223464;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218202.mem + gtid_223335 * s_n_m_203726 * (int64_t) 8,
                    mem_223337 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_223337);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235850_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235850_end -
                 futhark_mc_segmap_parloop_235850_start;
        
        ctx->futhark_mc_segmap_parloop_235850_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235850_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235850_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235848(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223334 = tid;
    int num_tasks_223416 = info.nsubtasks;
    struct futhark_mc_task_235847 *futhark_mc_task_235847 =
                                  (struct futhark_mc_task_235847 *) args;
    struct futhark_context *ctx = futhark_mc_task_235847->ctx;
    uint64_t futhark_mc_segmap_task_235848_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235848_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235847->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235847->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235847->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235847->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235847->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235847->free_s_n_m_203726;
    int64_t gtid_208149 = futhark_mc_task_235847->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235847->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235847->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235847->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235847->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235847->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235847->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235847->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218202 = {.desc ="mem_218202", .mem =
                                  futhark_mc_task_235847->free_mem_218202,
                                  .size =0, .references =NULL};
    int64_t iter_223417;
    struct futhark_mc_segmap_parloop_struct_235849
    futhark_mc_segmap_parloop_struct_235849;
    
    futhark_mc_segmap_parloop_struct_235849.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235849.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235849.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235849.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235849.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235849.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235849.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235849.free_gtid_208149 = gtid_208149;
    futhark_mc_segmap_parloop_struct_235849.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235849.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235849.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235849.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235849.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235849.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235849.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235849.free_mem_218202 = mem_218202.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235850_task;
    
    futhark_mc_segmap_parloop_235850_task.name =
        "futhark_mc_segmap_parloop_235850";
    futhark_mc_segmap_parloop_235850_task.fn = futhark_mc_segmap_parloop_235850;
    futhark_mc_segmap_parloop_235850_task.args =
        &futhark_mc_segmap_parloop_struct_235849;
    futhark_mc_segmap_parloop_235850_task.iterations = iterations;
    futhark_mc_segmap_parloop_235850_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235850_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235850_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235850_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235850_task);
    
    if (futhark_mc_segmap_parloop_235850_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235850_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235850_total_end -
                 futhark_mc_segmap_parloop_235850_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235850_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235850_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235850_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235848_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235848_end -
                 futhark_mc_segmap_task_235848_start;
        
        ctx->futhark_mc_segmap_task_235848_runs[tid]++;
        ctx->futhark_mc_segmap_task_235848_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235848_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235853 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218202;
};
struct futhark_mc_task_235856 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223180;
    int64_t free_x_223181;
    unsigned char *free_mem_223182;
};
struct futhark_mc_segmap_parloop_struct_235858 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223180;
    int64_t free_x_223181;
    unsigned char *free_mem_223182;
};
static int futhark_mc_segmap_parloop_235859(void *args, int64_t start,
                                            int64_t end, int flat_tid_223575,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235858
    *futhark_mc_segmap_parloop_struct_235858 =
    (struct futhark_mc_segmap_parloop_struct_235858 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235858->ctx;
    uint64_t futhark_mc_segmap_parloop_235859_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235859_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235858->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235858->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235858->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235858->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235858->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235858->free_s_n_m_203726;
    int64_t gtid_208149 =
            futhark_mc_segmap_parloop_struct_235858->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235858->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235858->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235858->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235858->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235858->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223180 =
            futhark_mc_segmap_parloop_struct_235858->free_gtid_223180;
    int64_t x_223181 = futhark_mc_segmap_parloop_struct_235858->free_x_223181;
    struct memblock mem_223182 = {.desc ="mem_223182", .mem =
                                  futhark_mc_segmap_parloop_struct_235858->free_mem_223182,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_223651 = start;
    
    for (; iter_223651 < end; iter_223651++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223715 = s_n_m_203726;
        int64_t gtid_223576 = iter_223651;
        int64_t remnant_223716 = iter_223651 - gtid_223576;
        int64_t x_223577;
        
        x_223577 = ((int64_t *) mem_217828.mem)[gtid_208149 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_223180 * s_n_m_203726 +
                                                gtid_223576];
        
        double x_223578;
        
        x_223578 = ((double *) mem_217833.mem)[gtid_208149 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_223180 * s_n_m_203726 +
                                               gtid_223576];
        
        bool cond_223579 = gtid_223576 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_223580;
        
        if (cond_223579) {
            defunc_0_m_fun_res_223580 = (int64_t) 0;
        } else {
            int64_t y_223652 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_223653 = gtid_223576 == y_223652;
            int64_t defunc_0_m_fun_res_f_res_223654;
            
            if (cond_223653) {
                int64_t defunc_0_m_fun_res_f_res_t_res_223655 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_223654 =
                    defunc_0_m_fun_res_f_res_t_res_223655;
            } else {
                int64_t x_223656 = sub64(gtid_223576, (int64_t) 1);
                int64_t x_223657 = mul64(jump_s_203581, x_223656);
                int64_t min_arg_223658 = add64((int64_t) 1, x_223657);
                int64_t min_res_223659 = smin64(defunc_0_f_res_203721,
                                                min_arg_223658);
                
                defunc_0_m_fun_res_f_res_223654 = min_res_223659;
            }
            defunc_0_m_fun_res_223580 = defunc_0_m_fun_res_f_res_223654;
        }
        
        double defunc_2_reduce_res_223589;
        double redout_223661 = 0.0;
        
        for (int64_t i_223660 = 0; i_223660 < q_s_203575; i_223660++) {
            bool cond_223662 = sle64(x_223181, i_223660);
            int64_t defunc_0_f_res_223663;
            
            if (cond_223662) {
                defunc_0_f_res_223663 = (int64_t) 0;
            } else {
                int64_t i_223664 = add64(x_223577, i_223660);
                int64_t defunc_0_add_arg_223665;
                
                defunc_0_add_arg_223665 =
                    ((int64_t *) mem_217654.mem)[gtid_208149 *
                                                 (defunc_0_f_res_203721 *
                                                  n_p_203574) + gtid_223180 *
                                                 defunc_0_f_res_203721 +
                                                 i_223664];
                
                int64_t defunc_1_add_res_223666 = add64((int64_t) 1,
                                                        defunc_0_add_arg_223665);
                
                defunc_0_f_res_223663 = defunc_1_add_res_223666;
            }
            
            double defunc_0_f_res_223667;
            
            if (cond_223662) {
                defunc_0_f_res_223667 = 0.0;
            } else {
                int64_t i_223668 = add64(x_223577, i_223660);
                double defunc_0_add_arg_223669;
                
                defunc_0_add_arg_223669 =
                    ((double *) mem_218175.mem)[gtid_208149 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_223180 *
                                                defunc_0_f_res_203721 +
                                                i_223668];
                defunc_0_f_res_223667 = defunc_0_add_arg_223669;
            }
            
            int64_t binop_p_223670 = sub64(defunc_0_f_res_223663,
                                           defunc_0_m_fun_res_223580);
            double defunc_0_f_res_223671 = sitofp_i64_f64(binop_p_223670);
            double abs_res_223672 = fabs(defunc_0_f_res_223671);
            double tmp1_223673 = abs_res_223672 / x_223578;
            double x_223674 = tmp1_223673 * tmp1_223673;
            double y_223675 = tmp1_223673 * x_223674;
            double tmp2_223676 = 1.0 - y_223675;
            double x_223677 = tmp2_223676 * tmp2_223676;
            double tmp3_223678 = tmp2_223676 * x_223677;
            double w_j_223679 = defunc_0_f_res_223667 * tmp3_223678;
            double defunc_1_op_res_223680 = w_j_223679 + redout_223661;
            double redout_tmp_223717 = defunc_1_op_res_223680;
            
            redout_223661 = redout_tmp_223717;
        }
        defunc_2_reduce_res_223589 = redout_223661;
        
        double a0_223611 = 1.0 / defunc_2_reduce_res_223589;
        int64_t defunc_0_m_fun_res_223612;
        
        if (cond_223579) {
            defunc_0_m_fun_res_223612 = (int64_t) 0;
        } else {
            int64_t y_223681 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_223682 = gtid_223576 == y_223681;
            int64_t defunc_0_m_fun_res_f_res_223683;
            
            if (cond_223682) {
                int64_t defunc_0_m_fun_res_f_res_t_res_223684 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_223683 =
                    defunc_0_m_fun_res_f_res_t_res_223684;
            } else {
                int64_t x_223685 = sub64(gtid_223576, (int64_t) 1);
                int64_t x_223686 = mul64(jump_s_203581, x_223685);
                int64_t min_arg_223687 = add64((int64_t) 1, x_223686);
                int64_t min_res_223688 = smin64(defunc_0_f_res_203721,
                                                min_arg_223687);
                
                defunc_0_m_fun_res_f_res_223683 = min_res_223688;
            }
            defunc_0_m_fun_res_223612 = defunc_0_m_fun_res_f_res_223683;
        }
        
        double defunc_2_reduce_res_223621;
        double redout_223690 = 0.0;
        
        for (int64_t i_223689 = 0; i_223689 < q_s_203575; i_223689++) {
            bool cond_223691 = sle64(x_223181, i_223689);
            int64_t defunc_0_f_res_223692;
            
            if (cond_223691) {
                defunc_0_f_res_223692 = (int64_t) 0;
            } else {
                int64_t i_223693 = add64(x_223577, i_223689);
                int64_t defunc_0_add_arg_223694;
                
                defunc_0_add_arg_223694 =
                    ((int64_t *) mem_217654.mem)[gtid_208149 *
                                                 (defunc_0_f_res_203721 *
                                                  n_p_203574) + gtid_223180 *
                                                 defunc_0_f_res_203721 +
                                                 i_223693];
                
                int64_t defunc_1_add_res_223695 = add64((int64_t) 1,
                                                        defunc_0_add_arg_223694);
                
                defunc_0_f_res_223692 = defunc_1_add_res_223695;
            }
            
            double defunc_0_f_res_223696;
            
            if (cond_223691) {
                defunc_0_f_res_223696 = 0.0;
            } else {
                int64_t i_223697 = add64(x_223577, i_223689);
                double defunc_0_add_arg_223698;
                
                defunc_0_add_arg_223698 =
                    ((double *) mem_218175.mem)[gtid_208149 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_223180 *
                                                defunc_0_f_res_203721 +
                                                i_223697];
                defunc_0_f_res_223696 = defunc_0_add_arg_223698;
            }
            
            int64_t binop_p_223699 = sub64(defunc_0_f_res_223692,
                                           defunc_0_m_fun_res_223612);
            double defunc_0_f_res_223700 = sitofp_i64_f64(binop_p_223699);
            double abs_res_223701 = fabs(defunc_0_f_res_223700);
            double tmp1_223702 = abs_res_223701 / x_223578;
            double x_223703 = tmp1_223702 * tmp1_223702;
            double y_223704 = tmp1_223702 * x_223703;
            double tmp2_223705 = 1.0 - y_223704;
            double x_223706 = tmp2_223705 * tmp2_223705;
            double tmp3_223707 = tmp2_223705 * x_223706;
            double tmp4_223708 = defunc_0_f_res_223696 * tmp3_223707;
            double defunc_0_f_res_223709;
            
            if (cond_223691) {
                defunc_0_f_res_223709 = 0.0;
            } else {
                int64_t i_223710 = add64(x_223577, i_223689);
                double defunc_0_add_arg_223711;
                
                defunc_0_add_arg_223711 =
                    ((double *) mem_218170.mem)[gtid_208149 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_223180 *
                                                defunc_0_f_res_203721 +
                                                i_223710];
                defunc_0_f_res_223709 = defunc_0_add_arg_223711;
            }
            
            double x_223712 = a0_223611 * tmp4_223708;
            double defunc_9_fit_fun_res_223713 = defunc_0_f_res_223709 *
                   x_223712;
            double defunc_1_op_res_223714 = defunc_9_fit_fun_res_223713 +
                   redout_223690;
            double redout_tmp_223718 = defunc_1_op_res_223714;
            
            redout_223690 = redout_tmp_223718;
        }
        defunc_2_reduce_res_223621 = redout_223690;
        ((double *) mem_223182.mem)[gtid_223576] = defunc_2_reduce_res_223621;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235859_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235859_end -
                 futhark_mc_segmap_parloop_235859_start;
        
        ctx->futhark_mc_segmap_parloop_235859_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235859_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235859_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235857(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223575 = tid;
    int num_tasks_223650 = info.nsubtasks;
    struct futhark_mc_task_235856 *futhark_mc_task_235856 =
                                  (struct futhark_mc_task_235856 *) args;
    struct futhark_context *ctx = futhark_mc_task_235856->ctx;
    uint64_t futhark_mc_segmap_task_235857_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235857_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235856->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235856->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235856->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235856->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235856->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235856->free_s_n_m_203726;
    int64_t gtid_208149 = futhark_mc_task_235856->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235856->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235856->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235856->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235856->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235856->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223180 = futhark_mc_task_235856->free_gtid_223180;
    int64_t x_223181 = futhark_mc_task_235856->free_x_223181;
    struct memblock mem_223182 = {.desc ="mem_223182", .mem =
                                  futhark_mc_task_235856->free_mem_223182,
                                  .size =0, .references =NULL};
    int64_t iter_223651;
    struct futhark_mc_segmap_parloop_struct_235858
    futhark_mc_segmap_parloop_struct_235858;
    
    futhark_mc_segmap_parloop_struct_235858.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235858.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235858.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235858.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235858.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235858.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235858.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235858.free_gtid_208149 = gtid_208149;
    futhark_mc_segmap_parloop_struct_235858.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235858.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235858.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235858.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235858.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235858.free_gtid_223180 = gtid_223180;
    futhark_mc_segmap_parloop_struct_235858.free_x_223181 = x_223181;
    futhark_mc_segmap_parloop_struct_235858.free_mem_223182 = mem_223182.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235859_task;
    
    futhark_mc_segmap_parloop_235859_task.name =
        "futhark_mc_segmap_parloop_235859";
    futhark_mc_segmap_parloop_235859_task.fn = futhark_mc_segmap_parloop_235859;
    futhark_mc_segmap_parloop_235859_task.args =
        &futhark_mc_segmap_parloop_struct_235858;
    futhark_mc_segmap_parloop_235859_task.iterations = iterations;
    futhark_mc_segmap_parloop_235859_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235859_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235859_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235859_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235859_task);
    
    if (futhark_mc_segmap_parloop_235859_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235859_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235859_total_end -
                 futhark_mc_segmap_parloop_235859_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235859_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235859_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235859_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235857_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235857_end -
                 futhark_mc_segmap_task_235857_start;
        
        ctx->futhark_mc_segmap_task_235857_runs[tid]++;
        ctx->futhark_mc_segmap_task_235857_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235857_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235861 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223180;
    int64_t free_x_223181;
    unsigned char *free_mem_223182;
};
struct futhark_mc_task_235863 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223180;
    int64_t free_x_223181;
    int64_t free_x_223500;
    double free_x_223501;
    int64_t free_defunc_0_m_fun_res_223503;
    double *retval_defunc_2_reduce_res_223512;
};
struct futhark_mc_segred_stage_1_parloop_struct_235866 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223180;
    int64_t free_x_223181;
    int64_t free_x_223500;
    double free_x_223501;
    int64_t free_defunc_0_m_fun_res_223503;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_223790;
};
static int futhark_mc_segred_stage_1_parloop_235867(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_223728,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235866
    *futhark_mc_segred_stage_1_parloop_struct_235866 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235866 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235866->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235867_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235867_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235866->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_235866->free_defunc_0_f_res_203721;
    int64_t gtid_208149 =
            futhark_mc_segred_stage_1_parloop_struct_235866->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235866->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235866->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223180 =
            futhark_mc_segred_stage_1_parloop_struct_235866->free_gtid_223180;
    int64_t x_223181 =
            futhark_mc_segred_stage_1_parloop_struct_235866->free_x_223181;
    int64_t x_223500 =
            futhark_mc_segred_stage_1_parloop_struct_235866->free_x_223500;
    double x_223501 =
           futhark_mc_segred_stage_1_parloop_struct_235866->free_x_223501;
    int64_t defunc_0_m_fun_res_223503 =
            futhark_mc_segred_stage_1_parloop_struct_235866->free_defunc_0_m_fun_res_223503;
    struct memblock reduce_stage_1_tid_res_arr_mem_223790 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_223790",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235866->free_reduce_stage_1_tid_res_arr_mem_223790,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_223792 = start;
    double x_223730;
    double x_223731;
    double local_acc_223793 = 0.0;
    
    for (; iter_223792 < end; iter_223792++) {
        int64_t gtid_223729 = iter_223792;
        bool cond_223733 = sle64(x_223181, gtid_223729);
        int64_t defunc_0_f_res_223734;
        
        if (cond_223733) {
            defunc_0_f_res_223734 = (int64_t) 0;
        } else {
            int64_t i_223735 = add64(x_223500, gtid_223729);
            int64_t defunc_0_add_arg_223736;
            
            defunc_0_add_arg_223736 = ((int64_t *) mem_217654.mem)[gtid_208149 *
                                                                   (defunc_0_f_res_203721 *
                                                                    n_p_203574) +
                                                                   gtid_223180 *
                                                                   defunc_0_f_res_203721 +
                                                                   i_223735];
            
            int64_t defunc_1_add_res_223737 = add64((int64_t) 1,
                                                    defunc_0_add_arg_223736);
            
            defunc_0_f_res_223734 = defunc_1_add_res_223737;
        }
        
        double defunc_0_f_res_223738;
        
        if (cond_223733) {
            defunc_0_f_res_223738 = 0.0;
        } else {
            int64_t i_223739 = add64(x_223500, gtid_223729);
            double defunc_0_add_arg_223740;
            
            defunc_0_add_arg_223740 = ((double *) mem_218175.mem)[gtid_208149 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_223180 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_223739];
            defunc_0_f_res_223738 = defunc_0_add_arg_223740;
        }
        
        int64_t binop_p_223741 = sub64(defunc_0_f_res_223734,
                                       defunc_0_m_fun_res_223503);
        double defunc_0_f_res_223742 = sitofp_i64_f64(binop_p_223741);
        double abs_res_223743 = fabs(defunc_0_f_res_223742);
        double tmp1_223744 = abs_res_223743 / x_223501;
        double x_223745 = tmp1_223744 * tmp1_223744;
        double y_223746 = tmp1_223744 * x_223745;
        double tmp2_223747 = 1.0 - y_223746;
        double x_223748 = tmp2_223747 * tmp2_223747;
        double tmp3_223749 = tmp2_223747 * x_223748;
        double w_j_223750 = defunc_0_f_res_223738 * tmp3_223749;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_223730 = local_acc_223793;
        }
        // Load next params
        {
            x_223731 = w_j_223750;
        }
        // Red body
        {
            double defunc_1_op_res_223732 = x_223730 + x_223731;
            
            local_acc_223793 = defunc_1_op_res_223732;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_223790.mem)[flat_tid_223728] =
        local_acc_223793;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235867_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235867_end -
                 futhark_mc_segred_stage_1_parloop_235867_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235867_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235867_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235867_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235864(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223728 = tid;
    int num_tasks_223789 = info.nsubtasks;
    struct futhark_mc_task_235863 *futhark_mc_task_235863 =
                                  (struct futhark_mc_task_235863 *) args;
    struct futhark_context *ctx = futhark_mc_task_235863->ctx;
    uint64_t futhark_mc_segred_task_235864_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235864_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235863->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235863->free_defunc_0_f_res_203721;
    int64_t gtid_208149 = futhark_mc_task_235863->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235863->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235863->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223180 = futhark_mc_task_235863->free_gtid_223180;
    int64_t x_223181 = futhark_mc_task_235863->free_x_223181;
    int64_t x_223500 = futhark_mc_task_235863->free_x_223500;
    double x_223501 = futhark_mc_task_235863->free_x_223501;
    int64_t defunc_0_m_fun_res_223503 =
            futhark_mc_task_235863->free_defunc_0_m_fun_res_223503;
    double defunc_2_reduce_res_223512 =
           *futhark_mc_task_235863->retval_defunc_2_reduce_res_223512;
    size_t reduce_stage_1_tid_res_arr_mem_223790_cached_sizze_235865 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_223790 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_223790_cached_sizze_235865 <
        (size_t) ((int64_t) 8 * num_tasks_223789)) {
        reduce_stage_1_tid_res_arr_mem_223790 =
            realloc(reduce_stage_1_tid_res_arr_mem_223790, (int64_t) 8 *
                    num_tasks_223789);
        reduce_stage_1_tid_res_arr_mem_223790_cached_sizze_235865 =
            (int64_t) 8 * num_tasks_223789;
    }
    
    int64_t iter_223792;
    struct futhark_mc_segred_stage_1_parloop_struct_235866
    futhark_mc_segred_stage_1_parloop_struct_235866;
    
    futhark_mc_segred_stage_1_parloop_struct_235866.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_gtid_208149 =
        gtid_208149;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_mem_217654 =
        mem_217654.mem;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_mem_218175 =
        mem_218175.mem;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_gtid_223180 =
        gtid_223180;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_x_223181 = x_223181;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_x_223500 = x_223500;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_x_223501 = x_223501;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_defunc_0_m_fun_res_223503 =
        defunc_0_m_fun_res_223503;
    futhark_mc_segred_stage_1_parloop_struct_235866.free_reduce_stage_1_tid_res_arr_mem_223790 =
        reduce_stage_1_tid_res_arr_mem_223790;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235867_task;
    
    futhark_mc_segred_stage_1_parloop_235867_task.name =
        "futhark_mc_segred_stage_1_parloop_235867";
    futhark_mc_segred_stage_1_parloop_235867_task.fn =
        futhark_mc_segred_stage_1_parloop_235867;
    futhark_mc_segred_stage_1_parloop_235867_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235866;
    futhark_mc_segred_stage_1_parloop_235867_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235867_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235867_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235867_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235867_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235867_task);
    
    if (futhark_mc_segred_stage_1_parloop_235867_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235867_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235867_total_end -
                 futhark_mc_segred_stage_1_parloop_235867_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235867_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235867_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235867_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_223512 = 0.0;
    }
    
    double x_223794;
    double x_223795;
    
    for (int32_t i_223797 = 0; i_223797 < num_tasks_223789; i_223797++) {
        flat_tid_223728 = i_223797;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_223794 = defunc_2_reduce_res_223512;
            }
            // load next params
            {
                x_223795 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_223790)[flat_tid_223728];
            }
            // red body
            {
                double defunc_1_op_res_223796 = x_223794 + x_223795;
                
                defunc_2_reduce_res_223512 = defunc_1_op_res_223796;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_223790);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235864_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235864_end -
                 futhark_mc_segred_task_235864_start;
        
        ctx->futhark_mc_segred_task_235864_runs[tid]++;
        ctx->futhark_mc_segred_task_235864_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235864_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235863->retval_defunc_2_reduce_res_223512 =
            defunc_2_reduce_res_223512;
    }
    return err;
}
struct futhark_mc_task_235868 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223180;
    int64_t free_x_223181;
    int64_t free_x_223500;
    double free_x_223501;
    double free_a0_223536;
    int64_t free_defunc_0_m_fun_res_223537;
    double *retval_defunc_2_reduce_res_223546;
};
struct futhark_mc_segred_stage_1_parloop_struct_235871 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_208149;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223180;
    int64_t free_x_223181;
    int64_t free_x_223500;
    double free_x_223501;
    double free_a0_223536;
    int64_t free_defunc_0_m_fun_res_223537;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_223799;
};
static int futhark_mc_segred_stage_1_parloop_235872(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_223759,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235871
    *futhark_mc_segred_stage_1_parloop_struct_235871 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235871 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235871->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235872_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235872_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235871->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_235871->free_defunc_0_f_res_203721;
    int64_t gtid_208149 =
            futhark_mc_segred_stage_1_parloop_struct_235871->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235871->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235871->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235871->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223180 =
            futhark_mc_segred_stage_1_parloop_struct_235871->free_gtid_223180;
    int64_t x_223181 =
            futhark_mc_segred_stage_1_parloop_struct_235871->free_x_223181;
    int64_t x_223500 =
            futhark_mc_segred_stage_1_parloop_struct_235871->free_x_223500;
    double x_223501 =
           futhark_mc_segred_stage_1_parloop_struct_235871->free_x_223501;
    double a0_223536 =
           futhark_mc_segred_stage_1_parloop_struct_235871->free_a0_223536;
    int64_t defunc_0_m_fun_res_223537 =
            futhark_mc_segred_stage_1_parloop_struct_235871->free_defunc_0_m_fun_res_223537;
    struct memblock reduce_stage_1_tid_res_arr_mem_223799 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_223799",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235871->free_reduce_stage_1_tid_res_arr_mem_223799,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_223801 = start;
    double x_223761;
    double x_223762;
    double local_acc_223802 = 0.0;
    
    for (; iter_223801 < end; iter_223801++) {
        int64_t gtid_223760 = iter_223801;
        bool cond_223764 = sle64(x_223181, gtid_223760);
        int64_t defunc_0_f_res_223765;
        
        if (cond_223764) {
            defunc_0_f_res_223765 = (int64_t) 0;
        } else {
            int64_t i_223766 = add64(x_223500, gtid_223760);
            int64_t defunc_0_add_arg_223767;
            
            defunc_0_add_arg_223767 = ((int64_t *) mem_217654.mem)[gtid_208149 *
                                                                   (defunc_0_f_res_203721 *
                                                                    n_p_203574) +
                                                                   gtid_223180 *
                                                                   defunc_0_f_res_203721 +
                                                                   i_223766];
            
            int64_t defunc_1_add_res_223768 = add64((int64_t) 1,
                                                    defunc_0_add_arg_223767);
            
            defunc_0_f_res_223765 = defunc_1_add_res_223768;
        }
        
        double defunc_0_f_res_223769;
        
        if (cond_223764) {
            defunc_0_f_res_223769 = 0.0;
        } else {
            int64_t i_223770 = add64(x_223500, gtid_223760);
            double defunc_0_add_arg_223771;
            
            defunc_0_add_arg_223771 = ((double *) mem_218175.mem)[gtid_208149 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_223180 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_223770];
            defunc_0_f_res_223769 = defunc_0_add_arg_223771;
        }
        
        int64_t binop_p_223772 = sub64(defunc_0_f_res_223765,
                                       defunc_0_m_fun_res_223537);
        double defunc_0_f_res_223773 = sitofp_i64_f64(binop_p_223772);
        double abs_res_223774 = fabs(defunc_0_f_res_223773);
        double tmp1_223775 = abs_res_223774 / x_223501;
        double x_223776 = tmp1_223775 * tmp1_223775;
        double y_223777 = tmp1_223775 * x_223776;
        double tmp2_223778 = 1.0 - y_223777;
        double x_223779 = tmp2_223778 * tmp2_223778;
        double tmp3_223780 = tmp2_223778 * x_223779;
        double tmp4_223781 = defunc_0_f_res_223769 * tmp3_223780;
        double defunc_0_f_res_223782;
        
        if (cond_223764) {
            defunc_0_f_res_223782 = 0.0;
        } else {
            int64_t i_223783 = add64(x_223500, gtid_223760);
            double defunc_0_add_arg_223784;
            
            defunc_0_add_arg_223784 = ((double *) mem_218170.mem)[gtid_208149 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_223180 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_223783];
            defunc_0_f_res_223782 = defunc_0_add_arg_223784;
        }
        
        double x_223785 = a0_223536 * tmp4_223781;
        double defunc_9_fit_fun_res_223786 = defunc_0_f_res_223782 * x_223785;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_223761 = local_acc_223802;
        }
        // Load next params
        {
            x_223762 = defunc_9_fit_fun_res_223786;
        }
        // Red body
        {
            double defunc_1_op_res_223763 = x_223761 + x_223762;
            
            local_acc_223802 = defunc_1_op_res_223763;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_223799.mem)[flat_tid_223759] =
        local_acc_223802;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235872_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235872_end -
                 futhark_mc_segred_stage_1_parloop_235872_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235872_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235872_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235872_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235869(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223759 = tid;
    int num_tasks_223798 = info.nsubtasks;
    struct futhark_mc_task_235868 *futhark_mc_task_235868 =
                                  (struct futhark_mc_task_235868 *) args;
    struct futhark_context *ctx = futhark_mc_task_235868->ctx;
    uint64_t futhark_mc_segred_task_235869_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235869_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235868->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235868->free_defunc_0_f_res_203721;
    int64_t gtid_208149 = futhark_mc_task_235868->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235868->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235868->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235868->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223180 = futhark_mc_task_235868->free_gtid_223180;
    int64_t x_223181 = futhark_mc_task_235868->free_x_223181;
    int64_t x_223500 = futhark_mc_task_235868->free_x_223500;
    double x_223501 = futhark_mc_task_235868->free_x_223501;
    double a0_223536 = futhark_mc_task_235868->free_a0_223536;
    int64_t defunc_0_m_fun_res_223537 =
            futhark_mc_task_235868->free_defunc_0_m_fun_res_223537;
    double defunc_2_reduce_res_223546 =
           *futhark_mc_task_235868->retval_defunc_2_reduce_res_223546;
    size_t reduce_stage_1_tid_res_arr_mem_223799_cached_sizze_235870 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_223799 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_223799_cached_sizze_235870 <
        (size_t) ((int64_t) 8 * num_tasks_223798)) {
        reduce_stage_1_tid_res_arr_mem_223799 =
            realloc(reduce_stage_1_tid_res_arr_mem_223799, (int64_t) 8 *
                    num_tasks_223798);
        reduce_stage_1_tid_res_arr_mem_223799_cached_sizze_235870 =
            (int64_t) 8 * num_tasks_223798;
    }
    
    int64_t iter_223801;
    struct futhark_mc_segred_stage_1_parloop_struct_235871
    futhark_mc_segred_stage_1_parloop_struct_235871;
    
    futhark_mc_segred_stage_1_parloop_struct_235871.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_gtid_208149 =
        gtid_208149;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_mem_217654 =
        mem_217654.mem;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_mem_218170 =
        mem_218170.mem;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_mem_218175 =
        mem_218175.mem;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_gtid_223180 =
        gtid_223180;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_x_223181 = x_223181;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_x_223500 = x_223500;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_x_223501 = x_223501;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_a0_223536 = a0_223536;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_defunc_0_m_fun_res_223537 =
        defunc_0_m_fun_res_223537;
    futhark_mc_segred_stage_1_parloop_struct_235871.free_reduce_stage_1_tid_res_arr_mem_223799 =
        reduce_stage_1_tid_res_arr_mem_223799;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235872_task;
    
    futhark_mc_segred_stage_1_parloop_235872_task.name =
        "futhark_mc_segred_stage_1_parloop_235872";
    futhark_mc_segred_stage_1_parloop_235872_task.fn =
        futhark_mc_segred_stage_1_parloop_235872;
    futhark_mc_segred_stage_1_parloop_235872_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235871;
    futhark_mc_segred_stage_1_parloop_235872_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235872_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235872_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235872_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235872_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235872_task);
    
    if (futhark_mc_segred_stage_1_parloop_235872_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235872_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235872_total_end -
                 futhark_mc_segred_stage_1_parloop_235872_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235872_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235872_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235872_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_223546 = 0.0;
    }
    
    double x_223803;
    double x_223804;
    
    for (int32_t i_223806 = 0; i_223806 < num_tasks_223798; i_223806++) {
        flat_tid_223759 = i_223806;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_223803 = defunc_2_reduce_res_223546;
            }
            // load next params
            {
                x_223804 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_223799)[flat_tid_223759];
            }
            // red body
            {
                double defunc_1_op_res_223805 = x_223803 + x_223804;
                
                defunc_2_reduce_res_223546 = defunc_1_op_res_223805;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_223799);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235869_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235869_end -
                 futhark_mc_segred_task_235869_start;
        
        ctx->futhark_mc_segred_task_235869_runs[tid]++;
        ctx->futhark_mc_segred_task_235869_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235869_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235868->retval_defunc_2_reduce_res_223546 =
            defunc_2_reduce_res_223546;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235862(void *args, int64_t start,
                                            int64_t end, int flat_tid_223498,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235861
    *futhark_mc_segmap_parloop_struct_235861 =
    (struct futhark_mc_segmap_parloop_struct_235861 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235861->ctx;
    uint64_t futhark_mc_segmap_parloop_235862_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235862_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235861->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235861->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235861->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235861->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235861->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235861->free_s_n_m_203726;
    int64_t gtid_208149 =
            futhark_mc_segmap_parloop_struct_235861->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235861->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235861->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235861->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235861->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235861->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223180 =
            futhark_mc_segmap_parloop_struct_235861->free_gtid_223180;
    int64_t x_223181 = futhark_mc_segmap_parloop_struct_235861->free_x_223181;
    struct memblock mem_223182 = {.desc ="mem_223182", .mem =
                                  futhark_mc_segmap_parloop_struct_235861->free_mem_223182,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_223719 = start;
    
    for (; iter_223719 < end; iter_223719++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223787 = s_n_m_203726;
        int64_t gtid_223499 = iter_223719;
        int64_t remnant_223788 = iter_223719 - gtid_223499;
        int64_t x_223500;
        
        x_223500 = ((int64_t *) mem_217828.mem)[gtid_208149 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_223180 * s_n_m_203726 +
                                                gtid_223499];
        
        double x_223501;
        
        x_223501 = ((double *) mem_217833.mem)[gtid_208149 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_223180 * s_n_m_203726 +
                                               gtid_223499];
        
        bool cond_223502 = gtid_223499 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_223503;
        
        if (cond_223502) {
            defunc_0_m_fun_res_223503 = (int64_t) 0;
        } else {
            int64_t y_223720 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_223721 = gtid_223499 == y_223720;
            int64_t defunc_0_m_fun_res_f_res_223722;
            
            if (cond_223721) {
                int64_t defunc_0_m_fun_res_f_res_t_res_223723 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_223722 =
                    defunc_0_m_fun_res_f_res_t_res_223723;
            } else {
                int64_t x_223724 = sub64(gtid_223499, (int64_t) 1);
                int64_t x_223725 = mul64(jump_s_203581, x_223724);
                int64_t min_arg_223726 = add64((int64_t) 1, x_223725);
                int64_t min_res_223727 = smin64(defunc_0_f_res_203721,
                                                min_arg_223726);
                
                defunc_0_m_fun_res_f_res_223722 = min_res_223727;
            }
            defunc_0_m_fun_res_223503 = defunc_0_m_fun_res_f_res_223722;
        }
        
        double defunc_2_reduce_res_223512;
        int64_t flat_tid_223728 = (int64_t) 0;
        int32_t num_tasks_223789;
        
        defunc_2_reduce_res_223512 = 0.0;
        
        struct futhark_mc_task_235863 futhark_mc_task_235863;
        
        futhark_mc_task_235863.ctx = ctx;
        futhark_mc_task_235863.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235863.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235863.free_gtid_208149 = gtid_208149;
        futhark_mc_task_235863.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235863.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235863.free_gtid_223180 = gtid_223180;
        futhark_mc_task_235863.free_x_223181 = x_223181;
        futhark_mc_task_235863.free_x_223500 = x_223500;
        futhark_mc_task_235863.free_x_223501 = x_223501;
        futhark_mc_task_235863.free_defunc_0_m_fun_res_223503 =
            defunc_0_m_fun_res_223503;
        futhark_mc_task_235863.retval_defunc_2_reduce_res_223512 =
            &defunc_2_reduce_res_223512;
        
        struct scheduler_segop futhark_mc_task_235863_task;
        
        futhark_mc_task_235863_task.args = &futhark_mc_task_235863;
        futhark_mc_task_235863_task.top_level_fn =
            futhark_mc_segred_task_235864;
        futhark_mc_task_235863_task.name = "futhark_mc_segred_task_235864";
        futhark_mc_task_235863_task.iterations = q_s_203575;
        futhark_mc_task_235863_task.task_time =
            &ctx->futhark_mc_segred_task_235864_total_time;
        futhark_mc_task_235863_task.task_iter =
            &ctx->futhark_mc_segred_task_235864_total_iter;
        futhark_mc_task_235863_task.sched = STATIC;
        futhark_mc_task_235863_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235864_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235863_task);
        
        if (futhark_mc_segred_task_235864_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_223536 = 1.0 / defunc_2_reduce_res_223512;
        int64_t defunc_0_m_fun_res_223537;
        
        if (cond_223502) {
            defunc_0_m_fun_res_223537 = (int64_t) 0;
        } else {
            int64_t y_223751 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_223752 = gtid_223499 == y_223751;
            int64_t defunc_0_m_fun_res_f_res_223753;
            
            if (cond_223752) {
                int64_t defunc_0_m_fun_res_f_res_t_res_223754 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_223753 =
                    defunc_0_m_fun_res_f_res_t_res_223754;
            } else {
                int64_t x_223755 = sub64(gtid_223499, (int64_t) 1);
                int64_t x_223756 = mul64(jump_s_203581, x_223755);
                int64_t min_arg_223757 = add64((int64_t) 1, x_223756);
                int64_t min_res_223758 = smin64(defunc_0_f_res_203721,
                                                min_arg_223757);
                
                defunc_0_m_fun_res_f_res_223753 = min_res_223758;
            }
            defunc_0_m_fun_res_223537 = defunc_0_m_fun_res_f_res_223753;
        }
        
        double defunc_2_reduce_res_223546;
        int64_t flat_tid_223759 = (int64_t) 0;
        int32_t num_tasks_223798;
        
        defunc_2_reduce_res_223546 = 0.0;
        
        struct futhark_mc_task_235868 futhark_mc_task_235868;
        
        futhark_mc_task_235868.ctx = ctx;
        futhark_mc_task_235868.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235868.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235868.free_gtid_208149 = gtid_208149;
        futhark_mc_task_235868.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235868.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235868.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235868.free_gtid_223180 = gtid_223180;
        futhark_mc_task_235868.free_x_223181 = x_223181;
        futhark_mc_task_235868.free_x_223500 = x_223500;
        futhark_mc_task_235868.free_x_223501 = x_223501;
        futhark_mc_task_235868.free_a0_223536 = a0_223536;
        futhark_mc_task_235868.free_defunc_0_m_fun_res_223537 =
            defunc_0_m_fun_res_223537;
        futhark_mc_task_235868.retval_defunc_2_reduce_res_223546 =
            &defunc_2_reduce_res_223546;
        
        struct scheduler_segop futhark_mc_task_235868_task;
        
        futhark_mc_task_235868_task.args = &futhark_mc_task_235868;
        futhark_mc_task_235868_task.top_level_fn =
            futhark_mc_segred_task_235869;
        futhark_mc_task_235868_task.name = "futhark_mc_segred_task_235869";
        futhark_mc_task_235868_task.iterations = q_s_203575;
        futhark_mc_task_235868_task.task_time =
            &ctx->futhark_mc_segred_task_235869_total_time;
        futhark_mc_task_235868_task.task_iter =
            &ctx->futhark_mc_segred_task_235869_total_iter;
        futhark_mc_task_235868_task.sched = STATIC;
        futhark_mc_task_235868_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235869_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235868_task);
        
        if (futhark_mc_segred_task_235869_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_223182.mem)[gtid_223499] = defunc_2_reduce_res_223546;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235862_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235862_end -
                 futhark_mc_segmap_parloop_235862_start;
        
        ctx->futhark_mc_segmap_parloop_235862_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235862_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235862_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235860(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223498 = tid;
    int num_tasks_223650 = info.nsubtasks;
    struct futhark_mc_task_235856 *futhark_mc_task_235856 =
                                  (struct futhark_mc_task_235856 *) args;
    struct futhark_context *ctx = futhark_mc_task_235856->ctx;
    uint64_t futhark_mc_segmap_nested_task_235860_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235860_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235856->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235856->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235856->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235856->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235856->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235856->free_s_n_m_203726;
    int64_t gtid_208149 = futhark_mc_task_235856->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235856->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235856->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235856->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235856->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235856->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223180 = futhark_mc_task_235856->free_gtid_223180;
    int64_t x_223181 = futhark_mc_task_235856->free_x_223181;
    struct memblock mem_223182 = {.desc ="mem_223182", .mem =
                                  futhark_mc_task_235856->free_mem_223182,
                                  .size =0, .references =NULL};
    int64_t iter_223719;
    struct futhark_mc_segmap_parloop_struct_235861
    futhark_mc_segmap_parloop_struct_235861;
    
    futhark_mc_segmap_parloop_struct_235861.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235861.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235861.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235861.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235861.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235861.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235861.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235861.free_gtid_208149 = gtid_208149;
    futhark_mc_segmap_parloop_struct_235861.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235861.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235861.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235861.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235861.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235861.free_gtid_223180 = gtid_223180;
    futhark_mc_segmap_parloop_struct_235861.free_x_223181 = x_223181;
    futhark_mc_segmap_parloop_struct_235861.free_mem_223182 = mem_223182.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235862_task;
    
    futhark_mc_segmap_parloop_235862_task.name =
        "futhark_mc_segmap_parloop_235862";
    futhark_mc_segmap_parloop_235862_task.fn = futhark_mc_segmap_parloop_235862;
    futhark_mc_segmap_parloop_235862_task.args =
        &futhark_mc_segmap_parloop_struct_235861;
    futhark_mc_segmap_parloop_235862_task.iterations = iterations;
    futhark_mc_segmap_parloop_235862_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235862_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235862_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235862_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235862_task);
    
    if (futhark_mc_segmap_parloop_235862_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235862_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235862_total_end -
                 futhark_mc_segmap_parloop_235862_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235862_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235862_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235862_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235860_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235860_end -
                 futhark_mc_segmap_nested_task_235860_start;
        
        ctx->futhark_mc_segmap_nested_task_235860_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235860_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235860_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235854(void *args, int64_t start,
                                            int64_t end, int flat_tid_223179,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235853
    *futhark_mc_segmap_parloop_struct_235853 =
    (struct futhark_mc_segmap_parloop_struct_235853 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235853->ctx;
    uint64_t futhark_mc_segmap_parloop_235854_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235854_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235853->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235853->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235853->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235853->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235853->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235853->free_s_n_m_203726;
    int64_t gtid_208149 =
            futhark_mc_segmap_parloop_struct_235853->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235853->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235853->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235853->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235853->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235853->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235853->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235853->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218202 = {.desc ="mem_218202", .mem =
                                  futhark_mc_segmap_parloop_struct_235853->free_mem_218202,
                                  .size =0, .references =NULL};
    size_t mem_223182_cached_sizze_235855 = 0;
    unsigned char *mem_223182 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223497 = start;
    
    if (mem_223182_cached_sizze_235855 < (size_t) bytes_217663) {
        mem_223182 = realloc(mem_223182, bytes_217663);
        mem_223182_cached_sizze_235855 = bytes_217663;
    }
    for (; iter_223497 < end; iter_223497++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223648 = n_p_203574;
        int64_t gtid_223180 = iter_223497;
        int64_t remnant_223649 = iter_223497 - gtid_223180;
        int64_t x_223181;
        
        x_223181 = ((int64_t *) mem_217658.mem)[gtid_208149 * n_p_203574 +
                                                gtid_223180];
        
        int64_t flat_tid_223575 = (int64_t) 0;
        int32_t num_tasks_223650;
        int64_t flat_tid_223498 = (int64_t) 0;
        struct futhark_mc_task_235856 futhark_mc_task_235856;
        
        futhark_mc_task_235856.ctx = ctx;
        futhark_mc_task_235856.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235856.free_q_s_203575 = q_s_203575;
        futhark_mc_task_235856.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235856.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235856.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235856.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235856.free_gtid_208149 = gtid_208149;
        futhark_mc_task_235856.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235856.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_235856.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_235856.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235856.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235856.free_gtid_223180 = gtid_223180;
        futhark_mc_task_235856.free_x_223181 = x_223181;
        futhark_mc_task_235856.free_mem_223182 = mem_223182;
        
        struct scheduler_segop futhark_mc_task_235856_task;
        
        futhark_mc_task_235856_task.args = &futhark_mc_task_235856;
        futhark_mc_task_235856_task.top_level_fn =
            futhark_mc_segmap_task_235857;
        futhark_mc_task_235856_task.name = "futhark_mc_segmap_task_235857";
        futhark_mc_task_235856_task.iterations = s_n_m_203726;
        futhark_mc_task_235856_task.task_time =
            &ctx->futhark_mc_segmap_task_235857_total_time;
        futhark_mc_task_235856_task.task_iter =
            &ctx->futhark_mc_segmap_task_235857_total_iter;
        futhark_mc_task_235856_task.sched = STATIC;
        futhark_mc_task_235856_task.nested_fn =
            futhark_mc_segmap_nested_task_235860;
        
        int futhark_mc_segmap_task_235857_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235856_task);
        
        if (futhark_mc_segmap_task_235857_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218202.mem + gtid_223180 * s_n_m_203726 * (int64_t) 8,
                    mem_223182 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_223182);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235854_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235854_end -
                 futhark_mc_segmap_parloop_235854_start;
        
        ctx->futhark_mc_segmap_parloop_235854_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235854_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235854_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235852(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223179 = tid;
    int num_tasks_223416 = info.nsubtasks;
    struct futhark_mc_task_235847 *futhark_mc_task_235847 =
                                  (struct futhark_mc_task_235847 *) args;
    struct futhark_context *ctx = futhark_mc_task_235847->ctx;
    uint64_t futhark_mc_segmap_nested_task_235852_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235852_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235847->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235847->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235847->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235847->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235847->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235847->free_s_n_m_203726;
    int64_t gtid_208149 = futhark_mc_task_235847->free_gtid_208149;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235847->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235847->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235847->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235847->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235847->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235847->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235847->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218202 = {.desc ="mem_218202", .mem =
                                  futhark_mc_task_235847->free_mem_218202,
                                  .size =0, .references =NULL};
    int64_t iter_223497;
    struct futhark_mc_segmap_parloop_struct_235853
    futhark_mc_segmap_parloop_struct_235853;
    
    futhark_mc_segmap_parloop_struct_235853.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235853.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235853.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235853.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235853.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235853.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235853.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235853.free_gtid_208149 = gtid_208149;
    futhark_mc_segmap_parloop_struct_235853.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235853.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235853.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235853.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235853.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235853.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235853.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235853.free_mem_218202 = mem_218202.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235854_task;
    
    futhark_mc_segmap_parloop_235854_task.name =
        "futhark_mc_segmap_parloop_235854";
    futhark_mc_segmap_parloop_235854_task.fn = futhark_mc_segmap_parloop_235854;
    futhark_mc_segmap_parloop_235854_task.args =
        &futhark_mc_segmap_parloop_struct_235853;
    futhark_mc_segmap_parloop_235854_task.iterations = iterations;
    futhark_mc_segmap_parloop_235854_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235854_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235854_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235854_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235854_task);
    
    if (futhark_mc_segmap_parloop_235854_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235854_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235854_total_end -
                 futhark_mc_segmap_parloop_235854_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235854_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235854_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235854_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235852_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235852_end -
                 futhark_mc_segmap_nested_task_235852_start;
        
        ctx->futhark_mc_segmap_nested_task_235852_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235852_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235852_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235845(void *args, int64_t start,
                                            int64_t end, int flat_tid_208148,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235844
    *futhark_mc_segmap_parloop_struct_235844 =
    (struct futhark_mc_segmap_parloop_struct_235844 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235844->ctx;
    uint64_t futhark_mc_segmap_parloop_235845_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235845_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235844->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235844->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235844->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235844->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235844->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235844->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235844->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235844->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235844->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235844->free_bytes_217663;
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235844->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235844->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235844->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235844->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235844->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218251 = {.desc ="mem_218251", .mem =
                                  futhark_mc_segmap_parloop_struct_235844->free_mem_218251,
                                  .size =0, .references =NULL};
    size_t mem_218202_cached_sizze_235846 = 0;
    unsigned char *mem_218202 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223178 = start;
    
    if (mem_218202_cached_sizze_235846 < (size_t) bytes_217715) {
        mem_218202 = realloc(mem_218202, bytes_217715);
        mem_218202_cached_sizze_235846 = bytes_217715;
    }
    for (; iter_223178 < end; iter_223178++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223414 = partition_sizze_203667;
        int64_t gtid_208149 = iter_223178;
        int64_t remnant_223415 = iter_223178 - gtid_208149;
        int64_t flat_tid_223334 = (int64_t) 0;
        int32_t num_tasks_223416;
        int64_t flat_tid_223179 = (int64_t) 0;
        struct futhark_mc_task_235847 futhark_mc_task_235847;
        
        futhark_mc_task_235847.ctx = ctx;
        futhark_mc_task_235847.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235847.free_q_s_203575 = q_s_203575;
        futhark_mc_task_235847.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235847.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235847.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235847.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235847.free_gtid_208149 = gtid_208149;
        futhark_mc_task_235847.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235847.free_mem_217658 = mem_217658.mem;
        futhark_mc_task_235847.free_bytes_217663 = bytes_217663;
        futhark_mc_task_235847.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_235847.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_235847.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235847.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235847.free_mem_218202 = mem_218202;
        
        struct scheduler_segop futhark_mc_task_235847_task;
        
        futhark_mc_task_235847_task.args = &futhark_mc_task_235847;
        futhark_mc_task_235847_task.top_level_fn =
            futhark_mc_segmap_task_235848;
        futhark_mc_task_235847_task.name = "futhark_mc_segmap_task_235848";
        futhark_mc_task_235847_task.iterations = n_p_203574;
        futhark_mc_task_235847_task.task_time =
            &ctx->futhark_mc_segmap_task_235848_total_time;
        futhark_mc_task_235847_task.task_iter =
            &ctx->futhark_mc_segmap_task_235848_total_iter;
        futhark_mc_task_235847_task.sched = STATIC;
        futhark_mc_task_235847_task.nested_fn =
            futhark_mc_segmap_nested_task_235852;
        
        int futhark_mc_segmap_task_235848_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235847_task);
        
        if (futhark_mc_segmap_task_235848_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218251.mem + gtid_208149 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218202 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218202);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235845_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235845_end -
                 futhark_mc_segmap_parloop_235845_start;
        
        ctx->futhark_mc_segmap_parloop_235845_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235845_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235845_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235843(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_208148 = tid;
    int num_tasks_223092 = info.nsubtasks;
    struct futhark_mc_task_235838 *futhark_mc_task_235838 =
                                  (struct futhark_mc_task_235838 *) args;
    struct futhark_context *ctx = futhark_mc_task_235838->ctx;
    uint64_t futhark_mc_segmap_nested_task_235843_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235843_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235838->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235838->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235838->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235838->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235838->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235838->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235838->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235838->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235838->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235838->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235838->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235838->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235838->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235838->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235838->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218251 = {.desc ="mem_218251", .mem =
                                  futhark_mc_task_235838->free_mem_218251,
                                  .size =0, .references =NULL};
    int64_t iter_223178;
    struct futhark_mc_segmap_parloop_struct_235844
    futhark_mc_segmap_parloop_struct_235844;
    
    futhark_mc_segmap_parloop_struct_235844.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235844.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235844.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235844.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235844.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235844.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235844.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235844.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235844.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235844.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235844.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235844.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235844.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235844.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235844.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235844.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235844.free_mem_218251 = mem_218251.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235845_task;
    
    futhark_mc_segmap_parloop_235845_task.name =
        "futhark_mc_segmap_parloop_235845";
    futhark_mc_segmap_parloop_235845_task.fn = futhark_mc_segmap_parloop_235845;
    futhark_mc_segmap_parloop_235845_task.args =
        &futhark_mc_segmap_parloop_struct_235844;
    futhark_mc_segmap_parloop_235845_task.iterations = iterations;
    futhark_mc_segmap_parloop_235845_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235845_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235845_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235845_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235845_task);
    
    if (futhark_mc_segmap_parloop_235845_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235845_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235845_total_end -
                 futhark_mc_segmap_parloop_235845_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235845_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235845_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235845_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235843_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235843_end -
                 futhark_mc_segmap_nested_task_235843_start;
        
        ctx->futhark_mc_segmap_nested_task_235843_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235843_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235843_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235873 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218388;
    unsigned char *free_mem_218393;
};
struct futhark_mc_segmap_parloop_struct_235875 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218388;
    unsigned char *free_mem_218393;
};
static int futhark_mc_segmap_parloop_235876(void *args, int64_t start,
                                            int64_t end, int flat_tid_208405,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235875
    *futhark_mc_segmap_parloop_struct_235875 =
    (struct futhark_mc_segmap_parloop_struct_235875 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235875->ctx;
    uint64_t futhark_mc_segmap_parloop_235876_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235876_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235875->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235875->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235875->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235875->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235875->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235875->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235875->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235875->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235875->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235875->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235875->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235875->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235875->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235875->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218388 = {.desc ="mem_218388", .mem =
                                  futhark_mc_segmap_parloop_struct_235875->free_mem_218388,
                                  .size =0, .references =NULL};
    struct memblock mem_218393 = {.desc ="mem_218393", .mem =
                                  futhark_mc_segmap_parloop_struct_235875->free_mem_218393,
                                  .size =0, .references =NULL};
    size_t mem_218299_cached_sizze_235877 = 0;
    unsigned char *mem_218299 = NULL;
    size_t mem_218303_cached_sizze_235878 = 0;
    unsigned char *mem_218303 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223808 = start;
    
    if (mem_218299_cached_sizze_235877 < (size_t) bytes_217715) {
        mem_218299 = realloc(mem_218299, bytes_217715);
        mem_218299_cached_sizze_235877 = bytes_217715;
    }
    if (mem_218303_cached_sizze_235878 < (size_t) bytes_217715) {
        mem_218303 = realloc(mem_218303, bytes_217715);
        mem_218303_cached_sizze_235878 = bytes_217715;
    }
    for (; iter_223808 < end; iter_223808++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_223916 = partition_sizze_203667;
        int64_t gtid_208406 = iter_223808;
        int64_t remnant_223917 = iter_223808 - gtid_208406;
        
        for (int64_t i_223809 = 0; i_223809 < n_p_203574; i_223809++) {
            int64_t x_223812;
            
            x_223812 = ((int64_t *) mem_217658.mem)[gtid_208406 * n_p_203574 +
                                                    i_223809];
            for (int64_t i_223815 = 0; i_223815 < s_n_m_203726; i_223815++) {
                int64_t x_223818;
                
                x_223818 = ((int64_t *) mem_217828.mem)[gtid_208406 *
                                                        (s_n_m_203726 *
                                                         n_p_203574) +
                                                        i_223809 *
                                                        s_n_m_203726 +
                                                        i_223815];
                
                double x_223819;
                
                x_223819 = ((double *) mem_217833.mem)[gtid_208406 *
                                                       (s_n_m_203726 *
                                                        n_p_203574) + i_223809 *
                                                       s_n_m_203726 + i_223815];
                
                bool cond_223820 = i_223815 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_223821;
                
                if (cond_223820) {
                    defunc_0_m_fun_res_223821 = (int64_t) 0;
                } else {
                    int64_t y_223822 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_223823 = i_223815 == y_223822;
                    int64_t defunc_0_m_fun_res_f_res_223824;
                    
                    if (cond_223823) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_223825 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_223824 =
                            defunc_0_m_fun_res_f_res_t_res_223825;
                    } else {
                        int64_t x_223826 = sub64(i_223815, (int64_t) 1);
                        int64_t x_223827 = mul64(jump_s_203581, x_223826);
                        int64_t min_arg_223828 = add64((int64_t) 1, x_223827);
                        int64_t min_res_223829 = smin64(defunc_0_f_res_203721,
                                                        min_arg_223828);
                        
                        defunc_0_m_fun_res_f_res_223824 = min_res_223829;
                    }
                    defunc_0_m_fun_res_223821 = defunc_0_m_fun_res_f_res_223824;
                }
                
                double defunc_2_reduce_res_223830;
                double defunc_2_reduce_res_223831;
                double defunc_2_reduce_res_223832;
                double redout_223834;
                double redout_223835;
                double redout_223836;
                
                redout_223834 = 0.0;
                redout_223835 = 0.0;
                redout_223836 = 0.0;
                for (int64_t i_223833 = 0; i_223833 < q_s_203575; i_223833++) {
                    bool cond_223837 = sle64(x_223812, i_223833);
                    int64_t defunc_0_f_res_223838;
                    
                    if (cond_223837) {
                        defunc_0_f_res_223838 = (int64_t) 0;
                    } else {
                        int64_t i_223839 = add64(x_223818, i_223833);
                        int64_t defunc_0_add_arg_223840;
                        
                        defunc_0_add_arg_223840 =
                            ((int64_t *) mem_217654.mem)[gtid_208406 *
                                                         (defunc_0_f_res_203721 *
                                                          n_p_203574) +
                                                         i_223809 *
                                                         defunc_0_f_res_203721 +
                                                         i_223839];
                        
                        int64_t defunc_1_add_res_223841 = add64((int64_t) 1,
                                                                defunc_0_add_arg_223840);
                        
                        defunc_0_f_res_223838 = defunc_1_add_res_223841;
                    }
                    
                    double defunc_0_f_res_223842;
                    
                    if (cond_223837) {
                        defunc_0_f_res_223842 = 0.0;
                    } else {
                        int64_t i_223843 = add64(x_223818, i_223833);
                        double defunc_0_add_arg_223844;
                        
                        defunc_0_add_arg_223844 =
                            ((double *) mem_218175.mem)[gtid_208406 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_223809 *
                                                        defunc_0_f_res_203721 +
                                                        i_223843];
                        defunc_0_f_res_223842 = defunc_0_add_arg_223844;
                    }
                    
                    int64_t binop_p_223845 = sub64(defunc_0_f_res_223838,
                                                   defunc_0_m_fun_res_223821);
                    double defunc_0_f_res_223846 =
                           sitofp_i64_f64(binop_p_223845);
                    double abs_res_223847 = fabs(defunc_0_f_res_223846);
                    double tmp1_223848 = abs_res_223847 / x_223819;
                    double x_223849 = tmp1_223848 * tmp1_223848;
                    double y_223850 = tmp1_223848 * x_223849;
                    double tmp2_223851 = 1.0 - y_223850;
                    double x_223852 = tmp2_223851 * tmp2_223851;
                    double tmp3_223853 = tmp2_223851 * x_223852;
                    double w_j_223854 = defunc_0_f_res_223842 * tmp3_223853;
                    double xw_j_223855 = defunc_0_f_res_223846 * w_j_223854;
                    double x2w_j_223856 = defunc_0_f_res_223846 * xw_j_223855;
                    double defunc_1_op_res_223857 = w_j_223854 + redout_223834;
                    double defunc_1_op_res_223858 = xw_j_223855 + redout_223835;
                    double defunc_1_op_res_223859 = x2w_j_223856 +
                           redout_223836;
                    double redout_tmp_223922 = defunc_1_op_res_223857;
                    double redout_tmp_223923 = defunc_1_op_res_223858;
                    double redout_tmp_223924 = defunc_1_op_res_223859;
                    
                    redout_223834 = redout_tmp_223922;
                    redout_223835 = redout_tmp_223923;
                    redout_223836 = redout_tmp_223924;
                }
                defunc_2_reduce_res_223830 = redout_223834;
                defunc_2_reduce_res_223831 = redout_223835;
                defunc_2_reduce_res_223832 = redout_223836;
                
                double x_223860 = defunc_2_reduce_res_223830 *
                       defunc_2_reduce_res_223832;
                double y_223861 = defunc_2_reduce_res_223831 *
                       defunc_2_reduce_res_223831;
                double y_223862 = x_223860 - y_223861;
                double det1_223863 = 1.0 / y_223862;
                double a11_223864 = defunc_2_reduce_res_223832 * det1_223863;
                double x_223865 = 0.0 - defunc_2_reduce_res_223831;
                double b11_223866 = det1_223863 * x_223865;
                double c11_223867 = defunc_2_reduce_res_223830 * det1_223863;
                int64_t defunc_0_m_fun_res_223868;
                
                if (cond_223820) {
                    defunc_0_m_fun_res_223868 = (int64_t) 0;
                } else {
                    int64_t y_223869 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_223870 = i_223815 == y_223869;
                    int64_t defunc_0_m_fun_res_f_res_223871;
                    
                    if (cond_223870) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_223872 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_223871 =
                            defunc_0_m_fun_res_f_res_t_res_223872;
                    } else {
                        int64_t x_223873 = sub64(i_223815, (int64_t) 1);
                        int64_t x_223874 = mul64(jump_s_203581, x_223873);
                        int64_t min_arg_223875 = add64((int64_t) 1, x_223874);
                        int64_t min_res_223876 = smin64(defunc_0_f_res_203721,
                                                        min_arg_223875);
                        
                        defunc_0_m_fun_res_f_res_223871 = min_res_223876;
                    }
                    defunc_0_m_fun_res_223868 = defunc_0_m_fun_res_f_res_223871;
                }
                
                double defunc_2_reduce_res_223877;
                double defunc_2_reduce_res_223878;
                double redout_223880;
                double redout_223881;
                
                redout_223880 = 0.0;
                redout_223881 = 0.0;
                for (int64_t i_223879 = 0; i_223879 < q_s_203575; i_223879++) {
                    bool cond_223882 = sle64(x_223812, i_223879);
                    int64_t defunc_0_f_res_223883;
                    
                    if (cond_223882) {
                        defunc_0_f_res_223883 = (int64_t) 0;
                    } else {
                        int64_t i_223884 = add64(x_223818, i_223879);
                        int64_t defunc_0_add_arg_223885;
                        
                        defunc_0_add_arg_223885 =
                            ((int64_t *) mem_217654.mem)[gtid_208406 *
                                                         (defunc_0_f_res_203721 *
                                                          n_p_203574) +
                                                         i_223809 *
                                                         defunc_0_f_res_203721 +
                                                         i_223884];
                        
                        int64_t defunc_1_add_res_223886 = add64((int64_t) 1,
                                                                defunc_0_add_arg_223885);
                        
                        defunc_0_f_res_223883 = defunc_1_add_res_223886;
                    }
                    
                    double defunc_0_f_res_223887;
                    
                    if (cond_223882) {
                        defunc_0_f_res_223887 = 0.0;
                    } else {
                        int64_t i_223888 = add64(x_223818, i_223879);
                        double defunc_0_add_arg_223889;
                        
                        defunc_0_add_arg_223889 =
                            ((double *) mem_218175.mem)[gtid_208406 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_223809 *
                                                        defunc_0_f_res_203721 +
                                                        i_223888];
                        defunc_0_f_res_223887 = defunc_0_add_arg_223889;
                    }
                    
                    int64_t binop_p_223890 = sub64(defunc_0_f_res_223883,
                                                   defunc_0_m_fun_res_223868);
                    double defunc_0_f_res_223891 =
                           sitofp_i64_f64(binop_p_223890);
                    double abs_res_223892 = fabs(defunc_0_f_res_223891);
                    double tmp1_223893 = abs_res_223892 / x_223819;
                    double x_223894 = tmp1_223893 * tmp1_223893;
                    double y_223895 = tmp1_223893 * x_223894;
                    double tmp2_223896 = 1.0 - y_223895;
                    double x_223897 = tmp2_223896 * tmp2_223896;
                    double tmp3_223898 = tmp2_223896 * x_223897;
                    double tmp4_223899 = defunc_0_f_res_223887 * tmp3_223898;
                    double defunc_1_f_res_223900 = defunc_0_f_res_223891 *
                           tmp4_223899;
                    double defunc_0_f_res_223901;
                    
                    if (cond_223882) {
                        defunc_0_f_res_223901 = 0.0;
                    } else {
                        int64_t i_223902 = add64(x_223818, i_223879);
                        double defunc_0_add_arg_223903;
                        
                        defunc_0_add_arg_223903 =
                            ((double *) mem_218170.mem)[gtid_208406 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_223809 *
                                                        defunc_0_f_res_203721 +
                                                        i_223902];
                        defunc_0_f_res_223901 = defunc_0_add_arg_223903;
                    }
                    
                    double x_223904 = a11_223864 * tmp4_223899;
                    double y_223905 = b11_223866 * defunc_1_f_res_223900;
                    double x_223906 = x_223904 + y_223905;
                    double defunc_9_fit_fun_res_223907 = defunc_0_f_res_223901 *
                           x_223906;
                    double x_223908 = b11_223866 * tmp4_223899;
                    double y_223909 = c11_223867 * defunc_1_f_res_223900;
                    double x_223910 = x_223908 + y_223909;
                    double defunc_9_slope_fun_res_223911 =
                           defunc_0_f_res_223901 * x_223910;
                    double defunc_1_op_res_223912 =
                           defunc_9_fit_fun_res_223907 + redout_223880;
                    double defunc_1_op_res_223913 =
                           defunc_9_slope_fun_res_223911 + redout_223881;
                    double redout_tmp_223925 = defunc_1_op_res_223912;
                    double redout_tmp_223926 = defunc_1_op_res_223913;
                    
                    redout_223880 = redout_tmp_223925;
                    redout_223881 = redout_tmp_223926;
                }
                defunc_2_reduce_res_223877 = redout_223880;
                defunc_2_reduce_res_223878 = redout_223881;
                ((double *) mem_218299)[i_223809 * s_n_m_203726 + i_223815] =
                    defunc_2_reduce_res_223877;
                ((double *) mem_218303)[i_223809 * s_n_m_203726 + i_223815] =
                    defunc_2_reduce_res_223878;
            }
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218388.mem + gtid_208406 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218299 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218393.mem + gtid_208406 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218303 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218299);
    free(mem_218303);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235876_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235876_end -
                 futhark_mc_segmap_parloop_235876_start;
        
        ctx->futhark_mc_segmap_parloop_235876_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235876_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235876_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235874(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_208405 = tid;
    int num_tasks_223807 = info.nsubtasks;
    struct futhark_mc_task_235873 *futhark_mc_task_235873 =
                                  (struct futhark_mc_task_235873 *) args;
    struct futhark_context *ctx = futhark_mc_task_235873->ctx;
    uint64_t futhark_mc_segmap_task_235874_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235874_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235873->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235873->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235873->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235873->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235873->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235873->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235873->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235873->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235873->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235873->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235873->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235873->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235873->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235873->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235873->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218388 = {.desc ="mem_218388", .mem =
                                  futhark_mc_task_235873->free_mem_218388,
                                  .size =0, .references =NULL};
    struct memblock mem_218393 = {.desc ="mem_218393", .mem =
                                  futhark_mc_task_235873->free_mem_218393,
                                  .size =0, .references =NULL};
    int64_t iter_223808;
    struct futhark_mc_segmap_parloop_struct_235875
    futhark_mc_segmap_parloop_struct_235875;
    
    futhark_mc_segmap_parloop_struct_235875.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235875.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235875.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235875.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235875.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235875.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235875.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235875.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235875.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235875.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235875.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235875.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235875.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235875.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235875.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235875.free_mem_218388 = mem_218388.mem;
    futhark_mc_segmap_parloop_struct_235875.free_mem_218393 = mem_218393.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235876_task;
    
    futhark_mc_segmap_parloop_235876_task.name =
        "futhark_mc_segmap_parloop_235876";
    futhark_mc_segmap_parloop_235876_task.fn = futhark_mc_segmap_parloop_235876;
    futhark_mc_segmap_parloop_235876_task.args =
        &futhark_mc_segmap_parloop_struct_235875;
    futhark_mc_segmap_parloop_235876_task.iterations = iterations;
    futhark_mc_segmap_parloop_235876_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235876_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235876_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235876_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235876_task);
    
    if (futhark_mc_segmap_parloop_235876_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235876_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235876_total_end -
                 futhark_mc_segmap_parloop_235876_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235876_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235876_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235876_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235874_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235874_end -
                 futhark_mc_segmap_task_235874_start;
        
        ctx->futhark_mc_segmap_task_235874_runs[tid]++;
        ctx->futhark_mc_segmap_task_235874_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235874_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235880 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218388;
    unsigned char *free_mem_218393;
};
struct futhark_mc_task_235884 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218291;
    unsigned char *free_mem_218295;
};
struct futhark_mc_segmap_parloop_struct_235886 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218291;
    unsigned char *free_mem_218295;
};
static int futhark_mc_segmap_parloop_235887(void *args, int64_t start,
                                            int64_t end, int flat_tid_224138,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235886
    *futhark_mc_segmap_parloop_struct_235886 =
    (struct futhark_mc_segmap_parloop_struct_235886 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235886->ctx;
    uint64_t futhark_mc_segmap_parloop_235887_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235887_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235886->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235886->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235886->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235886->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235886->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235886->free_s_n_m_203726;
    int64_t gtid_208752 =
            futhark_mc_segmap_parloop_struct_235886->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235886->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235886->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235886->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235886->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235886->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235886->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235886->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218291 = {.desc ="mem_218291", .mem =
                                  futhark_mc_segmap_parloop_struct_235886->free_mem_218291,
                                  .size =0, .references =NULL};
    struct memblock mem_218295 = {.desc ="mem_218295", .mem =
                                  futhark_mc_segmap_parloop_struct_235886->free_mem_218295,
                                  .size =0, .references =NULL};
    size_t mem_224141_cached_sizze_235888 = 0;
    unsigned char *mem_224141 = NULL;
    size_t mem_224143_cached_sizze_235889 = 0;
    unsigned char *mem_224143 = NULL;
    int64_t iterations = end - start;
    int64_t iter_224251 = start;
    
    if (mem_224141_cached_sizze_235888 < (size_t) bytes_217663) {
        mem_224141 = realloc(mem_224141, bytes_217663);
        mem_224141_cached_sizze_235888 = bytes_217663;
    }
    if (mem_224143_cached_sizze_235889 < (size_t) bytes_217663) {
        mem_224143 = realloc(mem_224143, bytes_217663);
        mem_224143_cached_sizze_235889 = bytes_217663;
    }
    for (; iter_224251 < end; iter_224251++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224353 = n_p_203574;
        int64_t gtid_224139 = iter_224251;
        int64_t remnant_224354 = iter_224251 - gtid_224139;
        int64_t x_224140;
        
        x_224140 = ((int64_t *) mem_217658.mem)[gtid_208752 * n_p_203574 +
                                                gtid_224139];
        for (int64_t i_224252 = 0; i_224252 < s_n_m_203726; i_224252++) {
            int64_t x_224255;
            
            x_224255 = ((int64_t *) mem_217828.mem)[gtid_208752 *
                                                    (s_n_m_203726 *
                                                     n_p_203574) + gtid_224139 *
                                                    s_n_m_203726 + i_224252];
            
            double x_224256;
            
            x_224256 = ((double *) mem_217833.mem)[gtid_208752 * (s_n_m_203726 *
                                                                  n_p_203574) +
                                                   gtid_224139 * s_n_m_203726 +
                                                   i_224252];
            
            bool cond_224257 = i_224252 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_224258;
            
            if (cond_224257) {
                defunc_0_m_fun_res_224258 = (int64_t) 0;
            } else {
                int64_t y_224259 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_224260 = i_224252 == y_224259;
                int64_t defunc_0_m_fun_res_f_res_224261;
                
                if (cond_224260) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_224262 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_224261 =
                        defunc_0_m_fun_res_f_res_t_res_224262;
                } else {
                    int64_t x_224263 = sub64(i_224252, (int64_t) 1);
                    int64_t x_224264 = mul64(jump_s_203581, x_224263);
                    int64_t min_arg_224265 = add64((int64_t) 1, x_224264);
                    int64_t min_res_224266 = smin64(defunc_0_f_res_203721,
                                                    min_arg_224265);
                    
                    defunc_0_m_fun_res_f_res_224261 = min_res_224266;
                }
                defunc_0_m_fun_res_224258 = defunc_0_m_fun_res_f_res_224261;
            }
            
            double defunc_2_reduce_res_224267;
            double defunc_2_reduce_res_224268;
            double defunc_2_reduce_res_224269;
            double redout_224271;
            double redout_224272;
            double redout_224273;
            
            redout_224271 = 0.0;
            redout_224272 = 0.0;
            redout_224273 = 0.0;
            for (int64_t i_224270 = 0; i_224270 < q_s_203575; i_224270++) {
                bool cond_224274 = sle64(x_224140, i_224270);
                int64_t defunc_0_f_res_224275;
                
                if (cond_224274) {
                    defunc_0_f_res_224275 = (int64_t) 0;
                } else {
                    int64_t i_224276 = add64(x_224255, i_224270);
                    int64_t defunc_0_add_arg_224277;
                    
                    defunc_0_add_arg_224277 =
                        ((int64_t *) mem_217654.mem)[gtid_208752 *
                                                     (defunc_0_f_res_203721 *
                                                      n_p_203574) +
                                                     gtid_224139 *
                                                     defunc_0_f_res_203721 +
                                                     i_224276];
                    
                    int64_t defunc_1_add_res_224278 = add64((int64_t) 1,
                                                            defunc_0_add_arg_224277);
                    
                    defunc_0_f_res_224275 = defunc_1_add_res_224278;
                }
                
                double defunc_0_f_res_224279;
                
                if (cond_224274) {
                    defunc_0_f_res_224279 = 0.0;
                } else {
                    int64_t i_224280 = add64(x_224255, i_224270);
                    double defunc_0_add_arg_224281;
                    
                    defunc_0_add_arg_224281 =
                        ((double *) mem_218175.mem)[gtid_208752 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_224139 *
                                                    defunc_0_f_res_203721 +
                                                    i_224280];
                    defunc_0_f_res_224279 = defunc_0_add_arg_224281;
                }
                
                int64_t binop_p_224282 = sub64(defunc_0_f_res_224275,
                                               defunc_0_m_fun_res_224258);
                double defunc_0_f_res_224283 = sitofp_i64_f64(binop_p_224282);
                double abs_res_224284 = fabs(defunc_0_f_res_224283);
                double tmp1_224285 = abs_res_224284 / x_224256;
                double x_224286 = tmp1_224285 * tmp1_224285;
                double y_224287 = tmp1_224285 * x_224286;
                double tmp2_224288 = 1.0 - y_224287;
                double x_224289 = tmp2_224288 * tmp2_224288;
                double tmp3_224290 = tmp2_224288 * x_224289;
                double w_j_224291 = defunc_0_f_res_224279 * tmp3_224290;
                double xw_j_224292 = defunc_0_f_res_224283 * w_j_224291;
                double x2w_j_224293 = defunc_0_f_res_224283 * xw_j_224292;
                double defunc_1_op_res_224294 = w_j_224291 + redout_224271;
                double defunc_1_op_res_224295 = xw_j_224292 + redout_224272;
                double defunc_1_op_res_224296 = x2w_j_224293 + redout_224273;
                double redout_tmp_224357 = defunc_1_op_res_224294;
                double redout_tmp_224358 = defunc_1_op_res_224295;
                double redout_tmp_224359 = defunc_1_op_res_224296;
                
                redout_224271 = redout_tmp_224357;
                redout_224272 = redout_tmp_224358;
                redout_224273 = redout_tmp_224359;
            }
            defunc_2_reduce_res_224267 = redout_224271;
            defunc_2_reduce_res_224268 = redout_224272;
            defunc_2_reduce_res_224269 = redout_224273;
            
            double x_224297 = defunc_2_reduce_res_224267 *
                   defunc_2_reduce_res_224269;
            double y_224298 = defunc_2_reduce_res_224268 *
                   defunc_2_reduce_res_224268;
            double y_224299 = x_224297 - y_224298;
            double det1_224300 = 1.0 / y_224299;
            double a11_224301 = defunc_2_reduce_res_224269 * det1_224300;
            double x_224302 = 0.0 - defunc_2_reduce_res_224268;
            double b11_224303 = det1_224300 * x_224302;
            double c11_224304 = defunc_2_reduce_res_224267 * det1_224300;
            int64_t defunc_0_m_fun_res_224305;
            
            if (cond_224257) {
                defunc_0_m_fun_res_224305 = (int64_t) 0;
            } else {
                int64_t y_224306 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_224307 = i_224252 == y_224306;
                int64_t defunc_0_m_fun_res_f_res_224308;
                
                if (cond_224307) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_224309 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_224308 =
                        defunc_0_m_fun_res_f_res_t_res_224309;
                } else {
                    int64_t x_224310 = sub64(i_224252, (int64_t) 1);
                    int64_t x_224311 = mul64(jump_s_203581, x_224310);
                    int64_t min_arg_224312 = add64((int64_t) 1, x_224311);
                    int64_t min_res_224313 = smin64(defunc_0_f_res_203721,
                                                    min_arg_224312);
                    
                    defunc_0_m_fun_res_f_res_224308 = min_res_224313;
                }
                defunc_0_m_fun_res_224305 = defunc_0_m_fun_res_f_res_224308;
            }
            
            double defunc_2_reduce_res_224314;
            double defunc_2_reduce_res_224315;
            double redout_224317;
            double redout_224318;
            
            redout_224317 = 0.0;
            redout_224318 = 0.0;
            for (int64_t i_224316 = 0; i_224316 < q_s_203575; i_224316++) {
                bool cond_224319 = sle64(x_224140, i_224316);
                int64_t defunc_0_f_res_224320;
                
                if (cond_224319) {
                    defunc_0_f_res_224320 = (int64_t) 0;
                } else {
                    int64_t i_224321 = add64(x_224255, i_224316);
                    int64_t defunc_0_add_arg_224322;
                    
                    defunc_0_add_arg_224322 =
                        ((int64_t *) mem_217654.mem)[gtid_208752 *
                                                     (defunc_0_f_res_203721 *
                                                      n_p_203574) +
                                                     gtid_224139 *
                                                     defunc_0_f_res_203721 +
                                                     i_224321];
                    
                    int64_t defunc_1_add_res_224323 = add64((int64_t) 1,
                                                            defunc_0_add_arg_224322);
                    
                    defunc_0_f_res_224320 = defunc_1_add_res_224323;
                }
                
                double defunc_0_f_res_224324;
                
                if (cond_224319) {
                    defunc_0_f_res_224324 = 0.0;
                } else {
                    int64_t i_224325 = add64(x_224255, i_224316);
                    double defunc_0_add_arg_224326;
                    
                    defunc_0_add_arg_224326 =
                        ((double *) mem_218175.mem)[gtid_208752 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_224139 *
                                                    defunc_0_f_res_203721 +
                                                    i_224325];
                    defunc_0_f_res_224324 = defunc_0_add_arg_224326;
                }
                
                int64_t binop_p_224327 = sub64(defunc_0_f_res_224320,
                                               defunc_0_m_fun_res_224305);
                double defunc_0_f_res_224328 = sitofp_i64_f64(binop_p_224327);
                double abs_res_224329 = fabs(defunc_0_f_res_224328);
                double tmp1_224330 = abs_res_224329 / x_224256;
                double x_224331 = tmp1_224330 * tmp1_224330;
                double y_224332 = tmp1_224330 * x_224331;
                double tmp2_224333 = 1.0 - y_224332;
                double x_224334 = tmp2_224333 * tmp2_224333;
                double tmp3_224335 = tmp2_224333 * x_224334;
                double tmp4_224336 = defunc_0_f_res_224324 * tmp3_224335;
                double defunc_1_f_res_224337 = defunc_0_f_res_224328 *
                       tmp4_224336;
                double defunc_0_f_res_224338;
                
                if (cond_224319) {
                    defunc_0_f_res_224338 = 0.0;
                } else {
                    int64_t i_224339 = add64(x_224255, i_224316);
                    double defunc_0_add_arg_224340;
                    
                    defunc_0_add_arg_224340 =
                        ((double *) mem_218170.mem)[gtid_208752 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_224139 *
                                                    defunc_0_f_res_203721 +
                                                    i_224339];
                    defunc_0_f_res_224338 = defunc_0_add_arg_224340;
                }
                
                double x_224341 = a11_224301 * tmp4_224336;
                double y_224342 = b11_224303 * defunc_1_f_res_224337;
                double x_224343 = x_224341 + y_224342;
                double defunc_9_fit_fun_res_224344 = defunc_0_f_res_224338 *
                       x_224343;
                double x_224345 = b11_224303 * tmp4_224336;
                double y_224346 = c11_224304 * defunc_1_f_res_224337;
                double x_224347 = x_224345 + y_224346;
                double defunc_9_slope_fun_res_224348 = defunc_0_f_res_224338 *
                       x_224347;
                double defunc_1_op_res_224349 = defunc_9_fit_fun_res_224344 +
                       redout_224317;
                double defunc_1_op_res_224350 = defunc_9_slope_fun_res_224348 +
                       redout_224318;
                double redout_tmp_224360 = defunc_1_op_res_224349;
                double redout_tmp_224361 = defunc_1_op_res_224350;
                
                redout_224317 = redout_tmp_224360;
                redout_224318 = redout_tmp_224361;
            }
            defunc_2_reduce_res_224314 = redout_224317;
            defunc_2_reduce_res_224315 = redout_224318;
            ((double *) mem_224141)[i_224252] = defunc_2_reduce_res_224314;
            ((double *) mem_224143)[i_224252] = defunc_2_reduce_res_224315;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218291.mem + gtid_224139 * s_n_m_203726 * (int64_t) 8,
                    mem_224141 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218295.mem + gtid_224139 * s_n_m_203726 * (int64_t) 8,
                    mem_224143 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_224141);
    free(mem_224143);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235887_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235887_end -
                 futhark_mc_segmap_parloop_235887_start;
        
        ctx->futhark_mc_segmap_parloop_235887_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235887_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235887_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235885(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224138 = tid;
    int num_tasks_224250 = info.nsubtasks;
    struct futhark_mc_task_235884 *futhark_mc_task_235884 =
                                  (struct futhark_mc_task_235884 *) args;
    struct futhark_context *ctx = futhark_mc_task_235884->ctx;
    uint64_t futhark_mc_segmap_task_235885_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235885_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235884->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235884->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235884->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235884->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235884->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235884->free_s_n_m_203726;
    int64_t gtid_208752 = futhark_mc_task_235884->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235884->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235884->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235884->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235884->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235884->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235884->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235884->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218291 = {.desc ="mem_218291", .mem =
                                  futhark_mc_task_235884->free_mem_218291,
                                  .size =0, .references =NULL};
    struct memblock mem_218295 = {.desc ="mem_218295", .mem =
                                  futhark_mc_task_235884->free_mem_218295,
                                  .size =0, .references =NULL};
    int64_t iter_224251;
    struct futhark_mc_segmap_parloop_struct_235886
    futhark_mc_segmap_parloop_struct_235886;
    
    futhark_mc_segmap_parloop_struct_235886.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235886.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235886.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235886.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235886.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235886.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235886.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235886.free_gtid_208752 = gtid_208752;
    futhark_mc_segmap_parloop_struct_235886.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235886.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235886.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235886.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235886.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235886.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235886.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235886.free_mem_218291 = mem_218291.mem;
    futhark_mc_segmap_parloop_struct_235886.free_mem_218295 = mem_218295.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235887_task;
    
    futhark_mc_segmap_parloop_235887_task.name =
        "futhark_mc_segmap_parloop_235887";
    futhark_mc_segmap_parloop_235887_task.fn = futhark_mc_segmap_parloop_235887;
    futhark_mc_segmap_parloop_235887_task.args =
        &futhark_mc_segmap_parloop_struct_235886;
    futhark_mc_segmap_parloop_235887_task.iterations = iterations;
    futhark_mc_segmap_parloop_235887_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235887_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235887_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235887_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235887_task);
    
    if (futhark_mc_segmap_parloop_235887_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235887_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235887_total_end -
                 futhark_mc_segmap_parloop_235887_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235887_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235887_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235887_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235885_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235885_end -
                 futhark_mc_segmap_task_235885_start;
        
        ctx->futhark_mc_segmap_task_235885_runs[tid]++;
        ctx->futhark_mc_segmap_task_235885_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235885_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235891 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218291;
    unsigned char *free_mem_218295;
};
struct futhark_mc_task_235895 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223929;
    int64_t free_x_223930;
    unsigned char *free_mem_223931;
    unsigned char *free_mem_223932;
};
struct futhark_mc_segmap_parloop_struct_235897 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223929;
    int64_t free_x_223930;
    unsigned char *free_mem_223931;
    unsigned char *free_mem_223932;
};
static int futhark_mc_segmap_parloop_235898(void *args, int64_t start,
                                            int64_t end, int flat_tid_224468,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235897
    *futhark_mc_segmap_parloop_struct_235897 =
    (struct futhark_mc_segmap_parloop_struct_235897 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235897->ctx;
    uint64_t futhark_mc_segmap_parloop_235898_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235898_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235897->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235897->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235897->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235897->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235897->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235897->free_s_n_m_203726;
    int64_t gtid_208752 =
            futhark_mc_segmap_parloop_struct_235897->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235897->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235897->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235897->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235897->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235897->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223929 =
            futhark_mc_segmap_parloop_struct_235897->free_gtid_223929;
    int64_t x_223930 = futhark_mc_segmap_parloop_struct_235897->free_x_223930;
    struct memblock mem_223931 = {.desc ="mem_223931", .mem =
                                  futhark_mc_segmap_parloop_struct_235897->free_mem_223931,
                                  .size =0, .references =NULL};
    struct memblock mem_223932 = {.desc ="mem_223932", .mem =
                                  futhark_mc_segmap_parloop_struct_235897->free_mem_223932,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_224569 = start;
    
    for (; iter_224569 < end; iter_224569++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224648 = s_n_m_203726;
        int64_t gtid_224469 = iter_224569;
        int64_t remnant_224649 = iter_224569 - gtid_224469;
        int64_t x_224470;
        
        x_224470 = ((int64_t *) mem_217828.mem)[gtid_208752 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_223929 * s_n_m_203726 +
                                                gtid_224469];
        
        double x_224471;
        
        x_224471 = ((double *) mem_217833.mem)[gtid_208752 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_223929 * s_n_m_203726 +
                                               gtid_224469];
        
        bool cond_224472 = gtid_224469 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_224473;
        
        if (cond_224472) {
            defunc_0_m_fun_res_224473 = (int64_t) 0;
        } else {
            int64_t y_224570 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_224571 = gtid_224469 == y_224570;
            int64_t defunc_0_m_fun_res_f_res_224572;
            
            if (cond_224571) {
                int64_t defunc_0_m_fun_res_f_res_t_res_224573 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_224572 =
                    defunc_0_m_fun_res_f_res_t_res_224573;
            } else {
                int64_t x_224574 = sub64(gtid_224469, (int64_t) 1);
                int64_t x_224575 = mul64(jump_s_203581, x_224574);
                int64_t min_arg_224576 = add64((int64_t) 1, x_224575);
                int64_t min_res_224577 = smin64(defunc_0_f_res_203721,
                                                min_arg_224576);
                
                defunc_0_m_fun_res_f_res_224572 = min_res_224577;
            }
            defunc_0_m_fun_res_224473 = defunc_0_m_fun_res_f_res_224572;
        }
        
        double defunc_2_reduce_res_224482;
        double defunc_2_reduce_res_224483;
        double defunc_2_reduce_res_224484;
        double redout_224579;
        double redout_224580;
        double redout_224581;
        
        redout_224579 = 0.0;
        redout_224580 = 0.0;
        redout_224581 = 0.0;
        for (int64_t i_224578 = 0; i_224578 < q_s_203575; i_224578++) {
            bool cond_224582 = sle64(x_223930, i_224578);
            int64_t defunc_0_f_res_224583;
            
            if (cond_224582) {
                defunc_0_f_res_224583 = (int64_t) 0;
            } else {
                int64_t i_224584 = add64(x_224470, i_224578);
                int64_t defunc_0_add_arg_224585;
                
                defunc_0_add_arg_224585 =
                    ((int64_t *) mem_217654.mem)[gtid_208752 *
                                                 (defunc_0_f_res_203721 *
                                                  n_p_203574) + gtid_223929 *
                                                 defunc_0_f_res_203721 +
                                                 i_224584];
                
                int64_t defunc_1_add_res_224586 = add64((int64_t) 1,
                                                        defunc_0_add_arg_224585);
                
                defunc_0_f_res_224583 = defunc_1_add_res_224586;
            }
            
            double defunc_0_f_res_224587;
            
            if (cond_224582) {
                defunc_0_f_res_224587 = 0.0;
            } else {
                int64_t i_224588 = add64(x_224470, i_224578);
                double defunc_0_add_arg_224589;
                
                defunc_0_add_arg_224589 =
                    ((double *) mem_218175.mem)[gtid_208752 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_223929 *
                                                defunc_0_f_res_203721 +
                                                i_224588];
                defunc_0_f_res_224587 = defunc_0_add_arg_224589;
            }
            
            int64_t binop_p_224590 = sub64(defunc_0_f_res_224583,
                                           defunc_0_m_fun_res_224473);
            double defunc_0_f_res_224591 = sitofp_i64_f64(binop_p_224590);
            double abs_res_224592 = fabs(defunc_0_f_res_224591);
            double tmp1_224593 = abs_res_224592 / x_224471;
            double x_224594 = tmp1_224593 * tmp1_224593;
            double y_224595 = tmp1_224593 * x_224594;
            double tmp2_224596 = 1.0 - y_224595;
            double x_224597 = tmp2_224596 * tmp2_224596;
            double tmp3_224598 = tmp2_224596 * x_224597;
            double w_j_224599 = defunc_0_f_res_224587 * tmp3_224598;
            double xw_j_224600 = defunc_0_f_res_224591 * w_j_224599;
            double x2w_j_224601 = defunc_0_f_res_224591 * xw_j_224600;
            double defunc_1_op_res_224602 = w_j_224599 + redout_224579;
            double defunc_1_op_res_224603 = xw_j_224600 + redout_224580;
            double defunc_1_op_res_224604 = x2w_j_224601 + redout_224581;
            double redout_tmp_224650 = defunc_1_op_res_224602;
            double redout_tmp_224651 = defunc_1_op_res_224603;
            double redout_tmp_224652 = defunc_1_op_res_224604;
            
            redout_224579 = redout_tmp_224650;
            redout_224580 = redout_tmp_224651;
            redout_224581 = redout_tmp_224652;
        }
        defunc_2_reduce_res_224482 = redout_224579;
        defunc_2_reduce_res_224483 = redout_224580;
        defunc_2_reduce_res_224484 = redout_224581;
        
        double x_224512 = defunc_2_reduce_res_224482 *
               defunc_2_reduce_res_224484;
        double y_224513 = defunc_2_reduce_res_224483 *
               defunc_2_reduce_res_224483;
        double y_224514 = x_224512 - y_224513;
        double det1_224515 = 1.0 / y_224514;
        double a11_224516 = defunc_2_reduce_res_224484 * det1_224515;
        double x_224517 = 0.0 - defunc_2_reduce_res_224483;
        double b11_224518 = det1_224515 * x_224517;
        double c11_224519 = defunc_2_reduce_res_224482 * det1_224515;
        int64_t defunc_0_m_fun_res_224520;
        
        if (cond_224472) {
            defunc_0_m_fun_res_224520 = (int64_t) 0;
        } else {
            int64_t y_224605 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_224606 = gtid_224469 == y_224605;
            int64_t defunc_0_m_fun_res_f_res_224607;
            
            if (cond_224606) {
                int64_t defunc_0_m_fun_res_f_res_t_res_224608 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_224607 =
                    defunc_0_m_fun_res_f_res_t_res_224608;
            } else {
                int64_t x_224609 = sub64(gtid_224469, (int64_t) 1);
                int64_t x_224610 = mul64(jump_s_203581, x_224609);
                int64_t min_arg_224611 = add64((int64_t) 1, x_224610);
                int64_t min_res_224612 = smin64(defunc_0_f_res_203721,
                                                min_arg_224611);
                
                defunc_0_m_fun_res_f_res_224607 = min_res_224612;
            }
            defunc_0_m_fun_res_224520 = defunc_0_m_fun_res_f_res_224607;
        }
        
        double defunc_2_reduce_res_224529;
        double defunc_2_reduce_res_224530;
        double redout_224614;
        double redout_224615;
        
        redout_224614 = 0.0;
        redout_224615 = 0.0;
        for (int64_t i_224613 = 0; i_224613 < q_s_203575; i_224613++) {
            bool cond_224616 = sle64(x_223930, i_224613);
            int64_t defunc_0_f_res_224617;
            
            if (cond_224616) {
                defunc_0_f_res_224617 = (int64_t) 0;
            } else {
                int64_t i_224618 = add64(x_224470, i_224613);
                int64_t defunc_0_add_arg_224619;
                
                defunc_0_add_arg_224619 =
                    ((int64_t *) mem_217654.mem)[gtid_208752 *
                                                 (defunc_0_f_res_203721 *
                                                  n_p_203574) + gtid_223929 *
                                                 defunc_0_f_res_203721 +
                                                 i_224618];
                
                int64_t defunc_1_add_res_224620 = add64((int64_t) 1,
                                                        defunc_0_add_arg_224619);
                
                defunc_0_f_res_224617 = defunc_1_add_res_224620;
            }
            
            double defunc_0_f_res_224621;
            
            if (cond_224616) {
                defunc_0_f_res_224621 = 0.0;
            } else {
                int64_t i_224622 = add64(x_224470, i_224613);
                double defunc_0_add_arg_224623;
                
                defunc_0_add_arg_224623 =
                    ((double *) mem_218175.mem)[gtid_208752 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_223929 *
                                                defunc_0_f_res_203721 +
                                                i_224622];
                defunc_0_f_res_224621 = defunc_0_add_arg_224623;
            }
            
            int64_t binop_p_224624 = sub64(defunc_0_f_res_224617,
                                           defunc_0_m_fun_res_224520);
            double defunc_0_f_res_224625 = sitofp_i64_f64(binop_p_224624);
            double abs_res_224626 = fabs(defunc_0_f_res_224625);
            double tmp1_224627 = abs_res_224626 / x_224471;
            double x_224628 = tmp1_224627 * tmp1_224627;
            double y_224629 = tmp1_224627 * x_224628;
            double tmp2_224630 = 1.0 - y_224629;
            double x_224631 = tmp2_224630 * tmp2_224630;
            double tmp3_224632 = tmp2_224630 * x_224631;
            double tmp4_224633 = defunc_0_f_res_224621 * tmp3_224632;
            double defunc_1_f_res_224634 = defunc_0_f_res_224625 * tmp4_224633;
            double defunc_0_f_res_224635;
            
            if (cond_224616) {
                defunc_0_f_res_224635 = 0.0;
            } else {
                int64_t i_224636 = add64(x_224470, i_224613);
                double defunc_0_add_arg_224637;
                
                defunc_0_add_arg_224637 =
                    ((double *) mem_218170.mem)[gtid_208752 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_223929 *
                                                defunc_0_f_res_203721 +
                                                i_224636];
                defunc_0_f_res_224635 = defunc_0_add_arg_224637;
            }
            
            double x_224638 = a11_224516 * tmp4_224633;
            double y_224639 = b11_224518 * defunc_1_f_res_224634;
            double x_224640 = x_224638 + y_224639;
            double defunc_9_fit_fun_res_224641 = defunc_0_f_res_224635 *
                   x_224640;
            double x_224642 = b11_224518 * tmp4_224633;
            double y_224643 = c11_224519 * defunc_1_f_res_224634;
            double x_224644 = x_224642 + y_224643;
            double defunc_9_slope_fun_res_224645 = defunc_0_f_res_224635 *
                   x_224644;
            double defunc_1_op_res_224646 = defunc_9_fit_fun_res_224641 +
                   redout_224614;
            double defunc_1_op_res_224647 = defunc_9_slope_fun_res_224645 +
                   redout_224615;
            double redout_tmp_224653 = defunc_1_op_res_224646;
            double redout_tmp_224654 = defunc_1_op_res_224647;
            
            redout_224614 = redout_tmp_224653;
            redout_224615 = redout_tmp_224654;
        }
        defunc_2_reduce_res_224529 = redout_224614;
        defunc_2_reduce_res_224530 = redout_224615;
        ((double *) mem_223931.mem)[gtid_224469] = defunc_2_reduce_res_224529;
        ((double *) mem_223932.mem)[gtid_224469] = defunc_2_reduce_res_224530;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235898_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235898_end -
                 futhark_mc_segmap_parloop_235898_start;
        
        ctx->futhark_mc_segmap_parloop_235898_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235898_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235898_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235896(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224468 = tid;
    int num_tasks_224568 = info.nsubtasks;
    struct futhark_mc_task_235895 *futhark_mc_task_235895 =
                                  (struct futhark_mc_task_235895 *) args;
    struct futhark_context *ctx = futhark_mc_task_235895->ctx;
    uint64_t futhark_mc_segmap_task_235896_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235896_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235895->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235895->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235895->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235895->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235895->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235895->free_s_n_m_203726;
    int64_t gtid_208752 = futhark_mc_task_235895->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235895->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235895->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235895->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235895->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235895->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223929 = futhark_mc_task_235895->free_gtid_223929;
    int64_t x_223930 = futhark_mc_task_235895->free_x_223930;
    struct memblock mem_223931 = {.desc ="mem_223931", .mem =
                                  futhark_mc_task_235895->free_mem_223931,
                                  .size =0, .references =NULL};
    struct memblock mem_223932 = {.desc ="mem_223932", .mem =
                                  futhark_mc_task_235895->free_mem_223932,
                                  .size =0, .references =NULL};
    int64_t iter_224569;
    struct futhark_mc_segmap_parloop_struct_235897
    futhark_mc_segmap_parloop_struct_235897;
    
    futhark_mc_segmap_parloop_struct_235897.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235897.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235897.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235897.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235897.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235897.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235897.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235897.free_gtid_208752 = gtid_208752;
    futhark_mc_segmap_parloop_struct_235897.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235897.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235897.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235897.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235897.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235897.free_gtid_223929 = gtid_223929;
    futhark_mc_segmap_parloop_struct_235897.free_x_223930 = x_223930;
    futhark_mc_segmap_parloop_struct_235897.free_mem_223931 = mem_223931.mem;
    futhark_mc_segmap_parloop_struct_235897.free_mem_223932 = mem_223932.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235898_task;
    
    futhark_mc_segmap_parloop_235898_task.name =
        "futhark_mc_segmap_parloop_235898";
    futhark_mc_segmap_parloop_235898_task.fn = futhark_mc_segmap_parloop_235898;
    futhark_mc_segmap_parloop_235898_task.args =
        &futhark_mc_segmap_parloop_struct_235897;
    futhark_mc_segmap_parloop_235898_task.iterations = iterations;
    futhark_mc_segmap_parloop_235898_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235898_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235898_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235898_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235898_task);
    
    if (futhark_mc_segmap_parloop_235898_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235898_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235898_total_end -
                 futhark_mc_segmap_parloop_235898_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235898_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235898_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235898_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235896_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235896_end -
                 futhark_mc_segmap_task_235896_start;
        
        ctx->futhark_mc_segmap_task_235896_runs[tid]++;
        ctx->futhark_mc_segmap_task_235896_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235896_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235900 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223929;
    int64_t free_x_223930;
    unsigned char *free_mem_223931;
    unsigned char *free_mem_223932;
};
struct futhark_mc_task_235902 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223929;
    int64_t free_x_223930;
    int64_t free_x_224365;
    double free_x_224366;
    int64_t free_defunc_0_m_fun_res_224368;
    double *retval_defunc_2_reduce_res_224377;
    double *retval_defunc_2_reduce_res_224378;
    double *retval_defunc_2_reduce_res_224379;
};
struct futhark_mc_segred_stage_1_parloop_struct_235907 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223929;
    int64_t free_x_223930;
    int64_t free_x_224365;
    double free_x_224366;
    int64_t free_defunc_0_m_fun_res_224368;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224744;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224746;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224748;
};
static int futhark_mc_segred_stage_1_parloop_235908(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_224664,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235907
    *futhark_mc_segred_stage_1_parloop_struct_235907 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235907 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235907->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235908_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235908_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235907->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_235907->free_defunc_0_f_res_203721;
    int64_t gtid_208752 =
            futhark_mc_segred_stage_1_parloop_struct_235907->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235907->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235907->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223929 =
            futhark_mc_segred_stage_1_parloop_struct_235907->free_gtid_223929;
    int64_t x_223930 =
            futhark_mc_segred_stage_1_parloop_struct_235907->free_x_223930;
    int64_t x_224365 =
            futhark_mc_segred_stage_1_parloop_struct_235907->free_x_224365;
    double x_224366 =
           futhark_mc_segred_stage_1_parloop_struct_235907->free_x_224366;
    int64_t defunc_0_m_fun_res_224368 =
            futhark_mc_segred_stage_1_parloop_struct_235907->free_defunc_0_m_fun_res_224368;
    struct memblock reduce_stage_1_tid_res_arr_mem_224744 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224744",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235907->free_reduce_stage_1_tid_res_arr_mem_224744,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_224746 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224746",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235907->free_reduce_stage_1_tid_res_arr_mem_224746,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_224748 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224748",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235907->free_reduce_stage_1_tid_res_arr_mem_224748,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_224750 = start;
    double x_224666;
    double x_224667;
    double x_224669;
    double x_224670;
    double x_224672;
    double x_224673;
    double local_acc_224751 = 0.0;
    double local_acc_224752 = 0.0;
    double local_acc_224753 = 0.0;
    
    for (; iter_224750 < end; iter_224750++) {
        int64_t gtid_224665 = iter_224750;
        bool cond_224675 = sle64(x_223930, gtid_224665);
        int64_t defunc_0_f_res_224676;
        
        if (cond_224675) {
            defunc_0_f_res_224676 = (int64_t) 0;
        } else {
            int64_t i_224677 = add64(x_224365, gtid_224665);
            int64_t defunc_0_add_arg_224678;
            
            defunc_0_add_arg_224678 = ((int64_t *) mem_217654.mem)[gtid_208752 *
                                                                   (defunc_0_f_res_203721 *
                                                                    n_p_203574) +
                                                                   gtid_223929 *
                                                                   defunc_0_f_res_203721 +
                                                                   i_224677];
            
            int64_t defunc_1_add_res_224679 = add64((int64_t) 1,
                                                    defunc_0_add_arg_224678);
            
            defunc_0_f_res_224676 = defunc_1_add_res_224679;
        }
        
        double defunc_0_f_res_224680;
        
        if (cond_224675) {
            defunc_0_f_res_224680 = 0.0;
        } else {
            int64_t i_224681 = add64(x_224365, gtid_224665);
            double defunc_0_add_arg_224682;
            
            defunc_0_add_arg_224682 = ((double *) mem_218175.mem)[gtid_208752 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_223929 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_224681];
            defunc_0_f_res_224680 = defunc_0_add_arg_224682;
        }
        
        int64_t binop_p_224683 = sub64(defunc_0_f_res_224676,
                                       defunc_0_m_fun_res_224368);
        double defunc_0_f_res_224684 = sitofp_i64_f64(binop_p_224683);
        double abs_res_224685 = fabs(defunc_0_f_res_224684);
        double tmp1_224686 = abs_res_224685 / x_224366;
        double x_224687 = tmp1_224686 * tmp1_224686;
        double y_224688 = tmp1_224686 * x_224687;
        double tmp2_224689 = 1.0 - y_224688;
        double x_224690 = tmp2_224689 * tmp2_224689;
        double tmp3_224691 = tmp2_224689 * x_224690;
        double w_j_224692 = defunc_0_f_res_224680 * tmp3_224691;
        double xw_j_224693 = defunc_0_f_res_224684 * w_j_224692;
        double x2w_j_224694 = defunc_0_f_res_224684 * xw_j_224693;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_224666 = local_acc_224751;
        }
        // Load next params
        {
            x_224667 = w_j_224692;
        }
        // Red body
        {
            double defunc_1_op_res_224668 = x_224666 + x_224667;
            
            local_acc_224751 = defunc_1_op_res_224668;
        }
        // Load accum params
        {
            x_224669 = local_acc_224752;
        }
        // Load next params
        {
            x_224670 = xw_j_224693;
        }
        // Red body
        {
            double defunc_1_op_res_224671 = x_224669 + x_224670;
            
            local_acc_224752 = defunc_1_op_res_224671;
        }
        // Load accum params
        {
            x_224672 = local_acc_224753;
        }
        // Load next params
        {
            x_224673 = x2w_j_224694;
        }
        // Red body
        {
            double defunc_1_op_res_224674 = x_224672 + x_224673;
            
            local_acc_224753 = defunc_1_op_res_224674;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_224744.mem)[flat_tid_224664] =
        local_acc_224751;
    ((double *) reduce_stage_1_tid_res_arr_mem_224746.mem)[flat_tid_224664] =
        local_acc_224752;
    ((double *) reduce_stage_1_tid_res_arr_mem_224748.mem)[flat_tid_224664] =
        local_acc_224753;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235908_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235908_end -
                 futhark_mc_segred_stage_1_parloop_235908_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235908_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235908_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235908_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235903(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224664 = tid;
    int num_tasks_224743 = info.nsubtasks;
    struct futhark_mc_task_235902 *futhark_mc_task_235902 =
                                  (struct futhark_mc_task_235902 *) args;
    struct futhark_context *ctx = futhark_mc_task_235902->ctx;
    uint64_t futhark_mc_segred_task_235903_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235903_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235902->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235902->free_defunc_0_f_res_203721;
    int64_t gtid_208752 = futhark_mc_task_235902->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235902->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235902->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223929 = futhark_mc_task_235902->free_gtid_223929;
    int64_t x_223930 = futhark_mc_task_235902->free_x_223930;
    int64_t x_224365 = futhark_mc_task_235902->free_x_224365;
    double x_224366 = futhark_mc_task_235902->free_x_224366;
    int64_t defunc_0_m_fun_res_224368 =
            futhark_mc_task_235902->free_defunc_0_m_fun_res_224368;
    double defunc_2_reduce_res_224377 =
           *futhark_mc_task_235902->retval_defunc_2_reduce_res_224377;
    double defunc_2_reduce_res_224378 =
           *futhark_mc_task_235902->retval_defunc_2_reduce_res_224378;
    double defunc_2_reduce_res_224379 =
           *futhark_mc_task_235902->retval_defunc_2_reduce_res_224379;
    size_t reduce_stage_1_tid_res_arr_mem_224744_cached_sizze_235904 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224744 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_224746_cached_sizze_235905 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224746 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_224748_cached_sizze_235906 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224748 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_224744_cached_sizze_235904 <
        (size_t) ((int64_t) 8 * num_tasks_224743)) {
        reduce_stage_1_tid_res_arr_mem_224744 =
            realloc(reduce_stage_1_tid_res_arr_mem_224744, (int64_t) 8 *
                    num_tasks_224743);
        reduce_stage_1_tid_res_arr_mem_224744_cached_sizze_235904 =
            (int64_t) 8 * num_tasks_224743;
    }
    if (reduce_stage_1_tid_res_arr_mem_224746_cached_sizze_235905 <
        (size_t) ((int64_t) 8 * num_tasks_224743)) {
        reduce_stage_1_tid_res_arr_mem_224746 =
            realloc(reduce_stage_1_tid_res_arr_mem_224746, (int64_t) 8 *
                    num_tasks_224743);
        reduce_stage_1_tid_res_arr_mem_224746_cached_sizze_235905 =
            (int64_t) 8 * num_tasks_224743;
    }
    if (reduce_stage_1_tid_res_arr_mem_224748_cached_sizze_235906 <
        (size_t) ((int64_t) 8 * num_tasks_224743)) {
        reduce_stage_1_tid_res_arr_mem_224748 =
            realloc(reduce_stage_1_tid_res_arr_mem_224748, (int64_t) 8 *
                    num_tasks_224743);
        reduce_stage_1_tid_res_arr_mem_224748_cached_sizze_235906 =
            (int64_t) 8 * num_tasks_224743;
    }
    
    int64_t iter_224750;
    struct futhark_mc_segred_stage_1_parloop_struct_235907
    futhark_mc_segred_stage_1_parloop_struct_235907;
    
    futhark_mc_segred_stage_1_parloop_struct_235907.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_gtid_208752 =
        gtid_208752;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_mem_217654 =
        mem_217654.mem;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_mem_218175 =
        mem_218175.mem;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_gtid_223929 =
        gtid_223929;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_x_223930 = x_223930;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_x_224365 = x_224365;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_x_224366 = x_224366;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_defunc_0_m_fun_res_224368 =
        defunc_0_m_fun_res_224368;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_reduce_stage_1_tid_res_arr_mem_224744 =
        reduce_stage_1_tid_res_arr_mem_224744;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_reduce_stage_1_tid_res_arr_mem_224746 =
        reduce_stage_1_tid_res_arr_mem_224746;
    futhark_mc_segred_stage_1_parloop_struct_235907.free_reduce_stage_1_tid_res_arr_mem_224748 =
        reduce_stage_1_tid_res_arr_mem_224748;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235908_task;
    
    futhark_mc_segred_stage_1_parloop_235908_task.name =
        "futhark_mc_segred_stage_1_parloop_235908";
    futhark_mc_segred_stage_1_parloop_235908_task.fn =
        futhark_mc_segred_stage_1_parloop_235908;
    futhark_mc_segred_stage_1_parloop_235908_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235907;
    futhark_mc_segred_stage_1_parloop_235908_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235908_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235908_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235908_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235908_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235908_task);
    
    if (futhark_mc_segred_stage_1_parloop_235908_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235908_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235908_total_end -
                 futhark_mc_segred_stage_1_parloop_235908_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235908_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235908_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235908_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_224377 = 0.0;
        defunc_2_reduce_res_224378 = 0.0;
        defunc_2_reduce_res_224379 = 0.0;
    }
    
    double x_224754;
    double x_224755;
    double x_224757;
    double x_224758;
    double x_224760;
    double x_224761;
    
    for (int32_t i_224763 = 0; i_224763 < num_tasks_224743; i_224763++) {
        flat_tid_224664 = i_224763;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_224754 = defunc_2_reduce_res_224377;
            }
            // load next params
            {
                x_224755 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224744)[flat_tid_224664];
            }
            // red body
            {
                double defunc_1_op_res_224756 = x_224754 + x_224755;
                
                defunc_2_reduce_res_224377 = defunc_1_op_res_224756;
            }
            // load acc params
            {
                x_224757 = defunc_2_reduce_res_224378;
            }
            // load next params
            {
                x_224758 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224746)[flat_tid_224664];
            }
            // red body
            {
                double defunc_1_op_res_224759 = x_224757 + x_224758;
                
                defunc_2_reduce_res_224378 = defunc_1_op_res_224759;
            }
            // load acc params
            {
                x_224760 = defunc_2_reduce_res_224379;
            }
            // load next params
            {
                x_224761 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224748)[flat_tid_224664];
            }
            // red body
            {
                double defunc_1_op_res_224762 = x_224760 + x_224761;
                
                defunc_2_reduce_res_224379 = defunc_1_op_res_224762;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_224744);
        free(reduce_stage_1_tid_res_arr_mem_224746);
        free(reduce_stage_1_tid_res_arr_mem_224748);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235903_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235903_end -
                 futhark_mc_segred_task_235903_start;
        
        ctx->futhark_mc_segred_task_235903_runs[tid]++;
        ctx->futhark_mc_segred_task_235903_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235903_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235902->retval_defunc_2_reduce_res_224377 =
            defunc_2_reduce_res_224377;
        *futhark_mc_task_235902->retval_defunc_2_reduce_res_224378 =
            defunc_2_reduce_res_224378;
        *futhark_mc_task_235902->retval_defunc_2_reduce_res_224379 =
            defunc_2_reduce_res_224379;
    }
    return err;
}
struct futhark_mc_task_235909 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223929;
    int64_t free_x_223930;
    int64_t free_x_224365;
    double free_x_224366;
    double free_a11_224415;
    double free_b11_224417;
    double free_c11_224418;
    int64_t free_defunc_0_m_fun_res_224419;
    double *retval_defunc_2_reduce_res_224428;
    double *retval_defunc_2_reduce_res_224429;
};
struct futhark_mc_segred_stage_1_parloop_struct_235913 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_208752;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_223929;
    int64_t free_x_223930;
    int64_t free_x_224365;
    double free_x_224366;
    double free_a11_224415;
    double free_b11_224417;
    double free_c11_224418;
    int64_t free_defunc_0_m_fun_res_224419;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224765;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_224767;
};
static int futhark_mc_segred_stage_1_parloop_235914(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_224703,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235913
    *futhark_mc_segred_stage_1_parloop_struct_235913 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235913 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235913->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235914_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235914_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235913->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_235913->free_defunc_0_f_res_203721;
    int64_t gtid_208752 =
            futhark_mc_segred_stage_1_parloop_struct_235913->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235913->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235913->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235913->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223929 =
            futhark_mc_segred_stage_1_parloop_struct_235913->free_gtid_223929;
    int64_t x_223930 =
            futhark_mc_segred_stage_1_parloop_struct_235913->free_x_223930;
    int64_t x_224365 =
            futhark_mc_segred_stage_1_parloop_struct_235913->free_x_224365;
    double x_224366 =
           futhark_mc_segred_stage_1_parloop_struct_235913->free_x_224366;
    double a11_224415 =
           futhark_mc_segred_stage_1_parloop_struct_235913->free_a11_224415;
    double b11_224417 =
           futhark_mc_segred_stage_1_parloop_struct_235913->free_b11_224417;
    double c11_224418 =
           futhark_mc_segred_stage_1_parloop_struct_235913->free_c11_224418;
    int64_t defunc_0_m_fun_res_224419 =
            futhark_mc_segred_stage_1_parloop_struct_235913->free_defunc_0_m_fun_res_224419;
    struct memblock reduce_stage_1_tid_res_arr_mem_224765 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224765",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235913->free_reduce_stage_1_tid_res_arr_mem_224765,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_224767 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_224767",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235913->free_reduce_stage_1_tid_res_arr_mem_224767,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_224769 = start;
    double x_224705;
    double x_224706;
    double x_224708;
    double x_224709;
    double local_acc_224770 = 0.0;
    double local_acc_224771 = 0.0;
    
    for (; iter_224769 < end; iter_224769++) {
        int64_t gtid_224704 = iter_224769;
        bool cond_224711 = sle64(x_223930, gtid_224704);
        int64_t defunc_0_f_res_224712;
        
        if (cond_224711) {
            defunc_0_f_res_224712 = (int64_t) 0;
        } else {
            int64_t i_224713 = add64(x_224365, gtid_224704);
            int64_t defunc_0_add_arg_224714;
            
            defunc_0_add_arg_224714 = ((int64_t *) mem_217654.mem)[gtid_208752 *
                                                                   (defunc_0_f_res_203721 *
                                                                    n_p_203574) +
                                                                   gtid_223929 *
                                                                   defunc_0_f_res_203721 +
                                                                   i_224713];
            
            int64_t defunc_1_add_res_224715 = add64((int64_t) 1,
                                                    defunc_0_add_arg_224714);
            
            defunc_0_f_res_224712 = defunc_1_add_res_224715;
        }
        
        double defunc_0_f_res_224716;
        
        if (cond_224711) {
            defunc_0_f_res_224716 = 0.0;
        } else {
            int64_t i_224717 = add64(x_224365, gtid_224704);
            double defunc_0_add_arg_224718;
            
            defunc_0_add_arg_224718 = ((double *) mem_218175.mem)[gtid_208752 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_223929 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_224717];
            defunc_0_f_res_224716 = defunc_0_add_arg_224718;
        }
        
        int64_t binop_p_224719 = sub64(defunc_0_f_res_224712,
                                       defunc_0_m_fun_res_224419);
        double defunc_0_f_res_224720 = sitofp_i64_f64(binop_p_224719);
        double abs_res_224721 = fabs(defunc_0_f_res_224720);
        double tmp1_224722 = abs_res_224721 / x_224366;
        double x_224723 = tmp1_224722 * tmp1_224722;
        double y_224724 = tmp1_224722 * x_224723;
        double tmp2_224725 = 1.0 - y_224724;
        double x_224726 = tmp2_224725 * tmp2_224725;
        double tmp3_224727 = tmp2_224725 * x_224726;
        double tmp4_224728 = defunc_0_f_res_224716 * tmp3_224727;
        double defunc_1_f_res_224729 = defunc_0_f_res_224720 * tmp4_224728;
        double defunc_0_f_res_224730;
        
        if (cond_224711) {
            defunc_0_f_res_224730 = 0.0;
        } else {
            int64_t i_224731 = add64(x_224365, gtid_224704);
            double defunc_0_add_arg_224732;
            
            defunc_0_add_arg_224732 = ((double *) mem_218170.mem)[gtid_208752 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_223929 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_224731];
            defunc_0_f_res_224730 = defunc_0_add_arg_224732;
        }
        
        double x_224733 = a11_224415 * tmp4_224728;
        double y_224734 = b11_224417 * defunc_1_f_res_224729;
        double x_224735 = x_224733 + y_224734;
        double defunc_9_fit_fun_res_224736 = defunc_0_f_res_224730 * x_224735;
        double x_224737 = b11_224417 * tmp4_224728;
        double y_224738 = c11_224418 * defunc_1_f_res_224729;
        double x_224739 = x_224737 + y_224738;
        double defunc_9_slope_fun_res_224740 = defunc_0_f_res_224730 * x_224739;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_224705 = local_acc_224770;
        }
        // Load next params
        {
            x_224706 = defunc_9_fit_fun_res_224736;
        }
        // Red body
        {
            double defunc_1_op_res_224707 = x_224705 + x_224706;
            
            local_acc_224770 = defunc_1_op_res_224707;
        }
        // Load accum params
        {
            x_224708 = local_acc_224771;
        }
        // Load next params
        {
            x_224709 = defunc_9_slope_fun_res_224740;
        }
        // Red body
        {
            double defunc_1_op_res_224710 = x_224708 + x_224709;
            
            local_acc_224771 = defunc_1_op_res_224710;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_224765.mem)[flat_tid_224703] =
        local_acc_224770;
    ((double *) reduce_stage_1_tid_res_arr_mem_224767.mem)[flat_tid_224703] =
        local_acc_224771;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235914_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235914_end -
                 futhark_mc_segred_stage_1_parloop_235914_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235914_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235914_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235914_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235910(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224703 = tid;
    int num_tasks_224764 = info.nsubtasks;
    struct futhark_mc_task_235909 *futhark_mc_task_235909 =
                                  (struct futhark_mc_task_235909 *) args;
    struct futhark_context *ctx = futhark_mc_task_235909->ctx;
    uint64_t futhark_mc_segred_task_235910_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235910_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235909->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235909->free_defunc_0_f_res_203721;
    int64_t gtid_208752 = futhark_mc_task_235909->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235909->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235909->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235909->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223929 = futhark_mc_task_235909->free_gtid_223929;
    int64_t x_223930 = futhark_mc_task_235909->free_x_223930;
    int64_t x_224365 = futhark_mc_task_235909->free_x_224365;
    double x_224366 = futhark_mc_task_235909->free_x_224366;
    double a11_224415 = futhark_mc_task_235909->free_a11_224415;
    double b11_224417 = futhark_mc_task_235909->free_b11_224417;
    double c11_224418 = futhark_mc_task_235909->free_c11_224418;
    int64_t defunc_0_m_fun_res_224419 =
            futhark_mc_task_235909->free_defunc_0_m_fun_res_224419;
    double defunc_2_reduce_res_224428 =
           *futhark_mc_task_235909->retval_defunc_2_reduce_res_224428;
    double defunc_2_reduce_res_224429 =
           *futhark_mc_task_235909->retval_defunc_2_reduce_res_224429;
    size_t reduce_stage_1_tid_res_arr_mem_224765_cached_sizze_235911 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224765 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_224767_cached_sizze_235912 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_224767 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_224765_cached_sizze_235911 <
        (size_t) ((int64_t) 8 * num_tasks_224764)) {
        reduce_stage_1_tid_res_arr_mem_224765 =
            realloc(reduce_stage_1_tid_res_arr_mem_224765, (int64_t) 8 *
                    num_tasks_224764);
        reduce_stage_1_tid_res_arr_mem_224765_cached_sizze_235911 =
            (int64_t) 8 * num_tasks_224764;
    }
    if (reduce_stage_1_tid_res_arr_mem_224767_cached_sizze_235912 <
        (size_t) ((int64_t) 8 * num_tasks_224764)) {
        reduce_stage_1_tid_res_arr_mem_224767 =
            realloc(reduce_stage_1_tid_res_arr_mem_224767, (int64_t) 8 *
                    num_tasks_224764);
        reduce_stage_1_tid_res_arr_mem_224767_cached_sizze_235912 =
            (int64_t) 8 * num_tasks_224764;
    }
    
    int64_t iter_224769;
    struct futhark_mc_segred_stage_1_parloop_struct_235913
    futhark_mc_segred_stage_1_parloop_struct_235913;
    
    futhark_mc_segred_stage_1_parloop_struct_235913.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_gtid_208752 =
        gtid_208752;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_mem_217654 =
        mem_217654.mem;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_mem_218170 =
        mem_218170.mem;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_mem_218175 =
        mem_218175.mem;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_gtid_223929 =
        gtid_223929;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_x_223930 = x_223930;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_x_224365 = x_224365;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_x_224366 = x_224366;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_a11_224415 =
        a11_224415;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_b11_224417 =
        b11_224417;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_c11_224418 =
        c11_224418;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_defunc_0_m_fun_res_224419 =
        defunc_0_m_fun_res_224419;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_reduce_stage_1_tid_res_arr_mem_224765 =
        reduce_stage_1_tid_res_arr_mem_224765;
    futhark_mc_segred_stage_1_parloop_struct_235913.free_reduce_stage_1_tid_res_arr_mem_224767 =
        reduce_stage_1_tid_res_arr_mem_224767;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235914_task;
    
    futhark_mc_segred_stage_1_parloop_235914_task.name =
        "futhark_mc_segred_stage_1_parloop_235914";
    futhark_mc_segred_stage_1_parloop_235914_task.fn =
        futhark_mc_segred_stage_1_parloop_235914;
    futhark_mc_segred_stage_1_parloop_235914_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235913;
    futhark_mc_segred_stage_1_parloop_235914_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235914_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235914_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235914_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235914_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235914_task);
    
    if (futhark_mc_segred_stage_1_parloop_235914_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235914_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235914_total_end -
                 futhark_mc_segred_stage_1_parloop_235914_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235914_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235914_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235914_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_224428 = 0.0;
        defunc_2_reduce_res_224429 = 0.0;
    }
    
    double x_224772;
    double x_224773;
    double x_224775;
    double x_224776;
    
    for (int32_t i_224778 = 0; i_224778 < num_tasks_224764; i_224778++) {
        flat_tid_224703 = i_224778;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_224772 = defunc_2_reduce_res_224428;
            }
            // load next params
            {
                x_224773 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224765)[flat_tid_224703];
            }
            // red body
            {
                double defunc_1_op_res_224774 = x_224772 + x_224773;
                
                defunc_2_reduce_res_224428 = defunc_1_op_res_224774;
            }
            // load acc params
            {
                x_224775 = defunc_2_reduce_res_224429;
            }
            // load next params
            {
                x_224776 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_224767)[flat_tid_224703];
            }
            // red body
            {
                double defunc_1_op_res_224777 = x_224775 + x_224776;
                
                defunc_2_reduce_res_224429 = defunc_1_op_res_224777;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_224765);
        free(reduce_stage_1_tid_res_arr_mem_224767);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235910_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235910_end -
                 futhark_mc_segred_task_235910_start;
        
        ctx->futhark_mc_segred_task_235910_runs[tid]++;
        ctx->futhark_mc_segred_task_235910_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235910_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235909->retval_defunc_2_reduce_res_224428 =
            defunc_2_reduce_res_224428;
        *futhark_mc_task_235909->retval_defunc_2_reduce_res_224429 =
            defunc_2_reduce_res_224429;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235901(void *args, int64_t start,
                                            int64_t end, int flat_tid_224363,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235900
    *futhark_mc_segmap_parloop_struct_235900 =
    (struct futhark_mc_segmap_parloop_struct_235900 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235900->ctx;
    uint64_t futhark_mc_segmap_parloop_235901_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235901_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235900->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235900->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235900->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235900->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235900->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235900->free_s_n_m_203726;
    int64_t gtid_208752 =
            futhark_mc_segmap_parloop_struct_235900->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235900->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235900->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235900->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235900->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235900->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223929 =
            futhark_mc_segmap_parloop_struct_235900->free_gtid_223929;
    int64_t x_223930 = futhark_mc_segmap_parloop_struct_235900->free_x_223930;
    struct memblock mem_223931 = {.desc ="mem_223931", .mem =
                                  futhark_mc_segmap_parloop_struct_235900->free_mem_223931,
                                  .size =0, .references =NULL};
    struct memblock mem_223932 = {.desc ="mem_223932", .mem =
                                  futhark_mc_segmap_parloop_struct_235900->free_mem_223932,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_224655 = start;
    
    for (; iter_224655 < end; iter_224655++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224741 = s_n_m_203726;
        int64_t gtid_224364 = iter_224655;
        int64_t remnant_224742 = iter_224655 - gtid_224364;
        int64_t x_224365;
        
        x_224365 = ((int64_t *) mem_217828.mem)[gtid_208752 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_223929 * s_n_m_203726 +
                                                gtid_224364];
        
        double x_224366;
        
        x_224366 = ((double *) mem_217833.mem)[gtid_208752 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_223929 * s_n_m_203726 +
                                               gtid_224364];
        
        bool cond_224367 = gtid_224364 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_224368;
        
        if (cond_224367) {
            defunc_0_m_fun_res_224368 = (int64_t) 0;
        } else {
            int64_t y_224656 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_224657 = gtid_224364 == y_224656;
            int64_t defunc_0_m_fun_res_f_res_224658;
            
            if (cond_224657) {
                int64_t defunc_0_m_fun_res_f_res_t_res_224659 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_224658 =
                    defunc_0_m_fun_res_f_res_t_res_224659;
            } else {
                int64_t x_224660 = sub64(gtid_224364, (int64_t) 1);
                int64_t x_224661 = mul64(jump_s_203581, x_224660);
                int64_t min_arg_224662 = add64((int64_t) 1, x_224661);
                int64_t min_res_224663 = smin64(defunc_0_f_res_203721,
                                                min_arg_224662);
                
                defunc_0_m_fun_res_f_res_224658 = min_res_224663;
            }
            defunc_0_m_fun_res_224368 = defunc_0_m_fun_res_f_res_224658;
        }
        
        double defunc_2_reduce_res_224377;
        double defunc_2_reduce_res_224378;
        double defunc_2_reduce_res_224379;
        int64_t flat_tid_224664 = (int64_t) 0;
        int32_t num_tasks_224743;
        
        defunc_2_reduce_res_224377 = 0.0;
        defunc_2_reduce_res_224378 = 0.0;
        defunc_2_reduce_res_224379 = 0.0;
        
        struct futhark_mc_task_235902 futhark_mc_task_235902;
        
        futhark_mc_task_235902.ctx = ctx;
        futhark_mc_task_235902.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235902.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235902.free_gtid_208752 = gtid_208752;
        futhark_mc_task_235902.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235902.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235902.free_gtid_223929 = gtid_223929;
        futhark_mc_task_235902.free_x_223930 = x_223930;
        futhark_mc_task_235902.free_x_224365 = x_224365;
        futhark_mc_task_235902.free_x_224366 = x_224366;
        futhark_mc_task_235902.free_defunc_0_m_fun_res_224368 =
            defunc_0_m_fun_res_224368;
        futhark_mc_task_235902.retval_defunc_2_reduce_res_224377 =
            &defunc_2_reduce_res_224377;
        futhark_mc_task_235902.retval_defunc_2_reduce_res_224378 =
            &defunc_2_reduce_res_224378;
        futhark_mc_task_235902.retval_defunc_2_reduce_res_224379 =
            &defunc_2_reduce_res_224379;
        
        struct scheduler_segop futhark_mc_task_235902_task;
        
        futhark_mc_task_235902_task.args = &futhark_mc_task_235902;
        futhark_mc_task_235902_task.top_level_fn =
            futhark_mc_segred_task_235903;
        futhark_mc_task_235902_task.name = "futhark_mc_segred_task_235903";
        futhark_mc_task_235902_task.iterations = q_s_203575;
        futhark_mc_task_235902_task.task_time =
            &ctx->futhark_mc_segred_task_235903_total_time;
        futhark_mc_task_235902_task.task_iter =
            &ctx->futhark_mc_segred_task_235903_total_iter;
        futhark_mc_task_235902_task.sched = STATIC;
        futhark_mc_task_235902_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235903_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235902_task);
        
        if (futhark_mc_segred_task_235903_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_224411 = defunc_2_reduce_res_224377 *
               defunc_2_reduce_res_224379;
        double y_224412 = defunc_2_reduce_res_224378 *
               defunc_2_reduce_res_224378;
        double y_224413 = x_224411 - y_224412;
        double det1_224414 = 1.0 / y_224413;
        double a11_224415 = defunc_2_reduce_res_224379 * det1_224414;
        double x_224416 = 0.0 - defunc_2_reduce_res_224378;
        double b11_224417 = det1_224414 * x_224416;
        double c11_224418 = defunc_2_reduce_res_224377 * det1_224414;
        int64_t defunc_0_m_fun_res_224419;
        
        if (cond_224367) {
            defunc_0_m_fun_res_224419 = (int64_t) 0;
        } else {
            int64_t y_224695 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_224696 = gtid_224364 == y_224695;
            int64_t defunc_0_m_fun_res_f_res_224697;
            
            if (cond_224696) {
                int64_t defunc_0_m_fun_res_f_res_t_res_224698 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_224697 =
                    defunc_0_m_fun_res_f_res_t_res_224698;
            } else {
                int64_t x_224699 = sub64(gtid_224364, (int64_t) 1);
                int64_t x_224700 = mul64(jump_s_203581, x_224699);
                int64_t min_arg_224701 = add64((int64_t) 1, x_224700);
                int64_t min_res_224702 = smin64(defunc_0_f_res_203721,
                                                min_arg_224701);
                
                defunc_0_m_fun_res_f_res_224697 = min_res_224702;
            }
            defunc_0_m_fun_res_224419 = defunc_0_m_fun_res_f_res_224697;
        }
        
        double defunc_2_reduce_res_224428;
        double defunc_2_reduce_res_224429;
        int64_t flat_tid_224703 = (int64_t) 0;
        int32_t num_tasks_224764;
        
        defunc_2_reduce_res_224428 = 0.0;
        defunc_2_reduce_res_224429 = 0.0;
        
        struct futhark_mc_task_235909 futhark_mc_task_235909;
        
        futhark_mc_task_235909.ctx = ctx;
        futhark_mc_task_235909.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235909.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235909.free_gtid_208752 = gtid_208752;
        futhark_mc_task_235909.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235909.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235909.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235909.free_gtid_223929 = gtid_223929;
        futhark_mc_task_235909.free_x_223930 = x_223930;
        futhark_mc_task_235909.free_x_224365 = x_224365;
        futhark_mc_task_235909.free_x_224366 = x_224366;
        futhark_mc_task_235909.free_a11_224415 = a11_224415;
        futhark_mc_task_235909.free_b11_224417 = b11_224417;
        futhark_mc_task_235909.free_c11_224418 = c11_224418;
        futhark_mc_task_235909.free_defunc_0_m_fun_res_224419 =
            defunc_0_m_fun_res_224419;
        futhark_mc_task_235909.retval_defunc_2_reduce_res_224428 =
            &defunc_2_reduce_res_224428;
        futhark_mc_task_235909.retval_defunc_2_reduce_res_224429 =
            &defunc_2_reduce_res_224429;
        
        struct scheduler_segop futhark_mc_task_235909_task;
        
        futhark_mc_task_235909_task.args = &futhark_mc_task_235909;
        futhark_mc_task_235909_task.top_level_fn =
            futhark_mc_segred_task_235910;
        futhark_mc_task_235909_task.name = "futhark_mc_segred_task_235910";
        futhark_mc_task_235909_task.iterations = q_s_203575;
        futhark_mc_task_235909_task.task_time =
            &ctx->futhark_mc_segred_task_235910_total_time;
        futhark_mc_task_235909_task.task_iter =
            &ctx->futhark_mc_segred_task_235910_total_iter;
        futhark_mc_task_235909_task.sched = STATIC;
        futhark_mc_task_235909_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235910_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235909_task);
        
        if (futhark_mc_segred_task_235910_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_223931.mem)[gtid_224364] = defunc_2_reduce_res_224428;
        ((double *) mem_223932.mem)[gtid_224364] = defunc_2_reduce_res_224429;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235901_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235901_end -
                 futhark_mc_segmap_parloop_235901_start;
        
        ctx->futhark_mc_segmap_parloop_235901_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235901_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235901_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235899(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224363 = tid;
    int num_tasks_224568 = info.nsubtasks;
    struct futhark_mc_task_235895 *futhark_mc_task_235895 =
                                  (struct futhark_mc_task_235895 *) args;
    struct futhark_context *ctx = futhark_mc_task_235895->ctx;
    uint64_t futhark_mc_segmap_nested_task_235899_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235899_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235895->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235895->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235895->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235895->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235895->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235895->free_s_n_m_203726;
    int64_t gtid_208752 = futhark_mc_task_235895->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235895->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235895->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235895->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235895->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235895->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_223929 = futhark_mc_task_235895->free_gtid_223929;
    int64_t x_223930 = futhark_mc_task_235895->free_x_223930;
    struct memblock mem_223931 = {.desc ="mem_223931", .mem =
                                  futhark_mc_task_235895->free_mem_223931,
                                  .size =0, .references =NULL};
    struct memblock mem_223932 = {.desc ="mem_223932", .mem =
                                  futhark_mc_task_235895->free_mem_223932,
                                  .size =0, .references =NULL};
    int64_t iter_224655;
    struct futhark_mc_segmap_parloop_struct_235900
    futhark_mc_segmap_parloop_struct_235900;
    
    futhark_mc_segmap_parloop_struct_235900.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235900.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235900.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235900.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235900.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235900.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235900.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235900.free_gtid_208752 = gtid_208752;
    futhark_mc_segmap_parloop_struct_235900.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235900.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235900.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235900.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235900.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235900.free_gtid_223929 = gtid_223929;
    futhark_mc_segmap_parloop_struct_235900.free_x_223930 = x_223930;
    futhark_mc_segmap_parloop_struct_235900.free_mem_223931 = mem_223931.mem;
    futhark_mc_segmap_parloop_struct_235900.free_mem_223932 = mem_223932.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235901_task;
    
    futhark_mc_segmap_parloop_235901_task.name =
        "futhark_mc_segmap_parloop_235901";
    futhark_mc_segmap_parloop_235901_task.fn = futhark_mc_segmap_parloop_235901;
    futhark_mc_segmap_parloop_235901_task.args =
        &futhark_mc_segmap_parloop_struct_235900;
    futhark_mc_segmap_parloop_235901_task.iterations = iterations;
    futhark_mc_segmap_parloop_235901_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235901_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235901_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235901_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235901_task);
    
    if (futhark_mc_segmap_parloop_235901_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235901_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235901_total_end -
                 futhark_mc_segmap_parloop_235901_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235901_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235901_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235901_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235899_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235899_end -
                 futhark_mc_segmap_nested_task_235899_start;
        
        ctx->futhark_mc_segmap_nested_task_235899_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235899_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235899_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235892(void *args, int64_t start,
                                            int64_t end, int flat_tid_223928,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235891
    *futhark_mc_segmap_parloop_struct_235891 =
    (struct futhark_mc_segmap_parloop_struct_235891 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235891->ctx;
    uint64_t futhark_mc_segmap_parloop_235892_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235892_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235891->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235891->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235891->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235891->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235891->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235891->free_s_n_m_203726;
    int64_t gtid_208752 =
            futhark_mc_segmap_parloop_struct_235891->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235891->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235891->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235891->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235891->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235891->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235891->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235891->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218291 = {.desc ="mem_218291", .mem =
                                  futhark_mc_segmap_parloop_struct_235891->free_mem_218291,
                                  .size =0, .references =NULL};
    struct memblock mem_218295 = {.desc ="mem_218295", .mem =
                                  futhark_mc_segmap_parloop_struct_235891->free_mem_218295,
                                  .size =0, .references =NULL};
    size_t mem_223931_cached_sizze_235893 = 0;
    unsigned char *mem_223931 = NULL;
    size_t mem_223932_cached_sizze_235894 = 0;
    unsigned char *mem_223932 = NULL;
    int64_t iterations = end - start;
    int64_t iter_224362 = start;
    
    if (mem_223931_cached_sizze_235893 < (size_t) bytes_217663) {
        mem_223931 = realloc(mem_223931, bytes_217663);
        mem_223931_cached_sizze_235893 = bytes_217663;
    }
    if (mem_223932_cached_sizze_235894 < (size_t) bytes_217663) {
        mem_223932 = realloc(mem_223932, bytes_217663);
        mem_223932_cached_sizze_235894 = bytes_217663;
    }
    for (; iter_224362 < end; iter_224362++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224566 = n_p_203574;
        int64_t gtid_223929 = iter_224362;
        int64_t remnant_224567 = iter_224362 - gtid_223929;
        int64_t x_223930;
        
        x_223930 = ((int64_t *) mem_217658.mem)[gtid_208752 * n_p_203574 +
                                                gtid_223929];
        
        int64_t flat_tid_224468 = (int64_t) 0;
        int32_t num_tasks_224568;
        int64_t flat_tid_224363 = (int64_t) 0;
        struct futhark_mc_task_235895 futhark_mc_task_235895;
        
        futhark_mc_task_235895.ctx = ctx;
        futhark_mc_task_235895.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235895.free_q_s_203575 = q_s_203575;
        futhark_mc_task_235895.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235895.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235895.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235895.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235895.free_gtid_208752 = gtid_208752;
        futhark_mc_task_235895.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235895.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_235895.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_235895.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235895.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235895.free_gtid_223929 = gtid_223929;
        futhark_mc_task_235895.free_x_223930 = x_223930;
        futhark_mc_task_235895.free_mem_223931 = mem_223931;
        futhark_mc_task_235895.free_mem_223932 = mem_223932;
        
        struct scheduler_segop futhark_mc_task_235895_task;
        
        futhark_mc_task_235895_task.args = &futhark_mc_task_235895;
        futhark_mc_task_235895_task.top_level_fn =
            futhark_mc_segmap_task_235896;
        futhark_mc_task_235895_task.name = "futhark_mc_segmap_task_235896";
        futhark_mc_task_235895_task.iterations = s_n_m_203726;
        futhark_mc_task_235895_task.task_time =
            &ctx->futhark_mc_segmap_task_235896_total_time;
        futhark_mc_task_235895_task.task_iter =
            &ctx->futhark_mc_segmap_task_235896_total_iter;
        futhark_mc_task_235895_task.sched = STATIC;
        futhark_mc_task_235895_task.nested_fn =
            futhark_mc_segmap_nested_task_235899;
        
        int futhark_mc_segmap_task_235896_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235895_task);
        
        if (futhark_mc_segmap_task_235896_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218291.mem + gtid_223929 * s_n_m_203726 * (int64_t) 8,
                    mem_223931 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218295.mem + gtid_223929 * s_n_m_203726 * (int64_t) 8,
                    mem_223932 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_223931);
    free(mem_223932);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235892_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235892_end -
                 futhark_mc_segmap_parloop_235892_start;
        
        ctx->futhark_mc_segmap_parloop_235892_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235892_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235892_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235890(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_223928 = tid;
    int num_tasks_224250 = info.nsubtasks;
    struct futhark_mc_task_235884 *futhark_mc_task_235884 =
                                  (struct futhark_mc_task_235884 *) args;
    struct futhark_context *ctx = futhark_mc_task_235884->ctx;
    uint64_t futhark_mc_segmap_nested_task_235890_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235890_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235884->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235884->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235884->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235884->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235884->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235884->free_s_n_m_203726;
    int64_t gtid_208752 = futhark_mc_task_235884->free_gtid_208752;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235884->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235884->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235884->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235884->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235884->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235884->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235884->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218291 = {.desc ="mem_218291", .mem =
                                  futhark_mc_task_235884->free_mem_218291,
                                  .size =0, .references =NULL};
    struct memblock mem_218295 = {.desc ="mem_218295", .mem =
                                  futhark_mc_task_235884->free_mem_218295,
                                  .size =0, .references =NULL};
    int64_t iter_224362;
    struct futhark_mc_segmap_parloop_struct_235891
    futhark_mc_segmap_parloop_struct_235891;
    
    futhark_mc_segmap_parloop_struct_235891.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235891.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235891.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235891.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235891.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235891.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235891.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235891.free_gtid_208752 = gtid_208752;
    futhark_mc_segmap_parloop_struct_235891.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235891.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235891.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235891.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235891.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235891.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235891.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235891.free_mem_218291 = mem_218291.mem;
    futhark_mc_segmap_parloop_struct_235891.free_mem_218295 = mem_218295.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235892_task;
    
    futhark_mc_segmap_parloop_235892_task.name =
        "futhark_mc_segmap_parloop_235892";
    futhark_mc_segmap_parloop_235892_task.fn = futhark_mc_segmap_parloop_235892;
    futhark_mc_segmap_parloop_235892_task.args =
        &futhark_mc_segmap_parloop_struct_235891;
    futhark_mc_segmap_parloop_235892_task.iterations = iterations;
    futhark_mc_segmap_parloop_235892_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235892_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235892_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235892_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235892_task);
    
    if (futhark_mc_segmap_parloop_235892_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235892_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235892_total_end -
                 futhark_mc_segmap_parloop_235892_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235892_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235892_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235892_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235890_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235890_end -
                 futhark_mc_segmap_nested_task_235890_start;
        
        ctx->futhark_mc_segmap_nested_task_235890_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235890_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235890_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235881(void *args, int64_t start,
                                            int64_t end, int flat_tid_208751,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235880
    *futhark_mc_segmap_parloop_struct_235880 =
    (struct futhark_mc_segmap_parloop_struct_235880 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235880->ctx;
    uint64_t futhark_mc_segmap_parloop_235881_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235881_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235880->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235880->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235880->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235880->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235880->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235880->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235880->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235880->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235880->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235880->free_bytes_217663;
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235880->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235880->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235880->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235880->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235880->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218388 = {.desc ="mem_218388", .mem =
                                  futhark_mc_segmap_parloop_struct_235880->free_mem_218388,
                                  .size =0, .references =NULL};
    struct memblock mem_218393 = {.desc ="mem_218393", .mem =
                                  futhark_mc_segmap_parloop_struct_235880->free_mem_218393,
                                  .size =0, .references =NULL};
    size_t mem_218291_cached_sizze_235882 = 0;
    unsigned char *mem_218291 = NULL;
    size_t mem_218295_cached_sizze_235883 = 0;
    unsigned char *mem_218295 = NULL;
    int64_t iterations = end - start;
    int64_t iter_223927 = start;
    
    if (mem_218291_cached_sizze_235882 < (size_t) bytes_217715) {
        mem_218291 = realloc(mem_218291, bytes_217715);
        mem_218291_cached_sizze_235882 = bytes_217715;
    }
    if (mem_218295_cached_sizze_235883 < (size_t) bytes_217715) {
        mem_218295 = realloc(mem_218295, bytes_217715);
        mem_218295_cached_sizze_235883 = bytes_217715;
    }
    for (; iter_223927 < end; iter_223927++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224248 = partition_sizze_203667;
        int64_t gtid_208752 = iter_223927;
        int64_t remnant_224249 = iter_223927 - gtid_208752;
        int64_t flat_tid_224138 = (int64_t) 0;
        int32_t num_tasks_224250;
        int64_t flat_tid_223928 = (int64_t) 0;
        struct futhark_mc_task_235884 futhark_mc_task_235884;
        
        futhark_mc_task_235884.ctx = ctx;
        futhark_mc_task_235884.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235884.free_q_s_203575 = q_s_203575;
        futhark_mc_task_235884.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235884.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235884.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235884.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235884.free_gtid_208752 = gtid_208752;
        futhark_mc_task_235884.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235884.free_mem_217658 = mem_217658.mem;
        futhark_mc_task_235884.free_bytes_217663 = bytes_217663;
        futhark_mc_task_235884.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_235884.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_235884.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235884.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235884.free_mem_218291 = mem_218291;
        futhark_mc_task_235884.free_mem_218295 = mem_218295;
        
        struct scheduler_segop futhark_mc_task_235884_task;
        
        futhark_mc_task_235884_task.args = &futhark_mc_task_235884;
        futhark_mc_task_235884_task.top_level_fn =
            futhark_mc_segmap_task_235885;
        futhark_mc_task_235884_task.name = "futhark_mc_segmap_task_235885";
        futhark_mc_task_235884_task.iterations = n_p_203574;
        futhark_mc_task_235884_task.task_time =
            &ctx->futhark_mc_segmap_task_235885_total_time;
        futhark_mc_task_235884_task.task_iter =
            &ctx->futhark_mc_segmap_task_235885_total_iter;
        futhark_mc_task_235884_task.sched = STATIC;
        futhark_mc_task_235884_task.nested_fn =
            futhark_mc_segmap_nested_task_235890;
        
        int futhark_mc_segmap_task_235885_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235884_task);
        
        if (futhark_mc_segmap_task_235885_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218388.mem + gtid_208752 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218291 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218393.mem + gtid_208752 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218295 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218291);
    free(mem_218295);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235881_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235881_end -
                 futhark_mc_segmap_parloop_235881_start;
        
        ctx->futhark_mc_segmap_parloop_235881_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235881_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235881_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235879(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_208751 = tid;
    int num_tasks_223807 = info.nsubtasks;
    struct futhark_mc_task_235873 *futhark_mc_task_235873 =
                                  (struct futhark_mc_task_235873 *) args;
    struct futhark_context *ctx = futhark_mc_task_235873->ctx;
    uint64_t futhark_mc_segmap_nested_task_235879_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235879_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235873->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235873->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235873->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235873->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235873->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235873->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235873->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235873->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235873->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235873->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235873->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235873->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235873->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235873->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235873->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218388 = {.desc ="mem_218388", .mem =
                                  futhark_mc_task_235873->free_mem_218388,
                                  .size =0, .references =NULL};
    struct memblock mem_218393 = {.desc ="mem_218393", .mem =
                                  futhark_mc_task_235873->free_mem_218393,
                                  .size =0, .references =NULL};
    int64_t iter_223927;
    struct futhark_mc_segmap_parloop_struct_235880
    futhark_mc_segmap_parloop_struct_235880;
    
    futhark_mc_segmap_parloop_struct_235880.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235880.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235880.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235880.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235880.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235880.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235880.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235880.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235880.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235880.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235880.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235880.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235880.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235880.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235880.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235880.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235880.free_mem_218388 = mem_218388.mem;
    futhark_mc_segmap_parloop_struct_235880.free_mem_218393 = mem_218393.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235881_task;
    
    futhark_mc_segmap_parloop_235881_task.name =
        "futhark_mc_segmap_parloop_235881";
    futhark_mc_segmap_parloop_235881_task.fn = futhark_mc_segmap_parloop_235881;
    futhark_mc_segmap_parloop_235881_task.args =
        &futhark_mc_segmap_parloop_struct_235880;
    futhark_mc_segmap_parloop_235881_task.iterations = iterations;
    futhark_mc_segmap_parloop_235881_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235881_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235881_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235881_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235881_task);
    
    if (futhark_mc_segmap_parloop_235881_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235881_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235881_total_end -
                 futhark_mc_segmap_parloop_235881_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235881_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235881_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235881_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235879_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235879_end -
                 futhark_mc_segmap_nested_task_235879_start;
        
        ctx->futhark_mc_segmap_nested_task_235879_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235879_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235879_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235915 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218530;
    unsigned char *free_mem_218535;
};
struct futhark_mc_segmap_parloop_struct_235917 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218530;
    unsigned char *free_mem_218535;
};
static int futhark_mc_segmap_parloop_235918(void *args, int64_t start,
                                            int64_t end, int flat_tid_209095,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235917
    *futhark_mc_segmap_parloop_struct_235917 =
    (struct futhark_mc_segmap_parloop_struct_235917 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235917->ctx;
    uint64_t futhark_mc_segmap_parloop_235918_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235918_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235917->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235917->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235917->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235917->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235917->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235917->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235917->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235917->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235917->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235917->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235917->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235917->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235917->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235917->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218530 = {.desc ="mem_218530", .mem =
                                  futhark_mc_segmap_parloop_struct_235917->free_mem_218530,
                                  .size =0, .references =NULL};
    struct memblock mem_218535 = {.desc ="mem_218535", .mem =
                                  futhark_mc_segmap_parloop_struct_235917->free_mem_218535,
                                  .size =0, .references =NULL};
    size_t mem_218441_cached_sizze_235919 = 0;
    unsigned char *mem_218441 = NULL;
    size_t mem_218445_cached_sizze_235920 = 0;
    unsigned char *mem_218445 = NULL;
    int64_t iterations = end - start;
    int64_t iter_224780 = start;
    
    if (mem_218441_cached_sizze_235919 < (size_t) bytes_217715) {
        mem_218441 = realloc(mem_218441, bytes_217715);
        mem_218441_cached_sizze_235919 = bytes_217715;
    }
    if (mem_218445_cached_sizze_235920 < (size_t) bytes_217715) {
        mem_218445 = realloc(mem_218445, bytes_217715);
        mem_218445_cached_sizze_235920 = bytes_217715;
    }
    for (; iter_224780 < end; iter_224780++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_224918 = partition_sizze_203667;
        int64_t gtid_209096 = iter_224780;
        int64_t remnant_224919 = iter_224780 - gtid_209096;
        
        for (int64_t i_224781 = 0; i_224781 < n_p_203574; i_224781++) {
            int64_t x_224784;
            
            x_224784 = ((int64_t *) mem_217658.mem)[gtid_209096 * n_p_203574 +
                                                    i_224781];
            for (int64_t i_224787 = 0; i_224787 < s_n_m_203726; i_224787++) {
                int64_t x_224790;
                
                x_224790 = ((int64_t *) mem_217828.mem)[gtid_209096 *
                                                        (s_n_m_203726 *
                                                         n_p_203574) +
                                                        i_224781 *
                                                        s_n_m_203726 +
                                                        i_224787];
                
                double x_224791;
                
                x_224791 = ((double *) mem_217833.mem)[gtid_209096 *
                                                       (s_n_m_203726 *
                                                        n_p_203574) + i_224781 *
                                                       s_n_m_203726 + i_224787];
                
                bool cond_224792 = i_224787 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_224793;
                
                if (cond_224792) {
                    defunc_0_m_fun_res_224793 = (int64_t) 0;
                } else {
                    int64_t y_224794 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_224795 = i_224787 == y_224794;
                    int64_t defunc_0_m_fun_res_f_res_224796;
                    
                    if (cond_224795) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_224797 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_224796 =
                            defunc_0_m_fun_res_f_res_t_res_224797;
                    } else {
                        int64_t x_224798 = sub64(i_224787, (int64_t) 1);
                        int64_t x_224799 = mul64(jump_s_203581, x_224798);
                        int64_t min_arg_224800 = add64((int64_t) 1, x_224799);
                        int64_t min_res_224801 = smin64(defunc_0_f_res_203721,
                                                        min_arg_224800);
                        
                        defunc_0_m_fun_res_f_res_224796 = min_res_224801;
                    }
                    defunc_0_m_fun_res_224793 = defunc_0_m_fun_res_f_res_224796;
                }
                
                double defunc_2_reduce_res_224802;
                double defunc_2_reduce_res_224803;
                double defunc_2_reduce_res_224804;
                double defunc_2_reduce_res_224805;
                double defunc_2_reduce_res_224806;
                double redout_224808;
                double redout_224809;
                double redout_224810;
                double redout_224811;
                double redout_224812;
                
                redout_224808 = 0.0;
                redout_224809 = 0.0;
                redout_224810 = 0.0;
                redout_224811 = 0.0;
                redout_224812 = 0.0;
                for (int64_t i_224807 = 0; i_224807 < q_s_203575; i_224807++) {
                    bool cond_224813 = sle64(x_224784, i_224807);
                    int64_t defunc_0_f_res_224814;
                    
                    if (cond_224813) {
                        defunc_0_f_res_224814 = (int64_t) 0;
                    } else {
                        int64_t i_224815 = add64(x_224790, i_224807);
                        int64_t defunc_0_add_arg_224816;
                        
                        defunc_0_add_arg_224816 =
                            ((int64_t *) mem_217654.mem)[gtid_209096 *
                                                         (defunc_0_f_res_203721 *
                                                          n_p_203574) +
                                                         i_224781 *
                                                         defunc_0_f_res_203721 +
                                                         i_224815];
                        
                        int64_t defunc_1_add_res_224817 = add64((int64_t) 1,
                                                                defunc_0_add_arg_224816);
                        
                        defunc_0_f_res_224814 = defunc_1_add_res_224817;
                    }
                    
                    double defunc_0_f_res_224818;
                    
                    if (cond_224813) {
                        defunc_0_f_res_224818 = 0.0;
                    } else {
                        int64_t i_224819 = add64(x_224790, i_224807);
                        double defunc_0_add_arg_224820;
                        
                        defunc_0_add_arg_224820 =
                            ((double *) mem_218175.mem)[gtid_209096 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_224781 *
                                                        defunc_0_f_res_203721 +
                                                        i_224819];
                        defunc_0_f_res_224818 = defunc_0_add_arg_224820;
                    }
                    
                    int64_t binop_p_224821 = sub64(defunc_0_f_res_224814,
                                                   defunc_0_m_fun_res_224793);
                    double defunc_0_f_res_224822 =
                           sitofp_i64_f64(binop_p_224821);
                    double abs_res_224823 = fabs(defunc_0_f_res_224822);
                    double tmp1_224824 = abs_res_224823 / x_224791;
                    double x_224825 = tmp1_224824 * tmp1_224824;
                    double y_224826 = tmp1_224824 * x_224825;
                    double tmp2_224827 = 1.0 - y_224826;
                    double x_224828 = tmp2_224827 * tmp2_224827;
                    double tmp3_224829 = tmp2_224827 * x_224828;
                    double w_j_224830 = defunc_0_f_res_224818 * tmp3_224829;
                    double xw_j_224831 = defunc_0_f_res_224822 * w_j_224830;
                    double x2w_j_224832 = defunc_0_f_res_224822 * xw_j_224831;
                    double x3w_j_224833 = defunc_0_f_res_224822 * x2w_j_224832;
                    double x4w_j_224834 = defunc_0_f_res_224822 * x3w_j_224833;
                    double defunc_1_op_res_224835 = w_j_224830 + redout_224808;
                    double defunc_1_op_res_224836 = xw_j_224831 + redout_224809;
                    double defunc_1_op_res_224837 = x2w_j_224832 +
                           redout_224810;
                    double defunc_1_op_res_224838 = x3w_j_224833 +
                           redout_224811;
                    double defunc_1_op_res_224839 = x4w_j_224834 +
                           redout_224812;
                    double redout_tmp_224924 = defunc_1_op_res_224835;
                    double redout_tmp_224925 = defunc_1_op_res_224836;
                    double redout_tmp_224926 = defunc_1_op_res_224837;
                    double redout_tmp_224927 = defunc_1_op_res_224838;
                    double redout_tmp_224928 = defunc_1_op_res_224839;
                    
                    redout_224808 = redout_tmp_224924;
                    redout_224809 = redout_tmp_224925;
                    redout_224810 = redout_tmp_224926;
                    redout_224811 = redout_tmp_224927;
                    redout_224812 = redout_tmp_224928;
                }
                defunc_2_reduce_res_224802 = redout_224808;
                defunc_2_reduce_res_224803 = redout_224809;
                defunc_2_reduce_res_224804 = redout_224810;
                defunc_2_reduce_res_224805 = redout_224811;
                defunc_2_reduce_res_224806 = redout_224812;
                
                double x_224840 = defunc_2_reduce_res_224804 *
                       defunc_2_reduce_res_224806;
                double y_224841 = defunc_2_reduce_res_224805 *
                       defunc_2_reduce_res_224805;
                double a12_224842 = x_224840 - y_224841;
                double x_224843 = defunc_2_reduce_res_224804 *
                       defunc_2_reduce_res_224805;
                double y_224844 = defunc_2_reduce_res_224803 *
                       defunc_2_reduce_res_224806;
                double b12_224845 = x_224843 - y_224844;
                double x_224846 = defunc_2_reduce_res_224803 *
                       defunc_2_reduce_res_224805;
                double y_224847 = defunc_2_reduce_res_224804 *
                       defunc_2_reduce_res_224804;
                double c12_224848 = x_224846 - y_224847;
                double x_224849 = defunc_2_reduce_res_224802 *
                       defunc_2_reduce_res_224806;
                double b2_224850 = x_224849 - y_224847;
                double x_224851 = defunc_2_reduce_res_224803 *
                       defunc_2_reduce_res_224804;
                double y_224852 = defunc_2_reduce_res_224802 *
                       defunc_2_reduce_res_224805;
                double c2_224853 = x_224851 - y_224852;
                double x_224854 = defunc_2_reduce_res_224802 * a12_224842;
                double y_224855 = defunc_2_reduce_res_224803 * b12_224845;
                double x_224856 = x_224854 + y_224855;
                double y_224857 = defunc_2_reduce_res_224804 * c12_224848;
                double y_224858 = x_224856 + y_224857;
                double det_224859 = 1.0 / y_224858;
                double a12_224860 = a12_224842 * det_224859;
                double b12_224861 = b12_224845 * det_224859;
                double c12_224862 = c12_224848 * det_224859;
                double b2_224863 = b2_224850 * det_224859;
                double c2_224864 = c2_224853 * det_224859;
                int64_t defunc_0_m_fun_res_224865;
                
                if (cond_224792) {
                    defunc_0_m_fun_res_224865 = (int64_t) 0;
                } else {
                    int64_t y_224866 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_224867 = i_224787 == y_224866;
                    int64_t defunc_0_m_fun_res_f_res_224868;
                    
                    if (cond_224867) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_224869 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_224868 =
                            defunc_0_m_fun_res_f_res_t_res_224869;
                    } else {
                        int64_t x_224870 = sub64(i_224787, (int64_t) 1);
                        int64_t x_224871 = mul64(jump_s_203581, x_224870);
                        int64_t min_arg_224872 = add64((int64_t) 1, x_224871);
                        int64_t min_res_224873 = smin64(defunc_0_f_res_203721,
                                                        min_arg_224872);
                        
                        defunc_0_m_fun_res_f_res_224868 = min_res_224873;
                    }
                    defunc_0_m_fun_res_224865 = defunc_0_m_fun_res_f_res_224868;
                }
                
                double defunc_2_reduce_res_224874;
                double defunc_2_reduce_res_224875;
                double redout_224877;
                double redout_224878;
                
                redout_224877 = 0.0;
                redout_224878 = 0.0;
                for (int64_t i_224876 = 0; i_224876 < q_s_203575; i_224876++) {
                    bool cond_224879 = sle64(x_224784, i_224876);
                    int64_t defunc_0_f_res_224880;
                    
                    if (cond_224879) {
                        defunc_0_f_res_224880 = (int64_t) 0;
                    } else {
                        int64_t i_224881 = add64(x_224790, i_224876);
                        int64_t defunc_0_add_arg_224882;
                        
                        defunc_0_add_arg_224882 =
                            ((int64_t *) mem_217654.mem)[gtid_209096 *
                                                         (defunc_0_f_res_203721 *
                                                          n_p_203574) +
                                                         i_224781 *
                                                         defunc_0_f_res_203721 +
                                                         i_224881];
                        
                        int64_t defunc_1_add_res_224883 = add64((int64_t) 1,
                                                                defunc_0_add_arg_224882);
                        
                        defunc_0_f_res_224880 = defunc_1_add_res_224883;
                    }
                    
                    double defunc_0_f_res_224884;
                    
                    if (cond_224879) {
                        defunc_0_f_res_224884 = 0.0;
                    } else {
                        int64_t i_224885 = add64(x_224790, i_224876);
                        double defunc_0_add_arg_224886;
                        
                        defunc_0_add_arg_224886 =
                            ((double *) mem_218175.mem)[gtid_209096 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_224781 *
                                                        defunc_0_f_res_203721 +
                                                        i_224885];
                        defunc_0_f_res_224884 = defunc_0_add_arg_224886;
                    }
                    
                    int64_t binop_p_224887 = sub64(defunc_0_f_res_224880,
                                                   defunc_0_m_fun_res_224865);
                    double defunc_0_f_res_224888 =
                           sitofp_i64_f64(binop_p_224887);
                    double abs_res_224889 = fabs(defunc_0_f_res_224888);
                    double tmp1_224890 = abs_res_224889 / x_224791;
                    double x_224891 = tmp1_224890 * tmp1_224890;
                    double y_224892 = tmp1_224890 * x_224891;
                    double tmp2_224893 = 1.0 - y_224892;
                    double x_224894 = tmp2_224893 * tmp2_224893;
                    double tmp3_224895 = tmp2_224893 * x_224894;
                    double tmp4_224896 = defunc_0_f_res_224884 * tmp3_224895;
                    double defunc_1_f_res_224897 = defunc_0_f_res_224888 *
                           tmp4_224896;
                    double defunc_1_f_res_224898 = defunc_0_f_res_224888 *
                           defunc_1_f_res_224897;
                    double defunc_0_f_res_224899;
                    
                    if (cond_224879) {
                        defunc_0_f_res_224899 = 0.0;
                    } else {
                        int64_t i_224900 = add64(x_224790, i_224876);
                        double defunc_0_add_arg_224901;
                        
                        defunc_0_add_arg_224901 =
                            ((double *) mem_218170.mem)[gtid_209096 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_224781 *
                                                        defunc_0_f_res_203721 +
                                                        i_224900];
                        defunc_0_f_res_224899 = defunc_0_add_arg_224901;
                    }
                    
                    double x_224902 = a12_224860 * tmp4_224896;
                    double y_224903 = b12_224861 * defunc_1_f_res_224897;
                    double x_224904 = x_224902 + y_224903;
                    double y_224905 = c12_224862 * defunc_1_f_res_224898;
                    double x_224906 = x_224904 + y_224905;
                    double defunc_9_fit_fun_res_224907 = defunc_0_f_res_224899 *
                           x_224906;
                    double x_224908 = b12_224861 * tmp4_224896;
                    double y_224909 = b2_224863 * defunc_1_f_res_224897;
                    double x_224910 = x_224908 + y_224909;
                    double y_224911 = c2_224864 * defunc_1_f_res_224898;
                    double x_224912 = x_224910 + y_224911;
                    double defunc_9_slope_fun_res_224913 =
                           defunc_0_f_res_224899 * x_224912;
                    double defunc_1_op_res_224914 =
                           defunc_9_fit_fun_res_224907 + redout_224877;
                    double defunc_1_op_res_224915 =
                           defunc_9_slope_fun_res_224913 + redout_224878;
                    double redout_tmp_224929 = defunc_1_op_res_224914;
                    double redout_tmp_224930 = defunc_1_op_res_224915;
                    
                    redout_224877 = redout_tmp_224929;
                    redout_224878 = redout_tmp_224930;
                }
                defunc_2_reduce_res_224874 = redout_224877;
                defunc_2_reduce_res_224875 = redout_224878;
                ((double *) mem_218441)[i_224781 * s_n_m_203726 + i_224787] =
                    defunc_2_reduce_res_224874;
                ((double *) mem_218445)[i_224781 * s_n_m_203726 + i_224787] =
                    defunc_2_reduce_res_224875;
            }
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218530.mem + gtid_209096 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218441 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218535.mem + gtid_209096 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218445 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218441);
    free(mem_218445);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235918_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235918_end -
                 futhark_mc_segmap_parloop_235918_start;
        
        ctx->futhark_mc_segmap_parloop_235918_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235918_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235918_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235916(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_209095 = tid;
    int num_tasks_224779 = info.nsubtasks;
    struct futhark_mc_task_235915 *futhark_mc_task_235915 =
                                  (struct futhark_mc_task_235915 *) args;
    struct futhark_context *ctx = futhark_mc_task_235915->ctx;
    uint64_t futhark_mc_segmap_task_235916_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235916_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235915->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235915->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235915->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235915->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235915->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235915->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235915->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235915->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235915->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235915->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235915->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235915->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235915->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235915->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235915->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218530 = {.desc ="mem_218530", .mem =
                                  futhark_mc_task_235915->free_mem_218530,
                                  .size =0, .references =NULL};
    struct memblock mem_218535 = {.desc ="mem_218535", .mem =
                                  futhark_mc_task_235915->free_mem_218535,
                                  .size =0, .references =NULL};
    int64_t iter_224780;
    struct futhark_mc_segmap_parloop_struct_235917
    futhark_mc_segmap_parloop_struct_235917;
    
    futhark_mc_segmap_parloop_struct_235917.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235917.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235917.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235917.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235917.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235917.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235917.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235917.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235917.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235917.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235917.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235917.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235917.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235917.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235917.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235917.free_mem_218530 = mem_218530.mem;
    futhark_mc_segmap_parloop_struct_235917.free_mem_218535 = mem_218535.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235918_task;
    
    futhark_mc_segmap_parloop_235918_task.name =
        "futhark_mc_segmap_parloop_235918";
    futhark_mc_segmap_parloop_235918_task.fn = futhark_mc_segmap_parloop_235918;
    futhark_mc_segmap_parloop_235918_task.args =
        &futhark_mc_segmap_parloop_struct_235917;
    futhark_mc_segmap_parloop_235918_task.iterations = iterations;
    futhark_mc_segmap_parloop_235918_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235918_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235918_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235918_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235918_task);
    
    if (futhark_mc_segmap_parloop_235918_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235918_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235918_total_end -
                 futhark_mc_segmap_parloop_235918_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235918_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235918_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235918_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235916_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235916_end -
                 futhark_mc_segmap_task_235916_start;
        
        ctx->futhark_mc_segmap_task_235916_runs[tid]++;
        ctx->futhark_mc_segmap_task_235916_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235916_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235922 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218530;
    unsigned char *free_mem_218535;
};
struct futhark_mc_task_235926 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218433;
    unsigned char *free_mem_218437;
};
struct futhark_mc_segmap_parloop_struct_235928 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218433;
    unsigned char *free_mem_218437;
};
static int futhark_mc_segmap_parloop_235929(void *args, int64_t start,
                                            int64_t end, int flat_tid_225204,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235928
    *futhark_mc_segmap_parloop_struct_235928 =
    (struct futhark_mc_segmap_parloop_struct_235928 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235928->ctx;
    uint64_t futhark_mc_segmap_parloop_235929_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235929_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235928->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235928->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235928->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235928->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235928->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235928->free_s_n_m_203726;
    int64_t gtid_209538 =
            futhark_mc_segmap_parloop_struct_235928->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235928->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235928->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235928->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235928->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235928->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235928->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235928->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218433 = {.desc ="mem_218433", .mem =
                                  futhark_mc_segmap_parloop_struct_235928->free_mem_218433,
                                  .size =0, .references =NULL};
    struct memblock mem_218437 = {.desc ="mem_218437", .mem =
                                  futhark_mc_segmap_parloop_struct_235928->free_mem_218437,
                                  .size =0, .references =NULL};
    size_t mem_225207_cached_sizze_235930 = 0;
    unsigned char *mem_225207 = NULL;
    size_t mem_225209_cached_sizze_235931 = 0;
    unsigned char *mem_225209 = NULL;
    int64_t iterations = end - start;
    int64_t iter_225347 = start;
    
    if (mem_225207_cached_sizze_235930 < (size_t) bytes_217663) {
        mem_225207 = realloc(mem_225207, bytes_217663);
        mem_225207_cached_sizze_235930 = bytes_217663;
    }
    if (mem_225209_cached_sizze_235931 < (size_t) bytes_217663) {
        mem_225209 = realloc(mem_225209, bytes_217663);
        mem_225209_cached_sizze_235931 = bytes_217663;
    }
    for (; iter_225347 < end; iter_225347++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225479 = n_p_203574;
        int64_t gtid_225205 = iter_225347;
        int64_t remnant_225480 = iter_225347 - gtid_225205;
        int64_t x_225206;
        
        x_225206 = ((int64_t *) mem_217658.mem)[gtid_209538 * n_p_203574 +
                                                gtid_225205];
        for (int64_t i_225348 = 0; i_225348 < s_n_m_203726; i_225348++) {
            int64_t x_225351;
            
            x_225351 = ((int64_t *) mem_217828.mem)[gtid_209538 *
                                                    (s_n_m_203726 *
                                                     n_p_203574) + gtid_225205 *
                                                    s_n_m_203726 + i_225348];
            
            double x_225352;
            
            x_225352 = ((double *) mem_217833.mem)[gtid_209538 * (s_n_m_203726 *
                                                                  n_p_203574) +
                                                   gtid_225205 * s_n_m_203726 +
                                                   i_225348];
            
            bool cond_225353 = i_225348 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_225354;
            
            if (cond_225353) {
                defunc_0_m_fun_res_225354 = (int64_t) 0;
            } else {
                int64_t y_225355 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_225356 = i_225348 == y_225355;
                int64_t defunc_0_m_fun_res_f_res_225357;
                
                if (cond_225356) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_225358 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_225357 =
                        defunc_0_m_fun_res_f_res_t_res_225358;
                } else {
                    int64_t x_225359 = sub64(i_225348, (int64_t) 1);
                    int64_t x_225360 = mul64(jump_s_203581, x_225359);
                    int64_t min_arg_225361 = add64((int64_t) 1, x_225360);
                    int64_t min_res_225362 = smin64(defunc_0_f_res_203721,
                                                    min_arg_225361);
                    
                    defunc_0_m_fun_res_f_res_225357 = min_res_225362;
                }
                defunc_0_m_fun_res_225354 = defunc_0_m_fun_res_f_res_225357;
            }
            
            double defunc_2_reduce_res_225363;
            double defunc_2_reduce_res_225364;
            double defunc_2_reduce_res_225365;
            double defunc_2_reduce_res_225366;
            double defunc_2_reduce_res_225367;
            double redout_225369;
            double redout_225370;
            double redout_225371;
            double redout_225372;
            double redout_225373;
            
            redout_225369 = 0.0;
            redout_225370 = 0.0;
            redout_225371 = 0.0;
            redout_225372 = 0.0;
            redout_225373 = 0.0;
            for (int64_t i_225368 = 0; i_225368 < q_s_203575; i_225368++) {
                bool cond_225374 = sle64(x_225206, i_225368);
                int64_t defunc_0_f_res_225375;
                
                if (cond_225374) {
                    defunc_0_f_res_225375 = (int64_t) 0;
                } else {
                    int64_t i_225376 = add64(x_225351, i_225368);
                    int64_t defunc_0_add_arg_225377;
                    
                    defunc_0_add_arg_225377 =
                        ((int64_t *) mem_217654.mem)[gtid_209538 *
                                                     (defunc_0_f_res_203721 *
                                                      n_p_203574) +
                                                     gtid_225205 *
                                                     defunc_0_f_res_203721 +
                                                     i_225376];
                    
                    int64_t defunc_1_add_res_225378 = add64((int64_t) 1,
                                                            defunc_0_add_arg_225377);
                    
                    defunc_0_f_res_225375 = defunc_1_add_res_225378;
                }
                
                double defunc_0_f_res_225379;
                
                if (cond_225374) {
                    defunc_0_f_res_225379 = 0.0;
                } else {
                    int64_t i_225380 = add64(x_225351, i_225368);
                    double defunc_0_add_arg_225381;
                    
                    defunc_0_add_arg_225381 =
                        ((double *) mem_218175.mem)[gtid_209538 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_225205 *
                                                    defunc_0_f_res_203721 +
                                                    i_225380];
                    defunc_0_f_res_225379 = defunc_0_add_arg_225381;
                }
                
                int64_t binop_p_225382 = sub64(defunc_0_f_res_225375,
                                               defunc_0_m_fun_res_225354);
                double defunc_0_f_res_225383 = sitofp_i64_f64(binop_p_225382);
                double abs_res_225384 = fabs(defunc_0_f_res_225383);
                double tmp1_225385 = abs_res_225384 / x_225352;
                double x_225386 = tmp1_225385 * tmp1_225385;
                double y_225387 = tmp1_225385 * x_225386;
                double tmp2_225388 = 1.0 - y_225387;
                double x_225389 = tmp2_225388 * tmp2_225388;
                double tmp3_225390 = tmp2_225388 * x_225389;
                double w_j_225391 = defunc_0_f_res_225379 * tmp3_225390;
                double xw_j_225392 = defunc_0_f_res_225383 * w_j_225391;
                double x2w_j_225393 = defunc_0_f_res_225383 * xw_j_225392;
                double x3w_j_225394 = defunc_0_f_res_225383 * x2w_j_225393;
                double x4w_j_225395 = defunc_0_f_res_225383 * x3w_j_225394;
                double defunc_1_op_res_225396 = w_j_225391 + redout_225369;
                double defunc_1_op_res_225397 = xw_j_225392 + redout_225370;
                double defunc_1_op_res_225398 = x2w_j_225393 + redout_225371;
                double defunc_1_op_res_225399 = x3w_j_225394 + redout_225372;
                double defunc_1_op_res_225400 = x4w_j_225395 + redout_225373;
                double redout_tmp_225483 = defunc_1_op_res_225396;
                double redout_tmp_225484 = defunc_1_op_res_225397;
                double redout_tmp_225485 = defunc_1_op_res_225398;
                double redout_tmp_225486 = defunc_1_op_res_225399;
                double redout_tmp_225487 = defunc_1_op_res_225400;
                
                redout_225369 = redout_tmp_225483;
                redout_225370 = redout_tmp_225484;
                redout_225371 = redout_tmp_225485;
                redout_225372 = redout_tmp_225486;
                redout_225373 = redout_tmp_225487;
            }
            defunc_2_reduce_res_225363 = redout_225369;
            defunc_2_reduce_res_225364 = redout_225370;
            defunc_2_reduce_res_225365 = redout_225371;
            defunc_2_reduce_res_225366 = redout_225372;
            defunc_2_reduce_res_225367 = redout_225373;
            
            double x_225401 = defunc_2_reduce_res_225365 *
                   defunc_2_reduce_res_225367;
            double y_225402 = defunc_2_reduce_res_225366 *
                   defunc_2_reduce_res_225366;
            double a12_225403 = x_225401 - y_225402;
            double x_225404 = defunc_2_reduce_res_225365 *
                   defunc_2_reduce_res_225366;
            double y_225405 = defunc_2_reduce_res_225364 *
                   defunc_2_reduce_res_225367;
            double b12_225406 = x_225404 - y_225405;
            double x_225407 = defunc_2_reduce_res_225364 *
                   defunc_2_reduce_res_225366;
            double y_225408 = defunc_2_reduce_res_225365 *
                   defunc_2_reduce_res_225365;
            double c12_225409 = x_225407 - y_225408;
            double x_225410 = defunc_2_reduce_res_225363 *
                   defunc_2_reduce_res_225367;
            double b2_225411 = x_225410 - y_225408;
            double x_225412 = defunc_2_reduce_res_225364 *
                   defunc_2_reduce_res_225365;
            double y_225413 = defunc_2_reduce_res_225363 *
                   defunc_2_reduce_res_225366;
            double c2_225414 = x_225412 - y_225413;
            double x_225415 = defunc_2_reduce_res_225363 * a12_225403;
            double y_225416 = defunc_2_reduce_res_225364 * b12_225406;
            double x_225417 = x_225415 + y_225416;
            double y_225418 = defunc_2_reduce_res_225365 * c12_225409;
            double y_225419 = x_225417 + y_225418;
            double det_225420 = 1.0 / y_225419;
            double a12_225421 = a12_225403 * det_225420;
            double b12_225422 = b12_225406 * det_225420;
            double c12_225423 = c12_225409 * det_225420;
            double b2_225424 = b2_225411 * det_225420;
            double c2_225425 = c2_225414 * det_225420;
            int64_t defunc_0_m_fun_res_225426;
            
            if (cond_225353) {
                defunc_0_m_fun_res_225426 = (int64_t) 0;
            } else {
                int64_t y_225427 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_225428 = i_225348 == y_225427;
                int64_t defunc_0_m_fun_res_f_res_225429;
                
                if (cond_225428) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_225430 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_225429 =
                        defunc_0_m_fun_res_f_res_t_res_225430;
                } else {
                    int64_t x_225431 = sub64(i_225348, (int64_t) 1);
                    int64_t x_225432 = mul64(jump_s_203581, x_225431);
                    int64_t min_arg_225433 = add64((int64_t) 1, x_225432);
                    int64_t min_res_225434 = smin64(defunc_0_f_res_203721,
                                                    min_arg_225433);
                    
                    defunc_0_m_fun_res_f_res_225429 = min_res_225434;
                }
                defunc_0_m_fun_res_225426 = defunc_0_m_fun_res_f_res_225429;
            }
            
            double defunc_2_reduce_res_225435;
            double defunc_2_reduce_res_225436;
            double redout_225438;
            double redout_225439;
            
            redout_225438 = 0.0;
            redout_225439 = 0.0;
            for (int64_t i_225437 = 0; i_225437 < q_s_203575; i_225437++) {
                bool cond_225440 = sle64(x_225206, i_225437);
                int64_t defunc_0_f_res_225441;
                
                if (cond_225440) {
                    defunc_0_f_res_225441 = (int64_t) 0;
                } else {
                    int64_t i_225442 = add64(x_225351, i_225437);
                    int64_t defunc_0_add_arg_225443;
                    
                    defunc_0_add_arg_225443 =
                        ((int64_t *) mem_217654.mem)[gtid_209538 *
                                                     (defunc_0_f_res_203721 *
                                                      n_p_203574) +
                                                     gtid_225205 *
                                                     defunc_0_f_res_203721 +
                                                     i_225442];
                    
                    int64_t defunc_1_add_res_225444 = add64((int64_t) 1,
                                                            defunc_0_add_arg_225443);
                    
                    defunc_0_f_res_225441 = defunc_1_add_res_225444;
                }
                
                double defunc_0_f_res_225445;
                
                if (cond_225440) {
                    defunc_0_f_res_225445 = 0.0;
                } else {
                    int64_t i_225446 = add64(x_225351, i_225437);
                    double defunc_0_add_arg_225447;
                    
                    defunc_0_add_arg_225447 =
                        ((double *) mem_218175.mem)[gtid_209538 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_225205 *
                                                    defunc_0_f_res_203721 +
                                                    i_225446];
                    defunc_0_f_res_225445 = defunc_0_add_arg_225447;
                }
                
                int64_t binop_p_225448 = sub64(defunc_0_f_res_225441,
                                               defunc_0_m_fun_res_225426);
                double defunc_0_f_res_225449 = sitofp_i64_f64(binop_p_225448);
                double abs_res_225450 = fabs(defunc_0_f_res_225449);
                double tmp1_225451 = abs_res_225450 / x_225352;
                double x_225452 = tmp1_225451 * tmp1_225451;
                double y_225453 = tmp1_225451 * x_225452;
                double tmp2_225454 = 1.0 - y_225453;
                double x_225455 = tmp2_225454 * tmp2_225454;
                double tmp3_225456 = tmp2_225454 * x_225455;
                double tmp4_225457 = defunc_0_f_res_225445 * tmp3_225456;
                double defunc_1_f_res_225458 = defunc_0_f_res_225449 *
                       tmp4_225457;
                double defunc_1_f_res_225459 = defunc_0_f_res_225449 *
                       defunc_1_f_res_225458;
                double defunc_0_f_res_225460;
                
                if (cond_225440) {
                    defunc_0_f_res_225460 = 0.0;
                } else {
                    int64_t i_225461 = add64(x_225351, i_225437);
                    double defunc_0_add_arg_225462;
                    
                    defunc_0_add_arg_225462 =
                        ((double *) mem_218170.mem)[gtid_209538 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_225205 *
                                                    defunc_0_f_res_203721 +
                                                    i_225461];
                    defunc_0_f_res_225460 = defunc_0_add_arg_225462;
                }
                
                double x_225463 = a12_225421 * tmp4_225457;
                double y_225464 = b12_225422 * defunc_1_f_res_225458;
                double x_225465 = x_225463 + y_225464;
                double y_225466 = c12_225423 * defunc_1_f_res_225459;
                double x_225467 = x_225465 + y_225466;
                double defunc_9_fit_fun_res_225468 = defunc_0_f_res_225460 *
                       x_225467;
                double x_225469 = b12_225422 * tmp4_225457;
                double y_225470 = b2_225424 * defunc_1_f_res_225458;
                double x_225471 = x_225469 + y_225470;
                double y_225472 = c2_225425 * defunc_1_f_res_225459;
                double x_225473 = x_225471 + y_225472;
                double defunc_9_slope_fun_res_225474 = defunc_0_f_res_225460 *
                       x_225473;
                double defunc_1_op_res_225475 = defunc_9_fit_fun_res_225468 +
                       redout_225438;
                double defunc_1_op_res_225476 = defunc_9_slope_fun_res_225474 +
                       redout_225439;
                double redout_tmp_225488 = defunc_1_op_res_225475;
                double redout_tmp_225489 = defunc_1_op_res_225476;
                
                redout_225438 = redout_tmp_225488;
                redout_225439 = redout_tmp_225489;
            }
            defunc_2_reduce_res_225435 = redout_225438;
            defunc_2_reduce_res_225436 = redout_225439;
            ((double *) mem_225207)[i_225348] = defunc_2_reduce_res_225435;
            ((double *) mem_225209)[i_225348] = defunc_2_reduce_res_225436;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218433.mem + gtid_225205 * s_n_m_203726 * (int64_t) 8,
                    mem_225207 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218437.mem + gtid_225205 * s_n_m_203726 * (int64_t) 8,
                    mem_225209 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_225207);
    free(mem_225209);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235929_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235929_end -
                 futhark_mc_segmap_parloop_235929_start;
        
        ctx->futhark_mc_segmap_parloop_235929_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235929_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235929_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235927(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225204 = tid;
    int num_tasks_225346 = info.nsubtasks;
    struct futhark_mc_task_235926 *futhark_mc_task_235926 =
                                  (struct futhark_mc_task_235926 *) args;
    struct futhark_context *ctx = futhark_mc_task_235926->ctx;
    uint64_t futhark_mc_segmap_task_235927_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235927_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235926->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235926->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235926->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235926->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235926->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235926->free_s_n_m_203726;
    int64_t gtid_209538 = futhark_mc_task_235926->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235926->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235926->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235926->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235926->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235926->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235926->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235926->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218433 = {.desc ="mem_218433", .mem =
                                  futhark_mc_task_235926->free_mem_218433,
                                  .size =0, .references =NULL};
    struct memblock mem_218437 = {.desc ="mem_218437", .mem =
                                  futhark_mc_task_235926->free_mem_218437,
                                  .size =0, .references =NULL};
    int64_t iter_225347;
    struct futhark_mc_segmap_parloop_struct_235928
    futhark_mc_segmap_parloop_struct_235928;
    
    futhark_mc_segmap_parloop_struct_235928.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235928.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235928.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235928.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235928.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235928.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235928.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235928.free_gtid_209538 = gtid_209538;
    futhark_mc_segmap_parloop_struct_235928.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235928.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235928.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235928.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235928.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235928.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235928.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235928.free_mem_218433 = mem_218433.mem;
    futhark_mc_segmap_parloop_struct_235928.free_mem_218437 = mem_218437.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235929_task;
    
    futhark_mc_segmap_parloop_235929_task.name =
        "futhark_mc_segmap_parloop_235929";
    futhark_mc_segmap_parloop_235929_task.fn = futhark_mc_segmap_parloop_235929;
    futhark_mc_segmap_parloop_235929_task.args =
        &futhark_mc_segmap_parloop_struct_235928;
    futhark_mc_segmap_parloop_235929_task.iterations = iterations;
    futhark_mc_segmap_parloop_235929_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235929_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235929_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235929_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235929_task);
    
    if (futhark_mc_segmap_parloop_235929_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235929_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235929_total_end -
                 futhark_mc_segmap_parloop_235929_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235929_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235929_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235929_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235927_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235927_end -
                 futhark_mc_segmap_task_235927_start;
        
        ctx->futhark_mc_segmap_task_235927_runs[tid]++;
        ctx->futhark_mc_segmap_task_235927_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235927_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235933 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    unsigned char *free_mem_218433;
    unsigned char *free_mem_218437;
};
struct futhark_mc_task_235937 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_224933;
    int64_t free_x_224934;
    unsigned char *free_mem_224935;
    unsigned char *free_mem_224936;
};
struct futhark_mc_segmap_parloop_struct_235939 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_224933;
    int64_t free_x_224934;
    unsigned char *free_mem_224935;
    unsigned char *free_mem_224936;
};
static int futhark_mc_segmap_parloop_235940(void *args, int64_t start,
                                            int64_t end, int flat_tid_225628,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235939
    *futhark_mc_segmap_parloop_struct_235939 =
    (struct futhark_mc_segmap_parloop_struct_235939 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235939->ctx;
    uint64_t futhark_mc_segmap_parloop_235940_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235940_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235939->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235939->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235939->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235939->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235939->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235939->free_s_n_m_203726;
    int64_t gtid_209538 =
            futhark_mc_segmap_parloop_struct_235939->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235939->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235939->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235939->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235939->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235939->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_224933 =
            futhark_mc_segmap_parloop_struct_235939->free_gtid_224933;
    int64_t x_224934 = futhark_mc_segmap_parloop_struct_235939->free_x_224934;
    struct memblock mem_224935 = {.desc ="mem_224935", .mem =
                                  futhark_mc_segmap_parloop_struct_235939->free_mem_224935,
                                  .size =0, .references =NULL};
    struct memblock mem_224936 = {.desc ="mem_224936", .mem =
                                  futhark_mc_segmap_parloop_struct_235939->free_mem_224936,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_225759 = start;
    
    for (; iter_225759 < end; iter_225759++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225849 = s_n_m_203726;
        int64_t gtid_225629 = iter_225759;
        int64_t remnant_225850 = iter_225759 - gtid_225629;
        int64_t x_225630;
        
        x_225630 = ((int64_t *) mem_217828.mem)[gtid_209538 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_224933 * s_n_m_203726 +
                                                gtid_225629];
        
        double x_225631;
        
        x_225631 = ((double *) mem_217833.mem)[gtid_209538 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_224933 * s_n_m_203726 +
                                               gtid_225629];
        
        bool cond_225632 = gtid_225629 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_225633;
        
        if (cond_225632) {
            defunc_0_m_fun_res_225633 = (int64_t) 0;
        } else {
            int64_t y_225760 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_225761 = gtid_225629 == y_225760;
            int64_t defunc_0_m_fun_res_f_res_225762;
            
            if (cond_225761) {
                int64_t defunc_0_m_fun_res_f_res_t_res_225763 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_225762 =
                    defunc_0_m_fun_res_f_res_t_res_225763;
            } else {
                int64_t x_225764 = sub64(gtid_225629, (int64_t) 1);
                int64_t x_225765 = mul64(jump_s_203581, x_225764);
                int64_t min_arg_225766 = add64((int64_t) 1, x_225765);
                int64_t min_res_225767 = smin64(defunc_0_f_res_203721,
                                                min_arg_225766);
                
                defunc_0_m_fun_res_f_res_225762 = min_res_225767;
            }
            defunc_0_m_fun_res_225633 = defunc_0_m_fun_res_f_res_225762;
        }
        
        double defunc_2_reduce_res_225642;
        double defunc_2_reduce_res_225643;
        double defunc_2_reduce_res_225644;
        double defunc_2_reduce_res_225645;
        double defunc_2_reduce_res_225646;
        double redout_225769;
        double redout_225770;
        double redout_225771;
        double redout_225772;
        double redout_225773;
        
        redout_225769 = 0.0;
        redout_225770 = 0.0;
        redout_225771 = 0.0;
        redout_225772 = 0.0;
        redout_225773 = 0.0;
        for (int64_t i_225768 = 0; i_225768 < q_s_203575; i_225768++) {
            bool cond_225774 = sle64(x_224934, i_225768);
            int64_t defunc_0_f_res_225775;
            
            if (cond_225774) {
                defunc_0_f_res_225775 = (int64_t) 0;
            } else {
                int64_t i_225776 = add64(x_225630, i_225768);
                int64_t defunc_0_add_arg_225777;
                
                defunc_0_add_arg_225777 =
                    ((int64_t *) mem_217654.mem)[gtid_209538 *
                                                 (defunc_0_f_res_203721 *
                                                  n_p_203574) + gtid_224933 *
                                                 defunc_0_f_res_203721 +
                                                 i_225776];
                
                int64_t defunc_1_add_res_225778 = add64((int64_t) 1,
                                                        defunc_0_add_arg_225777);
                
                defunc_0_f_res_225775 = defunc_1_add_res_225778;
            }
            
            double defunc_0_f_res_225779;
            
            if (cond_225774) {
                defunc_0_f_res_225779 = 0.0;
            } else {
                int64_t i_225780 = add64(x_225630, i_225768);
                double defunc_0_add_arg_225781;
                
                defunc_0_add_arg_225781 =
                    ((double *) mem_218175.mem)[gtid_209538 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_224933 *
                                                defunc_0_f_res_203721 +
                                                i_225780];
                defunc_0_f_res_225779 = defunc_0_add_arg_225781;
            }
            
            int64_t binop_p_225782 = sub64(defunc_0_f_res_225775,
                                           defunc_0_m_fun_res_225633);
            double defunc_0_f_res_225783 = sitofp_i64_f64(binop_p_225782);
            double abs_res_225784 = fabs(defunc_0_f_res_225783);
            double tmp1_225785 = abs_res_225784 / x_225631;
            double x_225786 = tmp1_225785 * tmp1_225785;
            double y_225787 = tmp1_225785 * x_225786;
            double tmp2_225788 = 1.0 - y_225787;
            double x_225789 = tmp2_225788 * tmp2_225788;
            double tmp3_225790 = tmp2_225788 * x_225789;
            double w_j_225791 = defunc_0_f_res_225779 * tmp3_225790;
            double xw_j_225792 = defunc_0_f_res_225783 * w_j_225791;
            double x2w_j_225793 = defunc_0_f_res_225783 * xw_j_225792;
            double x3w_j_225794 = defunc_0_f_res_225783 * x2w_j_225793;
            double x4w_j_225795 = defunc_0_f_res_225783 * x3w_j_225794;
            double defunc_1_op_res_225796 = w_j_225791 + redout_225769;
            double defunc_1_op_res_225797 = xw_j_225792 + redout_225770;
            double defunc_1_op_res_225798 = x2w_j_225793 + redout_225771;
            double defunc_1_op_res_225799 = x3w_j_225794 + redout_225772;
            double defunc_1_op_res_225800 = x4w_j_225795 + redout_225773;
            double redout_tmp_225851 = defunc_1_op_res_225796;
            double redout_tmp_225852 = defunc_1_op_res_225797;
            double redout_tmp_225853 = defunc_1_op_res_225798;
            double redout_tmp_225854 = defunc_1_op_res_225799;
            double redout_tmp_225855 = defunc_1_op_res_225800;
            
            redout_225769 = redout_tmp_225851;
            redout_225770 = redout_tmp_225852;
            redout_225771 = redout_tmp_225853;
            redout_225772 = redout_tmp_225854;
            redout_225773 = redout_tmp_225855;
        }
        defunc_2_reduce_res_225642 = redout_225769;
        defunc_2_reduce_res_225643 = redout_225770;
        defunc_2_reduce_res_225644 = redout_225771;
        defunc_2_reduce_res_225645 = redout_225772;
        defunc_2_reduce_res_225646 = redout_225773;
        
        double x_225680 = defunc_2_reduce_res_225644 *
               defunc_2_reduce_res_225646;
        double y_225681 = defunc_2_reduce_res_225645 *
               defunc_2_reduce_res_225645;
        double a12_225682 = x_225680 - y_225681;
        double x_225683 = defunc_2_reduce_res_225644 *
               defunc_2_reduce_res_225645;
        double y_225684 = defunc_2_reduce_res_225643 *
               defunc_2_reduce_res_225646;
        double b12_225685 = x_225683 - y_225684;
        double x_225686 = defunc_2_reduce_res_225643 *
               defunc_2_reduce_res_225645;
        double y_225687 = defunc_2_reduce_res_225644 *
               defunc_2_reduce_res_225644;
        double c12_225688 = x_225686 - y_225687;
        double x_225689 = defunc_2_reduce_res_225642 *
               defunc_2_reduce_res_225646;
        double b2_225690 = x_225689 - y_225687;
        double x_225691 = defunc_2_reduce_res_225643 *
               defunc_2_reduce_res_225644;
        double y_225692 = defunc_2_reduce_res_225642 *
               defunc_2_reduce_res_225645;
        double c2_225693 = x_225691 - y_225692;
        double x_225694 = defunc_2_reduce_res_225642 * a12_225682;
        double y_225695 = defunc_2_reduce_res_225643 * b12_225685;
        double x_225696 = x_225694 + y_225695;
        double y_225697 = defunc_2_reduce_res_225644 * c12_225688;
        double y_225698 = x_225696 + y_225697;
        double det_225699 = 1.0 / y_225698;
        double a12_225700 = a12_225682 * det_225699;
        double b12_225701 = b12_225685 * det_225699;
        double c12_225702 = c12_225688 * det_225699;
        double b2_225703 = b2_225690 * det_225699;
        double c2_225704 = c2_225693 * det_225699;
        int64_t defunc_0_m_fun_res_225705;
        
        if (cond_225632) {
            defunc_0_m_fun_res_225705 = (int64_t) 0;
        } else {
            int64_t y_225801 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_225802 = gtid_225629 == y_225801;
            int64_t defunc_0_m_fun_res_f_res_225803;
            
            if (cond_225802) {
                int64_t defunc_0_m_fun_res_f_res_t_res_225804 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_225803 =
                    defunc_0_m_fun_res_f_res_t_res_225804;
            } else {
                int64_t x_225805 = sub64(gtid_225629, (int64_t) 1);
                int64_t x_225806 = mul64(jump_s_203581, x_225805);
                int64_t min_arg_225807 = add64((int64_t) 1, x_225806);
                int64_t min_res_225808 = smin64(defunc_0_f_res_203721,
                                                min_arg_225807);
                
                defunc_0_m_fun_res_f_res_225803 = min_res_225808;
            }
            defunc_0_m_fun_res_225705 = defunc_0_m_fun_res_f_res_225803;
        }
        
        double defunc_2_reduce_res_225714;
        double defunc_2_reduce_res_225715;
        double redout_225810;
        double redout_225811;
        
        redout_225810 = 0.0;
        redout_225811 = 0.0;
        for (int64_t i_225809 = 0; i_225809 < q_s_203575; i_225809++) {
            bool cond_225812 = sle64(x_224934, i_225809);
            int64_t defunc_0_f_res_225813;
            
            if (cond_225812) {
                defunc_0_f_res_225813 = (int64_t) 0;
            } else {
                int64_t i_225814 = add64(x_225630, i_225809);
                int64_t defunc_0_add_arg_225815;
                
                defunc_0_add_arg_225815 =
                    ((int64_t *) mem_217654.mem)[gtid_209538 *
                                                 (defunc_0_f_res_203721 *
                                                  n_p_203574) + gtid_224933 *
                                                 defunc_0_f_res_203721 +
                                                 i_225814];
                
                int64_t defunc_1_add_res_225816 = add64((int64_t) 1,
                                                        defunc_0_add_arg_225815);
                
                defunc_0_f_res_225813 = defunc_1_add_res_225816;
            }
            
            double defunc_0_f_res_225817;
            
            if (cond_225812) {
                defunc_0_f_res_225817 = 0.0;
            } else {
                int64_t i_225818 = add64(x_225630, i_225809);
                double defunc_0_add_arg_225819;
                
                defunc_0_add_arg_225819 =
                    ((double *) mem_218175.mem)[gtid_209538 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_224933 *
                                                defunc_0_f_res_203721 +
                                                i_225818];
                defunc_0_f_res_225817 = defunc_0_add_arg_225819;
            }
            
            int64_t binop_p_225820 = sub64(defunc_0_f_res_225813,
                                           defunc_0_m_fun_res_225705);
            double defunc_0_f_res_225821 = sitofp_i64_f64(binop_p_225820);
            double abs_res_225822 = fabs(defunc_0_f_res_225821);
            double tmp1_225823 = abs_res_225822 / x_225631;
            double x_225824 = tmp1_225823 * tmp1_225823;
            double y_225825 = tmp1_225823 * x_225824;
            double tmp2_225826 = 1.0 - y_225825;
            double x_225827 = tmp2_225826 * tmp2_225826;
            double tmp3_225828 = tmp2_225826 * x_225827;
            double tmp4_225829 = defunc_0_f_res_225817 * tmp3_225828;
            double defunc_1_f_res_225830 = defunc_0_f_res_225821 * tmp4_225829;
            double defunc_1_f_res_225831 = defunc_0_f_res_225821 *
                   defunc_1_f_res_225830;
            double defunc_0_f_res_225832;
            
            if (cond_225812) {
                defunc_0_f_res_225832 = 0.0;
            } else {
                int64_t i_225833 = add64(x_225630, i_225809);
                double defunc_0_add_arg_225834;
                
                defunc_0_add_arg_225834 =
                    ((double *) mem_218170.mem)[gtid_209538 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_224933 *
                                                defunc_0_f_res_203721 +
                                                i_225833];
                defunc_0_f_res_225832 = defunc_0_add_arg_225834;
            }
            
            double x_225835 = a12_225700 * tmp4_225829;
            double y_225836 = b12_225701 * defunc_1_f_res_225830;
            double x_225837 = x_225835 + y_225836;
            double y_225838 = c12_225702 * defunc_1_f_res_225831;
            double x_225839 = x_225837 + y_225838;
            double defunc_9_fit_fun_res_225840 = defunc_0_f_res_225832 *
                   x_225839;
            double x_225841 = b12_225701 * tmp4_225829;
            double y_225842 = b2_225703 * defunc_1_f_res_225830;
            double x_225843 = x_225841 + y_225842;
            double y_225844 = c2_225704 * defunc_1_f_res_225831;
            double x_225845 = x_225843 + y_225844;
            double defunc_9_slope_fun_res_225846 = defunc_0_f_res_225832 *
                   x_225845;
            double defunc_1_op_res_225847 = defunc_9_fit_fun_res_225840 +
                   redout_225810;
            double defunc_1_op_res_225848 = defunc_9_slope_fun_res_225846 +
                   redout_225811;
            double redout_tmp_225856 = defunc_1_op_res_225847;
            double redout_tmp_225857 = defunc_1_op_res_225848;
            
            redout_225810 = redout_tmp_225856;
            redout_225811 = redout_tmp_225857;
        }
        defunc_2_reduce_res_225714 = redout_225810;
        defunc_2_reduce_res_225715 = redout_225811;
        ((double *) mem_224935.mem)[gtid_225629] = defunc_2_reduce_res_225714;
        ((double *) mem_224936.mem)[gtid_225629] = defunc_2_reduce_res_225715;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235940_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235940_end -
                 futhark_mc_segmap_parloop_235940_start;
        
        ctx->futhark_mc_segmap_parloop_235940_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235940_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235940_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235938(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225628 = tid;
    int num_tasks_225758 = info.nsubtasks;
    struct futhark_mc_task_235937 *futhark_mc_task_235937 =
                                  (struct futhark_mc_task_235937 *) args;
    struct futhark_context *ctx = futhark_mc_task_235937->ctx;
    uint64_t futhark_mc_segmap_task_235938_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235938_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235937->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235937->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235937->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235937->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235937->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235937->free_s_n_m_203726;
    int64_t gtid_209538 = futhark_mc_task_235937->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235937->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235937->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235937->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235937->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235937->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_224933 = futhark_mc_task_235937->free_gtid_224933;
    int64_t x_224934 = futhark_mc_task_235937->free_x_224934;
    struct memblock mem_224935 = {.desc ="mem_224935", .mem =
                                  futhark_mc_task_235937->free_mem_224935,
                                  .size =0, .references =NULL};
    struct memblock mem_224936 = {.desc ="mem_224936", .mem =
                                  futhark_mc_task_235937->free_mem_224936,
                                  .size =0, .references =NULL};
    int64_t iter_225759;
    struct futhark_mc_segmap_parloop_struct_235939
    futhark_mc_segmap_parloop_struct_235939;
    
    futhark_mc_segmap_parloop_struct_235939.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235939.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235939.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235939.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235939.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235939.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235939.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235939.free_gtid_209538 = gtid_209538;
    futhark_mc_segmap_parloop_struct_235939.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235939.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235939.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235939.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235939.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235939.free_gtid_224933 = gtid_224933;
    futhark_mc_segmap_parloop_struct_235939.free_x_224934 = x_224934;
    futhark_mc_segmap_parloop_struct_235939.free_mem_224935 = mem_224935.mem;
    futhark_mc_segmap_parloop_struct_235939.free_mem_224936 = mem_224936.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235940_task;
    
    futhark_mc_segmap_parloop_235940_task.name =
        "futhark_mc_segmap_parloop_235940";
    futhark_mc_segmap_parloop_235940_task.fn = futhark_mc_segmap_parloop_235940;
    futhark_mc_segmap_parloop_235940_task.args =
        &futhark_mc_segmap_parloop_struct_235939;
    futhark_mc_segmap_parloop_235940_task.iterations = iterations;
    futhark_mc_segmap_parloop_235940_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235940_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235940_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235940_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235940_task);
    
    if (futhark_mc_segmap_parloop_235940_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235940_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235940_total_end -
                 futhark_mc_segmap_parloop_235940_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235940_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235940_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235940_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235938_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235938_end -
                 futhark_mc_segmap_task_235938_start;
        
        ctx->futhark_mc_segmap_task_235938_runs[tid]++;
        ctx->futhark_mc_segmap_task_235938_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235938_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235942 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_224933;
    int64_t free_x_224934;
    unsigned char *free_mem_224935;
    unsigned char *free_mem_224936;
};
struct futhark_mc_task_235944 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_224933;
    int64_t free_x_224934;
    int64_t free_x_225493;
    double free_x_225494;
    int64_t free_defunc_0_m_fun_res_225496;
    double *retval_defunc_2_reduce_res_225505;
    double *retval_defunc_2_reduce_res_225506;
    double *retval_defunc_2_reduce_res_225507;
    double *retval_defunc_2_reduce_res_225508;
    double *retval_defunc_2_reduce_res_225509;
};
struct futhark_mc_segred_stage_1_parloop_struct_235951 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_224933;
    int64_t free_x_224934;
    int64_t free_x_225493;
    double free_x_225494;
    int64_t free_defunc_0_m_fun_res_225496;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225960;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225962;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225964;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225966;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225968;
};
static int futhark_mc_segred_stage_1_parloop_235952(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_225867,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235951
    *futhark_mc_segred_stage_1_parloop_struct_235951 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235951 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235951->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235952_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235952_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235951->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_235951->free_defunc_0_f_res_203721;
    int64_t gtid_209538 =
            futhark_mc_segred_stage_1_parloop_struct_235951->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235951->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235951->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_224933 =
            futhark_mc_segred_stage_1_parloop_struct_235951->free_gtid_224933;
    int64_t x_224934 =
            futhark_mc_segred_stage_1_parloop_struct_235951->free_x_224934;
    int64_t x_225493 =
            futhark_mc_segred_stage_1_parloop_struct_235951->free_x_225493;
    double x_225494 =
           futhark_mc_segred_stage_1_parloop_struct_235951->free_x_225494;
    int64_t defunc_0_m_fun_res_225496 =
            futhark_mc_segred_stage_1_parloop_struct_235951->free_defunc_0_m_fun_res_225496;
    struct memblock reduce_stage_1_tid_res_arr_mem_225960 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225960",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235951->free_reduce_stage_1_tid_res_arr_mem_225960,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225962 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225962",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235951->free_reduce_stage_1_tid_res_arr_mem_225962,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225964 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225964",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235951->free_reduce_stage_1_tid_res_arr_mem_225964,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225966 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225966",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235951->free_reduce_stage_1_tid_res_arr_mem_225966,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225968 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225968",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235951->free_reduce_stage_1_tid_res_arr_mem_225968,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_225970 = start;
    double x_225869;
    double x_225870;
    double x_225872;
    double x_225873;
    double x_225875;
    double x_225876;
    double x_225878;
    double x_225879;
    double x_225881;
    double x_225882;
    double local_acc_225971 = 0.0;
    double local_acc_225972 = 0.0;
    double local_acc_225973 = 0.0;
    double local_acc_225974 = 0.0;
    double local_acc_225975 = 0.0;
    
    for (; iter_225970 < end; iter_225970++) {
        int64_t gtid_225868 = iter_225970;
        bool cond_225884 = sle64(x_224934, gtid_225868);
        int64_t defunc_0_f_res_225885;
        
        if (cond_225884) {
            defunc_0_f_res_225885 = (int64_t) 0;
        } else {
            int64_t i_225886 = add64(x_225493, gtid_225868);
            int64_t defunc_0_add_arg_225887;
            
            defunc_0_add_arg_225887 = ((int64_t *) mem_217654.mem)[gtid_209538 *
                                                                   (defunc_0_f_res_203721 *
                                                                    n_p_203574) +
                                                                   gtid_224933 *
                                                                   defunc_0_f_res_203721 +
                                                                   i_225886];
            
            int64_t defunc_1_add_res_225888 = add64((int64_t) 1,
                                                    defunc_0_add_arg_225887);
            
            defunc_0_f_res_225885 = defunc_1_add_res_225888;
        }
        
        double defunc_0_f_res_225889;
        
        if (cond_225884) {
            defunc_0_f_res_225889 = 0.0;
        } else {
            int64_t i_225890 = add64(x_225493, gtid_225868);
            double defunc_0_add_arg_225891;
            
            defunc_0_add_arg_225891 = ((double *) mem_218175.mem)[gtid_209538 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_224933 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_225890];
            defunc_0_f_res_225889 = defunc_0_add_arg_225891;
        }
        
        int64_t binop_p_225892 = sub64(defunc_0_f_res_225885,
                                       defunc_0_m_fun_res_225496);
        double defunc_0_f_res_225893 = sitofp_i64_f64(binop_p_225892);
        double abs_res_225894 = fabs(defunc_0_f_res_225893);
        double tmp1_225895 = abs_res_225894 / x_225494;
        double x_225896 = tmp1_225895 * tmp1_225895;
        double y_225897 = tmp1_225895 * x_225896;
        double tmp2_225898 = 1.0 - y_225897;
        double x_225899 = tmp2_225898 * tmp2_225898;
        double tmp3_225900 = tmp2_225898 * x_225899;
        double w_j_225901 = defunc_0_f_res_225889 * tmp3_225900;
        double xw_j_225902 = defunc_0_f_res_225893 * w_j_225901;
        double x2w_j_225903 = defunc_0_f_res_225893 * xw_j_225902;
        double x3w_j_225904 = defunc_0_f_res_225893 * x2w_j_225903;
        double x4w_j_225905 = defunc_0_f_res_225893 * x3w_j_225904;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_225869 = local_acc_225971;
        }
        // Load next params
        {
            x_225870 = w_j_225901;
        }
        // Red body
        {
            double defunc_1_op_res_225871 = x_225869 + x_225870;
            
            local_acc_225971 = defunc_1_op_res_225871;
        }
        // Load accum params
        {
            x_225872 = local_acc_225972;
        }
        // Load next params
        {
            x_225873 = xw_j_225902;
        }
        // Red body
        {
            double defunc_1_op_res_225874 = x_225872 + x_225873;
            
            local_acc_225972 = defunc_1_op_res_225874;
        }
        // Load accum params
        {
            x_225875 = local_acc_225973;
        }
        // Load next params
        {
            x_225876 = x2w_j_225903;
        }
        // Red body
        {
            double defunc_1_op_res_225877 = x_225875 + x_225876;
            
            local_acc_225973 = defunc_1_op_res_225877;
        }
        // Load accum params
        {
            x_225878 = local_acc_225974;
        }
        // Load next params
        {
            x_225879 = x3w_j_225904;
        }
        // Red body
        {
            double defunc_1_op_res_225880 = x_225878 + x_225879;
            
            local_acc_225974 = defunc_1_op_res_225880;
        }
        // Load accum params
        {
            x_225881 = local_acc_225975;
        }
        // Load next params
        {
            x_225882 = x4w_j_225905;
        }
        // Red body
        {
            double defunc_1_op_res_225883 = x_225881 + x_225882;
            
            local_acc_225975 = defunc_1_op_res_225883;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_225960.mem)[flat_tid_225867] =
        local_acc_225971;
    ((double *) reduce_stage_1_tid_res_arr_mem_225962.mem)[flat_tid_225867] =
        local_acc_225972;
    ((double *) reduce_stage_1_tid_res_arr_mem_225964.mem)[flat_tid_225867] =
        local_acc_225973;
    ((double *) reduce_stage_1_tid_res_arr_mem_225966.mem)[flat_tid_225867] =
        local_acc_225974;
    ((double *) reduce_stage_1_tid_res_arr_mem_225968.mem)[flat_tid_225867] =
        local_acc_225975;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235952_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235952_end -
                 futhark_mc_segred_stage_1_parloop_235952_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235952_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235952_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235952_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235945(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225867 = tid;
    int num_tasks_225959 = info.nsubtasks;
    struct futhark_mc_task_235944 *futhark_mc_task_235944 =
                                  (struct futhark_mc_task_235944 *) args;
    struct futhark_context *ctx = futhark_mc_task_235944->ctx;
    uint64_t futhark_mc_segred_task_235945_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235945_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235944->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235944->free_defunc_0_f_res_203721;
    int64_t gtid_209538 = futhark_mc_task_235944->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235944->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235944->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_224933 = futhark_mc_task_235944->free_gtid_224933;
    int64_t x_224934 = futhark_mc_task_235944->free_x_224934;
    int64_t x_225493 = futhark_mc_task_235944->free_x_225493;
    double x_225494 = futhark_mc_task_235944->free_x_225494;
    int64_t defunc_0_m_fun_res_225496 =
            futhark_mc_task_235944->free_defunc_0_m_fun_res_225496;
    double defunc_2_reduce_res_225505 =
           *futhark_mc_task_235944->retval_defunc_2_reduce_res_225505;
    double defunc_2_reduce_res_225506 =
           *futhark_mc_task_235944->retval_defunc_2_reduce_res_225506;
    double defunc_2_reduce_res_225507 =
           *futhark_mc_task_235944->retval_defunc_2_reduce_res_225507;
    double defunc_2_reduce_res_225508 =
           *futhark_mc_task_235944->retval_defunc_2_reduce_res_225508;
    double defunc_2_reduce_res_225509 =
           *futhark_mc_task_235944->retval_defunc_2_reduce_res_225509;
    size_t reduce_stage_1_tid_res_arr_mem_225960_cached_sizze_235946 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225960 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225962_cached_sizze_235947 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225962 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225964_cached_sizze_235948 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225964 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225966_cached_sizze_235949 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225966 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225968_cached_sizze_235950 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225968 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_225960_cached_sizze_235946 <
        (size_t) ((int64_t) 8 * num_tasks_225959)) {
        reduce_stage_1_tid_res_arr_mem_225960 =
            realloc(reduce_stage_1_tid_res_arr_mem_225960, (int64_t) 8 *
                    num_tasks_225959);
        reduce_stage_1_tid_res_arr_mem_225960_cached_sizze_235946 =
            (int64_t) 8 * num_tasks_225959;
    }
    if (reduce_stage_1_tid_res_arr_mem_225962_cached_sizze_235947 <
        (size_t) ((int64_t) 8 * num_tasks_225959)) {
        reduce_stage_1_tid_res_arr_mem_225962 =
            realloc(reduce_stage_1_tid_res_arr_mem_225962, (int64_t) 8 *
                    num_tasks_225959);
        reduce_stage_1_tid_res_arr_mem_225962_cached_sizze_235947 =
            (int64_t) 8 * num_tasks_225959;
    }
    if (reduce_stage_1_tid_res_arr_mem_225964_cached_sizze_235948 <
        (size_t) ((int64_t) 8 * num_tasks_225959)) {
        reduce_stage_1_tid_res_arr_mem_225964 =
            realloc(reduce_stage_1_tid_res_arr_mem_225964, (int64_t) 8 *
                    num_tasks_225959);
        reduce_stage_1_tid_res_arr_mem_225964_cached_sizze_235948 =
            (int64_t) 8 * num_tasks_225959;
    }
    if (reduce_stage_1_tid_res_arr_mem_225966_cached_sizze_235949 <
        (size_t) ((int64_t) 8 * num_tasks_225959)) {
        reduce_stage_1_tid_res_arr_mem_225966 =
            realloc(reduce_stage_1_tid_res_arr_mem_225966, (int64_t) 8 *
                    num_tasks_225959);
        reduce_stage_1_tid_res_arr_mem_225966_cached_sizze_235949 =
            (int64_t) 8 * num_tasks_225959;
    }
    if (reduce_stage_1_tid_res_arr_mem_225968_cached_sizze_235950 <
        (size_t) ((int64_t) 8 * num_tasks_225959)) {
        reduce_stage_1_tid_res_arr_mem_225968 =
            realloc(reduce_stage_1_tid_res_arr_mem_225968, (int64_t) 8 *
                    num_tasks_225959);
        reduce_stage_1_tid_res_arr_mem_225968_cached_sizze_235950 =
            (int64_t) 8 * num_tasks_225959;
    }
    
    int64_t iter_225970;
    struct futhark_mc_segred_stage_1_parloop_struct_235951
    futhark_mc_segred_stage_1_parloop_struct_235951;
    
    futhark_mc_segred_stage_1_parloop_struct_235951.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_gtid_209538 =
        gtid_209538;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_mem_217654 =
        mem_217654.mem;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_mem_218175 =
        mem_218175.mem;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_gtid_224933 =
        gtid_224933;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_x_224934 = x_224934;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_x_225493 = x_225493;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_x_225494 = x_225494;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_defunc_0_m_fun_res_225496 =
        defunc_0_m_fun_res_225496;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_reduce_stage_1_tid_res_arr_mem_225960 =
        reduce_stage_1_tid_res_arr_mem_225960;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_reduce_stage_1_tid_res_arr_mem_225962 =
        reduce_stage_1_tid_res_arr_mem_225962;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_reduce_stage_1_tid_res_arr_mem_225964 =
        reduce_stage_1_tid_res_arr_mem_225964;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_reduce_stage_1_tid_res_arr_mem_225966 =
        reduce_stage_1_tid_res_arr_mem_225966;
    futhark_mc_segred_stage_1_parloop_struct_235951.free_reduce_stage_1_tid_res_arr_mem_225968 =
        reduce_stage_1_tid_res_arr_mem_225968;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235952_task;
    
    futhark_mc_segred_stage_1_parloop_235952_task.name =
        "futhark_mc_segred_stage_1_parloop_235952";
    futhark_mc_segred_stage_1_parloop_235952_task.fn =
        futhark_mc_segred_stage_1_parloop_235952;
    futhark_mc_segred_stage_1_parloop_235952_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235951;
    futhark_mc_segred_stage_1_parloop_235952_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235952_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235952_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235952_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235952_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235952_task);
    
    if (futhark_mc_segred_stage_1_parloop_235952_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235952_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235952_total_end -
                 futhark_mc_segred_stage_1_parloop_235952_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235952_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235952_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235952_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_225505 = 0.0;
        defunc_2_reduce_res_225506 = 0.0;
        defunc_2_reduce_res_225507 = 0.0;
        defunc_2_reduce_res_225508 = 0.0;
        defunc_2_reduce_res_225509 = 0.0;
    }
    
    double x_225976;
    double x_225977;
    double x_225979;
    double x_225980;
    double x_225982;
    double x_225983;
    double x_225985;
    double x_225986;
    double x_225988;
    double x_225989;
    
    for (int32_t i_225991 = 0; i_225991 < num_tasks_225959; i_225991++) {
        flat_tid_225867 = i_225991;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_225976 = defunc_2_reduce_res_225505;
            }
            // load next params
            {
                x_225977 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225960)[flat_tid_225867];
            }
            // red body
            {
                double defunc_1_op_res_225978 = x_225976 + x_225977;
                
                defunc_2_reduce_res_225505 = defunc_1_op_res_225978;
            }
            // load acc params
            {
                x_225979 = defunc_2_reduce_res_225506;
            }
            // load next params
            {
                x_225980 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225962)[flat_tid_225867];
            }
            // red body
            {
                double defunc_1_op_res_225981 = x_225979 + x_225980;
                
                defunc_2_reduce_res_225506 = defunc_1_op_res_225981;
            }
            // load acc params
            {
                x_225982 = defunc_2_reduce_res_225507;
            }
            // load next params
            {
                x_225983 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225964)[flat_tid_225867];
            }
            // red body
            {
                double defunc_1_op_res_225984 = x_225982 + x_225983;
                
                defunc_2_reduce_res_225507 = defunc_1_op_res_225984;
            }
            // load acc params
            {
                x_225985 = defunc_2_reduce_res_225508;
            }
            // load next params
            {
                x_225986 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225966)[flat_tid_225867];
            }
            // red body
            {
                double defunc_1_op_res_225987 = x_225985 + x_225986;
                
                defunc_2_reduce_res_225508 = defunc_1_op_res_225987;
            }
            // load acc params
            {
                x_225988 = defunc_2_reduce_res_225509;
            }
            // load next params
            {
                x_225989 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225968)[flat_tid_225867];
            }
            // red body
            {
                double defunc_1_op_res_225990 = x_225988 + x_225989;
                
                defunc_2_reduce_res_225509 = defunc_1_op_res_225990;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_225960);
        free(reduce_stage_1_tid_res_arr_mem_225962);
        free(reduce_stage_1_tid_res_arr_mem_225964);
        free(reduce_stage_1_tid_res_arr_mem_225966);
        free(reduce_stage_1_tid_res_arr_mem_225968);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235945_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235945_end -
                 futhark_mc_segred_task_235945_start;
        
        ctx->futhark_mc_segred_task_235945_runs[tid]++;
        ctx->futhark_mc_segred_task_235945_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235945_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235944->retval_defunc_2_reduce_res_225505 =
            defunc_2_reduce_res_225505;
        *futhark_mc_task_235944->retval_defunc_2_reduce_res_225506 =
            defunc_2_reduce_res_225506;
        *futhark_mc_task_235944->retval_defunc_2_reduce_res_225507 =
            defunc_2_reduce_res_225507;
        *futhark_mc_task_235944->retval_defunc_2_reduce_res_225508 =
            defunc_2_reduce_res_225508;
        *futhark_mc_task_235944->retval_defunc_2_reduce_res_225509 =
            defunc_2_reduce_res_225509;
    }
    return err;
}
struct futhark_mc_task_235953 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_224933;
    int64_t free_x_224934;
    int64_t free_x_225493;
    double free_x_225494;
    double free_a12_225569;
    double free_b12_225570;
    double free_c12_225571;
    double free_b2_225572;
    double free_c2_225573;
    int64_t free_defunc_0_m_fun_res_225574;
    double *retval_defunc_2_reduce_res_225583;
    double *retval_defunc_2_reduce_res_225584;
};
struct futhark_mc_segred_stage_1_parloop_struct_235957 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_209538;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_gtid_224933;
    int64_t free_x_224934;
    int64_t free_x_225493;
    double free_x_225494;
    double free_a12_225569;
    double free_b12_225570;
    double free_c12_225571;
    double free_b2_225572;
    double free_c2_225573;
    int64_t free_defunc_0_m_fun_res_225574;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225993;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_225995;
};
static int futhark_mc_segred_stage_1_parloop_235958(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_225914,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235957
    *futhark_mc_segred_stage_1_parloop_struct_235957 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235957 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235957->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235958_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235958_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235957->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_235957->free_defunc_0_f_res_203721;
    int64_t gtid_209538 =
            futhark_mc_segred_stage_1_parloop_struct_235957->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235957->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235957->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235957->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_224933 =
            futhark_mc_segred_stage_1_parloop_struct_235957->free_gtid_224933;
    int64_t x_224934 =
            futhark_mc_segred_stage_1_parloop_struct_235957->free_x_224934;
    int64_t x_225493 =
            futhark_mc_segred_stage_1_parloop_struct_235957->free_x_225493;
    double x_225494 =
           futhark_mc_segred_stage_1_parloop_struct_235957->free_x_225494;
    double a12_225569 =
           futhark_mc_segred_stage_1_parloop_struct_235957->free_a12_225569;
    double b12_225570 =
           futhark_mc_segred_stage_1_parloop_struct_235957->free_b12_225570;
    double c12_225571 =
           futhark_mc_segred_stage_1_parloop_struct_235957->free_c12_225571;
    double b2_225572 =
           futhark_mc_segred_stage_1_parloop_struct_235957->free_b2_225572;
    double c2_225573 =
           futhark_mc_segred_stage_1_parloop_struct_235957->free_c2_225573;
    int64_t defunc_0_m_fun_res_225574 =
            futhark_mc_segred_stage_1_parloop_struct_235957->free_defunc_0_m_fun_res_225574;
    struct memblock reduce_stage_1_tid_res_arr_mem_225993 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225993",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235957->free_reduce_stage_1_tid_res_arr_mem_225993,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_225995 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_225995",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235957->free_reduce_stage_1_tid_res_arr_mem_225995,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_225997 = start;
    double x_225916;
    double x_225917;
    double x_225919;
    double x_225920;
    double local_acc_225998 = 0.0;
    double local_acc_225999 = 0.0;
    
    for (; iter_225997 < end; iter_225997++) {
        int64_t gtid_225915 = iter_225997;
        bool cond_225922 = sle64(x_224934, gtid_225915);
        int64_t defunc_0_f_res_225923;
        
        if (cond_225922) {
            defunc_0_f_res_225923 = (int64_t) 0;
        } else {
            int64_t i_225924 = add64(x_225493, gtid_225915);
            int64_t defunc_0_add_arg_225925;
            
            defunc_0_add_arg_225925 = ((int64_t *) mem_217654.mem)[gtid_209538 *
                                                                   (defunc_0_f_res_203721 *
                                                                    n_p_203574) +
                                                                   gtid_224933 *
                                                                   defunc_0_f_res_203721 +
                                                                   i_225924];
            
            int64_t defunc_1_add_res_225926 = add64((int64_t) 1,
                                                    defunc_0_add_arg_225925);
            
            defunc_0_f_res_225923 = defunc_1_add_res_225926;
        }
        
        double defunc_0_f_res_225927;
        
        if (cond_225922) {
            defunc_0_f_res_225927 = 0.0;
        } else {
            int64_t i_225928 = add64(x_225493, gtid_225915);
            double defunc_0_add_arg_225929;
            
            defunc_0_add_arg_225929 = ((double *) mem_218175.mem)[gtid_209538 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_224933 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_225928];
            defunc_0_f_res_225927 = defunc_0_add_arg_225929;
        }
        
        int64_t binop_p_225930 = sub64(defunc_0_f_res_225923,
                                       defunc_0_m_fun_res_225574);
        double defunc_0_f_res_225931 = sitofp_i64_f64(binop_p_225930);
        double abs_res_225932 = fabs(defunc_0_f_res_225931);
        double tmp1_225933 = abs_res_225932 / x_225494;
        double x_225934 = tmp1_225933 * tmp1_225933;
        double y_225935 = tmp1_225933 * x_225934;
        double tmp2_225936 = 1.0 - y_225935;
        double x_225937 = tmp2_225936 * tmp2_225936;
        double tmp3_225938 = tmp2_225936 * x_225937;
        double tmp4_225939 = defunc_0_f_res_225927 * tmp3_225938;
        double defunc_1_f_res_225940 = defunc_0_f_res_225931 * tmp4_225939;
        double defunc_1_f_res_225941 = defunc_0_f_res_225931 *
               defunc_1_f_res_225940;
        double defunc_0_f_res_225942;
        
        if (cond_225922) {
            defunc_0_f_res_225942 = 0.0;
        } else {
            int64_t i_225943 = add64(x_225493, gtid_225915);
            double defunc_0_add_arg_225944;
            
            defunc_0_add_arg_225944 = ((double *) mem_218170.mem)[gtid_209538 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_224933 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_225943];
            defunc_0_f_res_225942 = defunc_0_add_arg_225944;
        }
        
        double x_225945 = a12_225569 * tmp4_225939;
        double y_225946 = b12_225570 * defunc_1_f_res_225940;
        double x_225947 = x_225945 + y_225946;
        double y_225948 = c12_225571 * defunc_1_f_res_225941;
        double x_225949 = x_225947 + y_225948;
        double defunc_9_fit_fun_res_225950 = defunc_0_f_res_225942 * x_225949;
        double x_225951 = b12_225570 * tmp4_225939;
        double y_225952 = b2_225572 * defunc_1_f_res_225940;
        double x_225953 = x_225951 + y_225952;
        double y_225954 = c2_225573 * defunc_1_f_res_225941;
        double x_225955 = x_225953 + y_225954;
        double defunc_9_slope_fun_res_225956 = defunc_0_f_res_225942 * x_225955;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_225916 = local_acc_225998;
        }
        // Load next params
        {
            x_225917 = defunc_9_fit_fun_res_225950;
        }
        // Red body
        {
            double defunc_1_op_res_225918 = x_225916 + x_225917;
            
            local_acc_225998 = defunc_1_op_res_225918;
        }
        // Load accum params
        {
            x_225919 = local_acc_225999;
        }
        // Load next params
        {
            x_225920 = defunc_9_slope_fun_res_225956;
        }
        // Red body
        {
            double defunc_1_op_res_225921 = x_225919 + x_225920;
            
            local_acc_225999 = defunc_1_op_res_225921;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_225993.mem)[flat_tid_225914] =
        local_acc_225998;
    ((double *) reduce_stage_1_tid_res_arr_mem_225995.mem)[flat_tid_225914] =
        local_acc_225999;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235958_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235958_end -
                 futhark_mc_segred_stage_1_parloop_235958_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235958_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235958_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235958_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235954(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225914 = tid;
    int num_tasks_225992 = 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_segred_task_235954_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235954_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235953->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235953->free_defunc_0_f_res_203721;
    int64_t gtid_209538 = futhark_mc_task_235953->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235953->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235953->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235953->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_224933 = futhark_mc_task_235953->free_gtid_224933;
    int64_t x_224934 = futhark_mc_task_235953->free_x_224934;
    int64_t x_225493 = futhark_mc_task_235953->free_x_225493;
    double x_225494 = futhark_mc_task_235953->free_x_225494;
    double a12_225569 = futhark_mc_task_235953->free_a12_225569;
    double b12_225570 = futhark_mc_task_235953->free_b12_225570;
    double c12_225571 = futhark_mc_task_235953->free_c12_225571;
    double b2_225572 = futhark_mc_task_235953->free_b2_225572;
    double c2_225573 = futhark_mc_task_235953->free_c2_225573;
    int64_t defunc_0_m_fun_res_225574 =
            futhark_mc_task_235953->free_defunc_0_m_fun_res_225574;
    double defunc_2_reduce_res_225583 =
           *futhark_mc_task_235953->retval_defunc_2_reduce_res_225583;
    double defunc_2_reduce_res_225584 =
           *futhark_mc_task_235953->retval_defunc_2_reduce_res_225584;
    size_t reduce_stage_1_tid_res_arr_mem_225993_cached_sizze_235955 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225993 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_225995_cached_sizze_235956 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_225995 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_225993_cached_sizze_235955 <
        (size_t) ((int64_t) 8 * num_tasks_225992)) {
        reduce_stage_1_tid_res_arr_mem_225993 =
            realloc(reduce_stage_1_tid_res_arr_mem_225993, (int64_t) 8 *
                    num_tasks_225992);
        reduce_stage_1_tid_res_arr_mem_225993_cached_sizze_235955 =
            (int64_t) 8 * num_tasks_225992;
    }
    if (reduce_stage_1_tid_res_arr_mem_225995_cached_sizze_235956 <
        (size_t) ((int64_t) 8 * num_tasks_225992)) {
        reduce_stage_1_tid_res_arr_mem_225995 =
            realloc(reduce_stage_1_tid_res_arr_mem_225995, (int64_t) 8 *
                    num_tasks_225992);
        reduce_stage_1_tid_res_arr_mem_225995_cached_sizze_235956 =
            (int64_t) 8 * num_tasks_225992;
    }
    
    int64_t iter_225997;
    struct futhark_mc_segred_stage_1_parloop_struct_235957
    futhark_mc_segred_stage_1_parloop_struct_235957;
    
    futhark_mc_segred_stage_1_parloop_struct_235957.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_gtid_209538 =
        gtid_209538;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_mem_217654 =
        mem_217654.mem;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_mem_218170 =
        mem_218170.mem;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_mem_218175 =
        mem_218175.mem;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_gtid_224933 =
        gtid_224933;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_x_224934 = x_224934;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_x_225493 = x_225493;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_x_225494 = x_225494;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_a12_225569 =
        a12_225569;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_b12_225570 =
        b12_225570;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_c12_225571 =
        c12_225571;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_b2_225572 = b2_225572;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_c2_225573 = c2_225573;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_defunc_0_m_fun_res_225574 =
        defunc_0_m_fun_res_225574;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_reduce_stage_1_tid_res_arr_mem_225993 =
        reduce_stage_1_tid_res_arr_mem_225993;
    futhark_mc_segred_stage_1_parloop_struct_235957.free_reduce_stage_1_tid_res_arr_mem_225995 =
        reduce_stage_1_tid_res_arr_mem_225995;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235958_task;
    
    futhark_mc_segred_stage_1_parloop_235958_task.name =
        "futhark_mc_segred_stage_1_parloop_235958";
    futhark_mc_segred_stage_1_parloop_235958_task.fn =
        futhark_mc_segred_stage_1_parloop_235958;
    futhark_mc_segred_stage_1_parloop_235958_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235957;
    futhark_mc_segred_stage_1_parloop_235958_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235958_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235958_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235958_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235958_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235958_task);
    
    if (futhark_mc_segred_stage_1_parloop_235958_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235958_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235958_total_end -
                 futhark_mc_segred_stage_1_parloop_235958_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235958_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235958_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235958_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_225583 = 0.0;
        defunc_2_reduce_res_225584 = 0.0;
    }
    
    double x_226000;
    double x_226001;
    double x_226003;
    double x_226004;
    
    for (int32_t i_226006 = 0; i_226006 < num_tasks_225992; i_226006++) {
        flat_tid_225914 = i_226006;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_226000 = defunc_2_reduce_res_225583;
            }
            // load next params
            {
                x_226001 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225993)[flat_tid_225914];
            }
            // red body
            {
                double defunc_1_op_res_226002 = x_226000 + x_226001;
                
                defunc_2_reduce_res_225583 = defunc_1_op_res_226002;
            }
            // load acc params
            {
                x_226003 = defunc_2_reduce_res_225584;
            }
            // load next params
            {
                x_226004 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_225995)[flat_tid_225914];
            }
            // red body
            {
                double defunc_1_op_res_226005 = x_226003 + x_226004;
                
                defunc_2_reduce_res_225584 = defunc_1_op_res_226005;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_225993);
        free(reduce_stage_1_tid_res_arr_mem_225995);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235954_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235954_end -
                 futhark_mc_segred_task_235954_start;
        
        ctx->futhark_mc_segred_task_235954_runs[tid]++;
        ctx->futhark_mc_segred_task_235954_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235954_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235953->retval_defunc_2_reduce_res_225583 =
            defunc_2_reduce_res_225583;
        *futhark_mc_task_235953->retval_defunc_2_reduce_res_225584 =
            defunc_2_reduce_res_225584;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235943(void *args, int64_t start,
                                            int64_t end, int flat_tid_225491,
                                            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_203574 =
            futhark_mc_segmap_parloop_struct_235942->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235942->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235942->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235942->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235942->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235942->free_s_n_m_203726;
    int64_t gtid_209538 =
            futhark_mc_segmap_parloop_struct_235942->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235942->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235942->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235942->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235942->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235942->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_224933 =
            futhark_mc_segmap_parloop_struct_235942->free_gtid_224933;
    int64_t x_224934 = futhark_mc_segmap_parloop_struct_235942->free_x_224934;
    struct memblock mem_224935 = {.desc ="mem_224935", .mem =
                                  futhark_mc_segmap_parloop_struct_235942->free_mem_224935,
                                  .size =0, .references =NULL};
    struct memblock mem_224936 = {.desc ="mem_224936", .mem =
                                  futhark_mc_segmap_parloop_struct_235942->free_mem_224936,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_225858 = start;
    
    for (; iter_225858 < end; iter_225858++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225957 = s_n_m_203726;
        int64_t gtid_225492 = iter_225858;
        int64_t remnant_225958 = iter_225858 - gtid_225492;
        int64_t x_225493;
        
        x_225493 = ((int64_t *) mem_217828.mem)[gtid_209538 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_224933 * s_n_m_203726 +
                                                gtid_225492];
        
        double x_225494;
        
        x_225494 = ((double *) mem_217833.mem)[gtid_209538 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_224933 * s_n_m_203726 +
                                               gtid_225492];
        
        bool cond_225495 = gtid_225492 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_225496;
        
        if (cond_225495) {
            defunc_0_m_fun_res_225496 = (int64_t) 0;
        } else {
            int64_t y_225859 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_225860 = gtid_225492 == 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_203722, (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(gtid_225492, (int64_t) 1);
                int64_t x_225864 = mul64(jump_s_203581, x_225863);
                int64_t min_arg_225865 = add64((int64_t) 1, x_225864);
                int64_t min_res_225866 = smin64(defunc_0_f_res_203721,
                                                min_arg_225865);
                
                defunc_0_m_fun_res_f_res_225861 = min_res_225866;
            }
            defunc_0_m_fun_res_225496 = defunc_0_m_fun_res_f_res_225861;
        }
        
        double defunc_2_reduce_res_225505;
        double defunc_2_reduce_res_225506;
        double defunc_2_reduce_res_225507;
        double defunc_2_reduce_res_225508;
        double defunc_2_reduce_res_225509;
        int64_t flat_tid_225867 = (int64_t) 0;
        int32_t num_tasks_225959;
        
        defunc_2_reduce_res_225505 = 0.0;
        defunc_2_reduce_res_225506 = 0.0;
        defunc_2_reduce_res_225507 = 0.0;
        defunc_2_reduce_res_225508 = 0.0;
        defunc_2_reduce_res_225509 = 0.0;
        
        struct futhark_mc_task_235944 futhark_mc_task_235944;
        
        futhark_mc_task_235944.ctx = ctx;
        futhark_mc_task_235944.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235944.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235944.free_gtid_209538 = gtid_209538;
        futhark_mc_task_235944.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235944.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235944.free_gtid_224933 = gtid_224933;
        futhark_mc_task_235944.free_x_224934 = x_224934;
        futhark_mc_task_235944.free_x_225493 = x_225493;
        futhark_mc_task_235944.free_x_225494 = x_225494;
        futhark_mc_task_235944.free_defunc_0_m_fun_res_225496 =
            defunc_0_m_fun_res_225496;
        futhark_mc_task_235944.retval_defunc_2_reduce_res_225505 =
            &defunc_2_reduce_res_225505;
        futhark_mc_task_235944.retval_defunc_2_reduce_res_225506 =
            &defunc_2_reduce_res_225506;
        futhark_mc_task_235944.retval_defunc_2_reduce_res_225507 =
            &defunc_2_reduce_res_225507;
        futhark_mc_task_235944.retval_defunc_2_reduce_res_225508 =
            &defunc_2_reduce_res_225508;
        futhark_mc_task_235944.retval_defunc_2_reduce_res_225509 =
            &defunc_2_reduce_res_225509;
        
        struct scheduler_segop futhark_mc_task_235944_task;
        
        futhark_mc_task_235944_task.args = &futhark_mc_task_235944;
        futhark_mc_task_235944_task.top_level_fn =
            futhark_mc_segred_task_235945;
        futhark_mc_task_235944_task.name = "futhark_mc_segred_task_235945";
        futhark_mc_task_235944_task.iterations = q_s_203575;
        futhark_mc_task_235944_task.task_time =
            &ctx->futhark_mc_segred_task_235945_total_time;
        futhark_mc_task_235944_task.task_iter =
            &ctx->futhark_mc_segred_task_235945_total_iter;
        futhark_mc_task_235944_task.sched = STATIC;
        futhark_mc_task_235944_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235945_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235944_task);
        
        if (futhark_mc_segred_task_235945_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_225549 = defunc_2_reduce_res_225507 *
               defunc_2_reduce_res_225509;
        double y_225550 = defunc_2_reduce_res_225508 *
               defunc_2_reduce_res_225508;
        double a12_225551 = x_225549 - y_225550;
        double x_225552 = defunc_2_reduce_res_225507 *
               defunc_2_reduce_res_225508;
        double y_225553 = defunc_2_reduce_res_225506 *
               defunc_2_reduce_res_225509;
        double b12_225554 = x_225552 - y_225553;
        double x_225555 = defunc_2_reduce_res_225506 *
               defunc_2_reduce_res_225508;
        double y_225556 = defunc_2_reduce_res_225507 *
               defunc_2_reduce_res_225507;
        double c12_225557 = x_225555 - y_225556;
        double x_225558 = defunc_2_reduce_res_225505 *
               defunc_2_reduce_res_225509;
        double b2_225559 = x_225558 - y_225556;
        double x_225560 = defunc_2_reduce_res_225506 *
               defunc_2_reduce_res_225507;
        double y_225561 = defunc_2_reduce_res_225505 *
               defunc_2_reduce_res_225508;
        double c2_225562 = x_225560 - y_225561;
        double x_225563 = defunc_2_reduce_res_225505 * a12_225551;
        double y_225564 = defunc_2_reduce_res_225506 * b12_225554;
        double x_225565 = x_225563 + y_225564;
        double y_225566 = defunc_2_reduce_res_225507 * c12_225557;
        double y_225567 = x_225565 + y_225566;
        double det_225568 = 1.0 / y_225567;
        double a12_225569 = a12_225551 * det_225568;
        double b12_225570 = b12_225554 * det_225568;
        double c12_225571 = c12_225557 * det_225568;
        double b2_225572 = b2_225559 * det_225568;
        double c2_225573 = c2_225562 * det_225568;
        int64_t defunc_0_m_fun_res_225574;
        
        if (cond_225495) {
            defunc_0_m_fun_res_225574 = (int64_t) 0;
        } else {
            int64_t y_225906 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_225907 = gtid_225492 == y_225906;
            int64_t defunc_0_m_fun_res_f_res_225908;
            
            if (cond_225907) {
                int64_t defunc_0_m_fun_res_f_res_t_res_225909 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_225908 =
                    defunc_0_m_fun_res_f_res_t_res_225909;
            } else {
                int64_t x_225910 = sub64(gtid_225492, (int64_t) 1);
                int64_t x_225911 = mul64(jump_s_203581, x_225910);
                int64_t min_arg_225912 = add64((int64_t) 1, x_225911);
                int64_t min_res_225913 = smin64(defunc_0_f_res_203721,
                                                min_arg_225912);
                
                defunc_0_m_fun_res_f_res_225908 = min_res_225913;
            }
            defunc_0_m_fun_res_225574 = defunc_0_m_fun_res_f_res_225908;
        }
        
        double defunc_2_reduce_res_225583;
        double defunc_2_reduce_res_225584;
        int64_t flat_tid_225914 = (int64_t) 0;
        int32_t num_tasks_225992;
        
        defunc_2_reduce_res_225583 = 0.0;
        defunc_2_reduce_res_225584 = 0.0;
        
        struct futhark_mc_task_235953 futhark_mc_task_235953;
        
        futhark_mc_task_235953.ctx = ctx;
        futhark_mc_task_235953.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235953.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235953.free_gtid_209538 = gtid_209538;
        futhark_mc_task_235953.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235953.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235953.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235953.free_gtid_224933 = gtid_224933;
        futhark_mc_task_235953.free_x_224934 = x_224934;
        futhark_mc_task_235953.free_x_225493 = x_225493;
        futhark_mc_task_235953.free_x_225494 = x_225494;
        futhark_mc_task_235953.free_a12_225569 = a12_225569;
        futhark_mc_task_235953.free_b12_225570 = b12_225570;
        futhark_mc_task_235953.free_c12_225571 = c12_225571;
        futhark_mc_task_235953.free_b2_225572 = b2_225572;
        futhark_mc_task_235953.free_c2_225573 = c2_225573;
        futhark_mc_task_235953.free_defunc_0_m_fun_res_225574 =
            defunc_0_m_fun_res_225574;
        futhark_mc_task_235953.retval_defunc_2_reduce_res_225583 =
            &defunc_2_reduce_res_225583;
        futhark_mc_task_235953.retval_defunc_2_reduce_res_225584 =
            &defunc_2_reduce_res_225584;
        
        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_segred_task_235954;
        futhark_mc_task_235953_task.name = "futhark_mc_segred_task_235954";
        futhark_mc_task_235953_task.iterations = q_s_203575;
        futhark_mc_task_235953_task.task_time =
            &ctx->futhark_mc_segred_task_235954_total_time;
        futhark_mc_task_235953_task.task_iter =
            &ctx->futhark_mc_segred_task_235954_total_iter;
        futhark_mc_task_235953_task.sched = STATIC;
        futhark_mc_task_235953_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235954_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235953_task);
        
        if (futhark_mc_segred_task_235954_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_224935.mem)[gtid_225492] = defunc_2_reduce_res_225583;
        ((double *) mem_224936.mem)[gtid_225492] = defunc_2_reduce_res_225584;
    }
    
  cleanup:
    { }
    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_nested_task_235941(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_225491 = tid;
    int num_tasks_225758 = info.nsubtasks;
    struct futhark_mc_task_235937 *futhark_mc_task_235937 =
                                  (struct futhark_mc_task_235937 *) args;
    struct futhark_context *ctx = futhark_mc_task_235937->ctx;
    uint64_t futhark_mc_segmap_nested_task_235941_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235941_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235937->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235937->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235937->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235937->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235937->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235937->free_s_n_m_203726;
    int64_t gtid_209538 = futhark_mc_task_235937->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235937->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235937->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235937->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235937->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235937->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_224933 = futhark_mc_task_235937->free_gtid_224933;
    int64_t x_224934 = futhark_mc_task_235937->free_x_224934;
    struct memblock mem_224935 = {.desc ="mem_224935", .mem =
                                  futhark_mc_task_235937->free_mem_224935,
                                  .size =0, .references =NULL};
    struct memblock mem_224936 = {.desc ="mem_224936", .mem =
                                  futhark_mc_task_235937->free_mem_224936,
                                  .size =0, .references =NULL};
    int64_t iter_225858;
    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_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235942.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235942.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235942.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235942.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235942.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235942.free_gtid_209538 = gtid_209538;
    futhark_mc_segmap_parloop_struct_235942.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235942.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235942.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235942.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235942.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235942.free_gtid_224933 = gtid_224933;
    futhark_mc_segmap_parloop_struct_235942.free_x_224934 = x_224934;
    futhark_mc_segmap_parloop_struct_235942.free_mem_224935 = mem_224935.mem;
    futhark_mc_segmap_parloop_struct_235942.free_mem_224936 = mem_224936.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_nested_task_235941_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235941_end -
                 futhark_mc_segmap_nested_task_235941_start;
        
        ctx->futhark_mc_segmap_nested_task_235941_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235941_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235941_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235934(void *args, int64_t start,
                                            int64_t end, int flat_tid_224932,
                                            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_203574 =
            futhark_mc_segmap_parloop_struct_235933->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235933->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235933->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235933->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235933->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235933->free_s_n_m_203726;
    int64_t gtid_209538 =
            futhark_mc_segmap_parloop_struct_235933->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235933->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235933->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235933->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235933->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235933->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235933->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235933->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218433 = {.desc ="mem_218433", .mem =
                                  futhark_mc_segmap_parloop_struct_235933->free_mem_218433,
                                  .size =0, .references =NULL};
    struct memblock mem_218437 = {.desc ="mem_218437", .mem =
                                  futhark_mc_segmap_parloop_struct_235933->free_mem_218437,
                                  .size =0, .references =NULL};
    size_t mem_224935_cached_sizze_235935 = 0;
    unsigned char *mem_224935 = NULL;
    size_t mem_224936_cached_sizze_235936 = 0;
    unsigned char *mem_224936 = NULL;
    int64_t iterations = end - start;
    int64_t iter_225490 = start;
    
    if (mem_224935_cached_sizze_235935 < (size_t) bytes_217663) {
        mem_224935 = realloc(mem_224935, bytes_217663);
        mem_224935_cached_sizze_235935 = bytes_217663;
    }
    if (mem_224936_cached_sizze_235936 < (size_t) bytes_217663) {
        mem_224936 = realloc(mem_224936, bytes_217663);
        mem_224936_cached_sizze_235936 = bytes_217663;
    }
    for (; iter_225490 < end; iter_225490++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225756 = n_p_203574;
        int64_t gtid_224933 = iter_225490;
        int64_t remnant_225757 = iter_225490 - gtid_224933;
        int64_t x_224934;
        
        x_224934 = ((int64_t *) mem_217658.mem)[gtid_209538 * n_p_203574 +
                                                gtid_224933];
        
        int64_t flat_tid_225628 = (int64_t) 0;
        int32_t num_tasks_225758;
        int64_t flat_tid_225491 = (int64_t) 0;
        struct futhark_mc_task_235937 futhark_mc_task_235937;
        
        futhark_mc_task_235937.ctx = ctx;
        futhark_mc_task_235937.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235937.free_q_s_203575 = q_s_203575;
        futhark_mc_task_235937.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235937.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235937.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235937.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235937.free_gtid_209538 = gtid_209538;
        futhark_mc_task_235937.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235937.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_235937.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_235937.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235937.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235937.free_gtid_224933 = gtid_224933;
        futhark_mc_task_235937.free_x_224934 = x_224934;
        futhark_mc_task_235937.free_mem_224935 = mem_224935;
        futhark_mc_task_235937.free_mem_224936 = mem_224936;
        
        struct scheduler_segop futhark_mc_task_235937_task;
        
        futhark_mc_task_235937_task.args = &futhark_mc_task_235937;
        futhark_mc_task_235937_task.top_level_fn =
            futhark_mc_segmap_task_235938;
        futhark_mc_task_235937_task.name = "futhark_mc_segmap_task_235938";
        futhark_mc_task_235937_task.iterations = s_n_m_203726;
        futhark_mc_task_235937_task.task_time =
            &ctx->futhark_mc_segmap_task_235938_total_time;
        futhark_mc_task_235937_task.task_iter =
            &ctx->futhark_mc_segmap_task_235938_total_iter;
        futhark_mc_task_235937_task.sched = STATIC;
        futhark_mc_task_235937_task.nested_fn =
            futhark_mc_segmap_nested_task_235941;
        
        int futhark_mc_segmap_task_235938_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235937_task);
        
        if (futhark_mc_segmap_task_235938_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218433.mem + gtid_224933 * s_n_m_203726 * (int64_t) 8,
                    mem_224935 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218437.mem + gtid_224933 * s_n_m_203726 * (int64_t) 8,
                    mem_224936 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_224935);
    free(mem_224936);
    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_nested_task_235932(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_224932 = tid;
    int num_tasks_225346 = info.nsubtasks;
    struct futhark_mc_task_235926 *futhark_mc_task_235926 =
                                  (struct futhark_mc_task_235926 *) args;
    struct futhark_context *ctx = futhark_mc_task_235926->ctx;
    uint64_t futhark_mc_segmap_nested_task_235932_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235932_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235926->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235926->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235926->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235926->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235926->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235926->free_s_n_m_203726;
    int64_t gtid_209538 = futhark_mc_task_235926->free_gtid_209538;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235926->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235926->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235926->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235926->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235926->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235926->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235926->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218433 = {.desc ="mem_218433", .mem =
                                  futhark_mc_task_235926->free_mem_218433,
                                  .size =0, .references =NULL};
    struct memblock mem_218437 = {.desc ="mem_218437", .mem =
                                  futhark_mc_task_235926->free_mem_218437,
                                  .size =0, .references =NULL};
    int64_t iter_225490;
    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_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235933.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235933.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235933.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235933.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235933.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235933.free_gtid_209538 = gtid_209538;
    futhark_mc_segmap_parloop_struct_235933.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235933.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235933.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235933.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235933.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235933.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235933.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235933.free_mem_218433 = mem_218433.mem;
    futhark_mc_segmap_parloop_struct_235933.free_mem_218437 = mem_218437.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_nested_task_235932_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235932_end -
                 futhark_mc_segmap_nested_task_235932_start;
        
        ctx->futhark_mc_segmap_nested_task_235932_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235932_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235932_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235923(void *args, int64_t start,
                                            int64_t end, int flat_tid_209537,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235922
    *futhark_mc_segmap_parloop_struct_235922 =
    (struct futhark_mc_segmap_parloop_struct_235922 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235922->ctx;
    uint64_t futhark_mc_segmap_parloop_235923_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235923_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235922->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235922->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235922->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235922->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235922->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235922->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235922->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235922->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235922->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235922->free_bytes_217663;
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235922->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235922->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235922->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235922->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235922->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218530 = {.desc ="mem_218530", .mem =
                                  futhark_mc_segmap_parloop_struct_235922->free_mem_218530,
                                  .size =0, .references =NULL};
    struct memblock mem_218535 = {.desc ="mem_218535", .mem =
                                  futhark_mc_segmap_parloop_struct_235922->free_mem_218535,
                                  .size =0, .references =NULL};
    size_t mem_218433_cached_sizze_235924 = 0;
    unsigned char *mem_218433 = NULL;
    size_t mem_218437_cached_sizze_235925 = 0;
    unsigned char *mem_218437 = NULL;
    int64_t iterations = end - start;
    int64_t iter_224931 = start;
    
    if (mem_218433_cached_sizze_235924 < (size_t) bytes_217715) {
        mem_218433 = realloc(mem_218433, bytes_217715);
        mem_218433_cached_sizze_235924 = bytes_217715;
    }
    if (mem_218437_cached_sizze_235925 < (size_t) bytes_217715) {
        mem_218437 = realloc(mem_218437, bytes_217715);
        mem_218437_cached_sizze_235925 = bytes_217715;
    }
    for (; iter_224931 < end; iter_224931++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_225344 = partition_sizze_203667;
        int64_t gtid_209538 = iter_224931;
        int64_t remnant_225345 = iter_224931 - gtid_209538;
        int64_t flat_tid_225204 = (int64_t) 0;
        int32_t num_tasks_225346;
        int64_t flat_tid_224932 = (int64_t) 0;
        struct futhark_mc_task_235926 futhark_mc_task_235926;
        
        futhark_mc_task_235926.ctx = ctx;
        futhark_mc_task_235926.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235926.free_q_s_203575 = q_s_203575;
        futhark_mc_task_235926.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235926.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235926.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235926.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235926.free_gtid_209538 = gtid_209538;
        futhark_mc_task_235926.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235926.free_mem_217658 = mem_217658.mem;
        futhark_mc_task_235926.free_bytes_217663 = bytes_217663;
        futhark_mc_task_235926.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_235926.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_235926.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235926.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235926.free_mem_218433 = mem_218433;
        futhark_mc_task_235926.free_mem_218437 = mem_218437;
        
        struct scheduler_segop futhark_mc_task_235926_task;
        
        futhark_mc_task_235926_task.args = &futhark_mc_task_235926;
        futhark_mc_task_235926_task.top_level_fn =
            futhark_mc_segmap_task_235927;
        futhark_mc_task_235926_task.name = "futhark_mc_segmap_task_235927";
        futhark_mc_task_235926_task.iterations = n_p_203574;
        futhark_mc_task_235926_task.task_time =
            &ctx->futhark_mc_segmap_task_235927_total_time;
        futhark_mc_task_235926_task.task_iter =
            &ctx->futhark_mc_segmap_task_235927_total_iter;
        futhark_mc_task_235926_task.sched = STATIC;
        futhark_mc_task_235926_task.nested_fn =
            futhark_mc_segmap_nested_task_235932;
        
        int futhark_mc_segmap_task_235927_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235926_task);
        
        if (futhark_mc_segmap_task_235927_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218530.mem + gtid_209538 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218433 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218535.mem + gtid_209538 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218437 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218433);
    free(mem_218437);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235923_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235923_end -
                 futhark_mc_segmap_parloop_235923_start;
        
        ctx->futhark_mc_segmap_parloop_235923_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235923_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235923_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235921(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_209537 = tid;
    int num_tasks_224779 = info.nsubtasks;
    struct futhark_mc_task_235915 *futhark_mc_task_235915 =
                                  (struct futhark_mc_task_235915 *) args;
    struct futhark_context *ctx = futhark_mc_task_235915->ctx;
    uint64_t futhark_mc_segmap_nested_task_235921_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235921_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235915->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235915->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235915->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235915->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235915->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235915->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235915->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235915->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235915->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235915->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235915->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235915->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235915->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235915->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235915->free_mem_218175,
                                  .size =0, .references =NULL};
    struct memblock mem_218530 = {.desc ="mem_218530", .mem =
                                  futhark_mc_task_235915->free_mem_218530,
                                  .size =0, .references =NULL};
    struct memblock mem_218535 = {.desc ="mem_218535", .mem =
                                  futhark_mc_task_235915->free_mem_218535,
                                  .size =0, .references =NULL};
    int64_t iter_224931;
    struct futhark_mc_segmap_parloop_struct_235922
    futhark_mc_segmap_parloop_struct_235922;
    
    futhark_mc_segmap_parloop_struct_235922.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235922.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235922.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235922.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235922.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235922.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235922.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235922.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235922.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235922.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235922.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235922.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235922.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235922.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235922.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235922.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235922.free_mem_218530 = mem_218530.mem;
    futhark_mc_segmap_parloop_struct_235922.free_mem_218535 = mem_218535.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235923_task;
    
    futhark_mc_segmap_parloop_235923_task.name =
        "futhark_mc_segmap_parloop_235923";
    futhark_mc_segmap_parloop_235923_task.fn = futhark_mc_segmap_parloop_235923;
    futhark_mc_segmap_parloop_235923_task.args =
        &futhark_mc_segmap_parloop_struct_235922;
    futhark_mc_segmap_parloop_235923_task.iterations = iterations;
    futhark_mc_segmap_parloop_235923_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235923_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235923_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235923_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235923_task);
    
    if (futhark_mc_segmap_parloop_235923_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235923_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235923_total_end -
                 futhark_mc_segmap_parloop_235923_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235923_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235923_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235923_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235921_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235921_end -
                 futhark_mc_segmap_nested_task_235921_start;
        
        ctx->futhark_mc_segmap_nested_task_235921_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235921_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235921_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235959 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218546;
    unsigned char *free_mem_218663;
};
struct futhark_mc_segmap_parloop_struct_235961 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218546;
    unsigned char *free_mem_218663;
};
static int futhark_mc_segmap_parloop_235962(void *args, int64_t start,
                                            int64_t end, int flat_tid_209977,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235961
    *futhark_mc_segmap_parloop_struct_235961 =
    (struct futhark_mc_segmap_parloop_struct_235961 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235961->ctx;
    uint64_t futhark_mc_segmap_parloop_235962_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235962_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235961->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235961->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235961->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235961->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235961->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235961->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235961->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235961->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235961->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235961->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235961->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235961->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235961->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235961->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 =
            futhark_mc_segmap_parloop_struct_235961->free_bytes_218546;
    struct memblock mem_218663 = {.desc ="mem_218663", .mem =
                                  futhark_mc_segmap_parloop_struct_235961->free_mem_218663,
                                  .size =0, .references =NULL};
    size_t mem_218603_cached_sizze_235963 = 0;
    unsigned char *mem_218603 = NULL;
    size_t mem_218627_cached_sizze_235964 = 0;
    unsigned char *mem_218627 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226011 = start;
    
    if (mem_218603_cached_sizze_235963 < (size_t) bytes_217715) {
        mem_218603 = realloc(mem_218603, bytes_217715);
        mem_218603_cached_sizze_235963 = bytes_217715;
    }
    if (mem_218627_cached_sizze_235964 < (size_t) bytes_218546) {
        mem_218627 = realloc(mem_218627, bytes_218546);
        mem_218627_cached_sizze_235964 = bytes_218546;
    }
    for (; iter_226011 < end; iter_226011++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226069 = partition_sizze_203667;
        int64_t gtid_209978 = iter_226011;
        int64_t remnant_226070 = iter_226011 - gtid_209978;
        
        for (int64_t i_226012 = 0; i_226012 < n_p_203574; i_226012++) {
            int64_t x_226014;
            
            x_226014 = ((int64_t *) mem_217658.mem)[gtid_209978 * n_p_203574 +
                                                    i_226012];
            for (int64_t i_226016 = 0; i_226016 < s_n_m_203726; i_226016++) {
                int64_t x_226018;
                
                x_226018 = ((int64_t *) mem_217828.mem)[gtid_209978 *
                                                        (s_n_m_203726 *
                                                         n_p_203574) +
                                                        i_226012 *
                                                        s_n_m_203726 +
                                                        i_226016];
                
                double x_226019;
                
                x_226019 = ((double *) mem_217833.mem)[gtid_209978 *
                                                       (s_n_m_203726 *
                                                        n_p_203574) + i_226012 *
                                                       s_n_m_203726 + i_226016];
                
                bool cond_226020 = i_226016 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_226021;
                
                if (cond_226020) {
                    defunc_0_m_fun_res_226021 = (int64_t) 0;
                } else {
                    int64_t y_226022 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_226023 = i_226016 == y_226022;
                    int64_t defunc_0_m_fun_res_f_res_226024;
                    
                    if (cond_226023) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_226025 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_226024 =
                            defunc_0_m_fun_res_f_res_t_res_226025;
                    } else {
                        int64_t x_226026 = sub64(i_226016, (int64_t) 1);
                        int64_t x_226027 = mul64(jump_s_203581, x_226026);
                        int64_t min_arg_226028 = add64((int64_t) 1, x_226027);
                        int64_t min_res_226029 = smin64(defunc_0_f_res_203721,
                                                        min_arg_226028);
                        
                        defunc_0_m_fun_res_f_res_226024 = min_res_226029;
                    }
                    defunc_0_m_fun_res_226021 = defunc_0_m_fun_res_f_res_226024;
                }
                
                double defunc_2_reduce_res_226031;
                double redout_226034 = 0.0;
                
                for (int64_t i_226033 = 0; i_226033 < q_s_203575; i_226033++) {
                    bool cond_226036 = sle64(x_226014, i_226033);
                    int64_t defunc_0_f_res_226037;
                    
                    if (cond_226036) {
                        defunc_0_f_res_226037 = (int64_t) 0;
                    } else {
                        int64_t i_226038 = add64(x_226018, i_226033);
                        int64_t defunc_0_add_arg_226039;
                        
                        defunc_0_add_arg_226039 =
                            ((int64_t *) mem_217654.mem)[gtid_209978 *
                                                         (defunc_0_f_res_203721 *
                                                          n_p_203574) +
                                                         i_226012 *
                                                         defunc_0_f_res_203721 +
                                                         i_226038];
                        
                        int64_t defunc_1_add_res_226040 = add64((int64_t) 1,
                                                                defunc_0_add_arg_226039);
                        
                        defunc_0_f_res_226037 = defunc_1_add_res_226040;
                    }
                    
                    double defunc_0_f_res_226041;
                    
                    if (cond_226036) {
                        defunc_0_f_res_226041 = 0.0;
                    } else {
                        int64_t i_226042 = add64(x_226018, i_226033);
                        double defunc_0_add_arg_226043;
                        
                        defunc_0_add_arg_226043 =
                            ((double *) mem_218175.mem)[gtid_209978 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_226012 *
                                                        defunc_0_f_res_203721 +
                                                        i_226042];
                        defunc_0_f_res_226041 = defunc_0_add_arg_226043;
                    }
                    
                    int64_t binop_p_226044 = sub64(defunc_0_f_res_226037,
                                                   defunc_0_m_fun_res_226021);
                    double defunc_0_f_res_226045 =
                           sitofp_i64_f64(binop_p_226044);
                    double abs_res_226046 = fabs(defunc_0_f_res_226045);
                    double tmp1_226047 = abs_res_226046 / x_226019;
                    double x_226048 = tmp1_226047 * tmp1_226047;
                    double y_226049 = tmp1_226047 * x_226048;
                    double tmp2_226050 = 1.0 - y_226049;
                    double x_226051 = tmp2_226050 * tmp2_226050;
                    double tmp3_226052 = tmp2_226050 * x_226051;
                    double tmp4_226053 = defunc_0_f_res_226041 * tmp3_226052;
                    double defunc_1_op_res_226054 = tmp4_226053 + redout_226034;
                    
                    ((double *) mem_218627)[i_226033] = tmp4_226053;
                    
                    double redout_tmp_226073 = defunc_1_op_res_226054;
                    
                    redout_226034 = redout_tmp_226073;
                }
                defunc_2_reduce_res_226031 = redout_226034;
                
                double a0_226056 = 1.0 / defunc_2_reduce_res_226031;
                double defunc_2_reduce_res_226057;
                double redout_226059 = 0.0;
                
                for (int64_t i_226058 = 0; i_226058 < q_s_203575; i_226058++) {
                    double x_226060;
                    
                    x_226060 = ((double *) mem_218627)[i_226058];
                    
                    bool cond_226061 = sle64(x_226014, i_226058);
                    double defunc_0_f_res_226062;
                    
                    if (cond_226061) {
                        defunc_0_f_res_226062 = 0.0;
                    } else {
                        int64_t i_226063 = add64(x_226018, i_226058);
                        double defunc_0_add_arg_226064;
                        
                        defunc_0_add_arg_226064 =
                            ((double *) mem_218170.mem)[gtid_209978 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_226012 *
                                                        defunc_0_f_res_203721 +
                                                        i_226063];
                        defunc_0_f_res_226062 = defunc_0_add_arg_226064;
                    }
                    
                    double x_226065 = a0_226056 * x_226060;
                    double defunc_9_fit_fun_res_226066 = defunc_0_f_res_226062 *
                           x_226065;
                    double defunc_1_op_res_226067 =
                           defunc_9_fit_fun_res_226066 + redout_226059;
                    double redout_tmp_226075 = defunc_1_op_res_226067;
                    
                    redout_226059 = redout_tmp_226075;
                }
                defunc_2_reduce_res_226057 = redout_226059;
                ((double *) mem_218603)[i_226012 * s_n_m_203726 + i_226016] =
                    defunc_2_reduce_res_226057;
            }
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218663.mem + gtid_209978 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218603 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218603);
    free(mem_218627);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235962_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235962_end -
                 futhark_mc_segmap_parloop_235962_start;
        
        ctx->futhark_mc_segmap_parloop_235962_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235962_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235962_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235960(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_209977 = tid;
    int num_tasks_226010 = info.nsubtasks;
    struct futhark_mc_task_235959 *futhark_mc_task_235959 =
                                  (struct futhark_mc_task_235959 *) args;
    struct futhark_context *ctx = futhark_mc_task_235959->ctx;
    uint64_t futhark_mc_segmap_task_235960_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235960_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235959->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235959->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235959->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235959->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235959->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235959->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235959->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235959->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235959->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235959->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235959->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235959->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235959->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235959->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235959->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 = futhark_mc_task_235959->free_bytes_218546;
    struct memblock mem_218663 = {.desc ="mem_218663", .mem =
                                  futhark_mc_task_235959->free_mem_218663,
                                  .size =0, .references =NULL};
    int64_t iter_226011;
    struct futhark_mc_segmap_parloop_struct_235961
    futhark_mc_segmap_parloop_struct_235961;
    
    futhark_mc_segmap_parloop_struct_235961.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235961.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235961.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235961.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235961.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235961.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235961.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235961.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235961.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235961.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235961.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235961.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235961.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235961.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235961.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235961.free_bytes_218546 = bytes_218546;
    futhark_mc_segmap_parloop_struct_235961.free_mem_218663 = mem_218663.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235962_task;
    
    futhark_mc_segmap_parloop_235962_task.name =
        "futhark_mc_segmap_parloop_235962";
    futhark_mc_segmap_parloop_235962_task.fn = futhark_mc_segmap_parloop_235962;
    futhark_mc_segmap_parloop_235962_task.args =
        &futhark_mc_segmap_parloop_struct_235961;
    futhark_mc_segmap_parloop_235962_task.iterations = iterations;
    futhark_mc_segmap_parloop_235962_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235962_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235962_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235962_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235962_task);
    
    if (futhark_mc_segmap_parloop_235962_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235962_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235962_total_end -
                 futhark_mc_segmap_parloop_235962_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235962_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235962_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235962_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235960_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235960_end -
                 futhark_mc_segmap_task_235960_start;
        
        ctx->futhark_mc_segmap_task_235960_runs[tid]++;
        ctx->futhark_mc_segmap_task_235960_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235960_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235966 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218546;
    unsigned char *free_mem_218663;
};
struct futhark_mc_task_235969 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210167;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218546;
    unsigned char *free_mem_218599;
};
struct futhark_mc_segmap_parloop_struct_235971 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210167;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218546;
    unsigned char *free_mem_218599;
};
static int futhark_mc_segmap_parloop_235972(void *args, int64_t start,
                                            int64_t end, int flat_tid_226189,
                                            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_203574 =
            futhark_mc_segmap_parloop_struct_235971->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235971->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235971->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235971->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235971->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235971->free_s_n_m_203726;
    int64_t gtid_210167 =
            futhark_mc_segmap_parloop_struct_235971->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235971->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235971->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235971->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235971->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235971->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235971->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235971->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 =
            futhark_mc_segmap_parloop_struct_235971->free_bytes_218546;
    struct memblock mem_218599 = {.desc ="mem_218599", .mem =
                                  futhark_mc_segmap_parloop_struct_235971->free_mem_218599,
                                  .size =0, .references =NULL};
    size_t mem_226192_cached_sizze_235973 = 0;
    unsigned char *mem_226192 = NULL;
    size_t mem_226194_cached_sizze_235974 = 0;
    unsigned char *mem_226194 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226252 = start;
    
    if (mem_226192_cached_sizze_235973 < (size_t) bytes_217663) {
        mem_226192 = realloc(mem_226192, bytes_217663);
        mem_226192_cached_sizze_235973 = bytes_217663;
    }
    if (mem_226194_cached_sizze_235974 < (size_t) bytes_218546) {
        mem_226194 = realloc(mem_226194, bytes_218546);
        mem_226194_cached_sizze_235974 = bytes_218546;
    }
    for (; iter_226252 < end; iter_226252++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226306 = n_p_203574;
        int64_t gtid_226190 = iter_226252;
        int64_t remnant_226307 = iter_226252 - gtid_226190;
        int64_t x_226191;
        
        x_226191 = ((int64_t *) mem_217658.mem)[gtid_210167 * n_p_203574 +
                                                gtid_226190];
        for (int64_t i_226253 = 0; i_226253 < s_n_m_203726; i_226253++) {
            int64_t x_226255;
            
            x_226255 = ((int64_t *) mem_217828.mem)[gtid_210167 *
                                                    (s_n_m_203726 *
                                                     n_p_203574) + gtid_226190 *
                                                    s_n_m_203726 + i_226253];
            
            double x_226256;
            
            x_226256 = ((double *) mem_217833.mem)[gtid_210167 * (s_n_m_203726 *
                                                                  n_p_203574) +
                                                   gtid_226190 * s_n_m_203726 +
                                                   i_226253];
            
            bool cond_226257 = i_226253 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_226258;
            
            if (cond_226257) {
                defunc_0_m_fun_res_226258 = (int64_t) 0;
            } else {
                int64_t y_226259 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_226260 = i_226253 == y_226259;
                int64_t defunc_0_m_fun_res_f_res_226261;
                
                if (cond_226260) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_226262 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_226261 =
                        defunc_0_m_fun_res_f_res_t_res_226262;
                } else {
                    int64_t x_226263 = sub64(i_226253, (int64_t) 1);
                    int64_t x_226264 = mul64(jump_s_203581, x_226263);
                    int64_t min_arg_226265 = add64((int64_t) 1, x_226264);
                    int64_t min_res_226266 = smin64(defunc_0_f_res_203721,
                                                    min_arg_226265);
                    
                    defunc_0_m_fun_res_f_res_226261 = min_res_226266;
                }
                defunc_0_m_fun_res_226258 = defunc_0_m_fun_res_f_res_226261;
            }
            
            double defunc_2_reduce_res_226268;
            double redout_226271 = 0.0;
            
            for (int64_t i_226270 = 0; i_226270 < q_s_203575; i_226270++) {
                bool cond_226273 = sle64(x_226191, i_226270);
                int64_t defunc_0_f_res_226274;
                
                if (cond_226273) {
                    defunc_0_f_res_226274 = (int64_t) 0;
                } else {
                    int64_t i_226275 = add64(x_226255, i_226270);
                    int64_t defunc_0_add_arg_226276;
                    
                    defunc_0_add_arg_226276 =
                        ((int64_t *) mem_217654.mem)[gtid_210167 *
                                                     (defunc_0_f_res_203721 *
                                                      n_p_203574) +
                                                     gtid_226190 *
                                                     defunc_0_f_res_203721 +
                                                     i_226275];
                    
                    int64_t defunc_1_add_res_226277 = add64((int64_t) 1,
                                                            defunc_0_add_arg_226276);
                    
                    defunc_0_f_res_226274 = defunc_1_add_res_226277;
                }
                
                double defunc_0_f_res_226278;
                
                if (cond_226273) {
                    defunc_0_f_res_226278 = 0.0;
                } else {
                    int64_t i_226279 = add64(x_226255, i_226270);
                    double defunc_0_add_arg_226280;
                    
                    defunc_0_add_arg_226280 =
                        ((double *) mem_218175.mem)[gtid_210167 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_226190 *
                                                    defunc_0_f_res_203721 +
                                                    i_226279];
                    defunc_0_f_res_226278 = defunc_0_add_arg_226280;
                }
                
                int64_t binop_p_226281 = sub64(defunc_0_f_res_226274,
                                               defunc_0_m_fun_res_226258);
                double defunc_0_f_res_226282 = sitofp_i64_f64(binop_p_226281);
                double abs_res_226283 = fabs(defunc_0_f_res_226282);
                double tmp1_226284 = abs_res_226283 / x_226256;
                double x_226285 = tmp1_226284 * tmp1_226284;
                double y_226286 = tmp1_226284 * x_226285;
                double tmp2_226287 = 1.0 - y_226286;
                double x_226288 = tmp2_226287 * tmp2_226287;
                double tmp3_226289 = tmp2_226287 * x_226288;
                double tmp4_226290 = defunc_0_f_res_226278 * tmp3_226289;
                double defunc_1_op_res_226291 = tmp4_226290 + redout_226271;
                
                ((double *) mem_226194)[i_226270] = tmp4_226290;
                
                double redout_tmp_226309 = defunc_1_op_res_226291;
                
                redout_226271 = redout_tmp_226309;
            }
            defunc_2_reduce_res_226268 = redout_226271;
            
            double a0_226293 = 1.0 / defunc_2_reduce_res_226268;
            double defunc_2_reduce_res_226294;
            double redout_226296 = 0.0;
            
            for (int64_t i_226295 = 0; i_226295 < q_s_203575; i_226295++) {
                double x_226297;
                
                x_226297 = ((double *) mem_226194)[i_226295];
                
                bool cond_226298 = sle64(x_226191, i_226295);
                double defunc_0_f_res_226299;
                
                if (cond_226298) {
                    defunc_0_f_res_226299 = 0.0;
                } else {
                    int64_t i_226300 = add64(x_226255, i_226295);
                    double defunc_0_add_arg_226301;
                    
                    defunc_0_add_arg_226301 =
                        ((double *) mem_218170.mem)[gtid_210167 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_226190 *
                                                    defunc_0_f_res_203721 +
                                                    i_226300];
                    defunc_0_f_res_226299 = defunc_0_add_arg_226301;
                }
                
                double x_226302 = a0_226293 * x_226297;
                double defunc_9_fit_fun_res_226303 = defunc_0_f_res_226299 *
                       x_226302;
                double defunc_1_op_res_226304 = defunc_9_fit_fun_res_226303 +
                       redout_226296;
                double redout_tmp_226311 = defunc_1_op_res_226304;
                
                redout_226296 = redout_tmp_226311;
            }
            defunc_2_reduce_res_226294 = redout_226296;
            ((double *) mem_226192)[i_226253] = defunc_2_reduce_res_226294;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218599.mem + gtid_226190 * s_n_m_203726 * (int64_t) 8,
                    mem_226192 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_226192);
    free(mem_226194);
    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_task_235970(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226189 = tid;
    int num_tasks_226251 = info.nsubtasks;
    struct futhark_mc_task_235969 *futhark_mc_task_235969 =
                                  (struct futhark_mc_task_235969 *) args;
    struct futhark_context *ctx = futhark_mc_task_235969->ctx;
    uint64_t futhark_mc_segmap_task_235970_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235970_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235969->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235969->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235969->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235969->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235969->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235969->free_s_n_m_203726;
    int64_t gtid_210167 = futhark_mc_task_235969->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235969->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235969->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235969->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235969->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235969->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235969->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235969->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 = futhark_mc_task_235969->free_bytes_218546;
    struct memblock mem_218599 = {.desc ="mem_218599", .mem =
                                  futhark_mc_task_235969->free_mem_218599,
                                  .size =0, .references =NULL};
    int64_t iter_226252;
    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_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235971.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235971.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235971.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235971.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235971.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235971.free_gtid_210167 = gtid_210167;
    futhark_mc_segmap_parloop_struct_235971.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235971.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235971.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235971.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235971.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235971.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235971.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235971.free_bytes_218546 = bytes_218546;
    futhark_mc_segmap_parloop_struct_235971.free_mem_218599 = mem_218599.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_task_235970_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235970_end -
                 futhark_mc_segmap_task_235970_start;
        
        ctx->futhark_mc_segmap_task_235970_runs[tid]++;
        ctx->futhark_mc_segmap_task_235970_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235970_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235976 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210167;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218546;
    unsigned char *free_mem_218599;
};
struct futhark_mc_task_235979 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210167;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218546;
    int64_t free_gtid_226078;
    int64_t free_x_226079;
    unsigned char *free_mem_226080;
};
struct futhark_mc_segmap_parloop_struct_235981 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210167;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218546;
    int64_t free_gtid_226078;
    int64_t free_x_226079;
    unsigned char *free_mem_226080;
};
static int futhark_mc_segmap_parloop_235982(void *args, int64_t start,
                                            int64_t end, int flat_tid_226367,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235981
    *futhark_mc_segmap_parloop_struct_235981 =
    (struct futhark_mc_segmap_parloop_struct_235981 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235981->ctx;
    uint64_t futhark_mc_segmap_parloop_235982_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235982_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235981->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235981->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235981->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235981->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235981->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235981->free_s_n_m_203726;
    int64_t gtid_210167 =
            futhark_mc_segmap_parloop_struct_235981->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235981->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235981->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235981->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235981->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235981->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 =
            futhark_mc_segmap_parloop_struct_235981->free_bytes_218546;
    int64_t gtid_226078 =
            futhark_mc_segmap_parloop_struct_235981->free_gtid_226078;
    int64_t x_226079 = futhark_mc_segmap_parloop_struct_235981->free_x_226079;
    struct memblock mem_226080 = {.desc ="mem_226080", .mem =
                                  futhark_mc_segmap_parloop_struct_235981->free_mem_226080,
                                  .size =0, .references =NULL};
    size_t mem_226381_cached_sizze_235983 = 0;
    unsigned char *mem_226381 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226423 = start;
    
    if (mem_226381_cached_sizze_235983 < (size_t) bytes_218546) {
        mem_226381 = realloc(mem_226381, bytes_218546);
        mem_226381_cached_sizze_235983 = bytes_218546;
    }
    for (; iter_226423 < end; iter_226423++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226465 = s_n_m_203726;
        int64_t gtid_226368 = iter_226423;
        int64_t remnant_226466 = iter_226423 - gtid_226368;
        int64_t x_226369;
        
        x_226369 = ((int64_t *) mem_217828.mem)[gtid_210167 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_226078 * s_n_m_203726 +
                                                gtid_226368];
        
        double x_226370;
        
        x_226370 = ((double *) mem_217833.mem)[gtid_210167 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_226078 * s_n_m_203726 +
                                               gtid_226368];
        
        bool cond_226371 = gtid_226368 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_226372;
        
        if (cond_226371) {
            defunc_0_m_fun_res_226372 = (int64_t) 0;
        } else {
            int64_t y_226424 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_226425 = gtid_226368 == y_226424;
            int64_t defunc_0_m_fun_res_f_res_226426;
            
            if (cond_226425) {
                int64_t defunc_0_m_fun_res_f_res_t_res_226427 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_226426 =
                    defunc_0_m_fun_res_f_res_t_res_226427;
            } else {
                int64_t x_226428 = sub64(gtid_226368, (int64_t) 1);
                int64_t x_226429 = mul64(jump_s_203581, x_226428);
                int64_t min_arg_226430 = add64((int64_t) 1, x_226429);
                int64_t min_res_226431 = smin64(defunc_0_f_res_203721,
                                                min_arg_226430);
                
                defunc_0_m_fun_res_f_res_226426 = min_res_226431;
            }
            defunc_0_m_fun_res_226372 = defunc_0_m_fun_res_f_res_226426;
        }
        
        double defunc_2_reduce_res_226383;
        double redout_226433 = 0.0;
        
        for (int64_t i_226432 = 0; i_226432 < q_s_203575; i_226432++) {
            bool cond_226435 = sle64(x_226079, i_226432);
            int64_t defunc_0_f_res_226436;
            
            if (cond_226435) {
                defunc_0_f_res_226436 = (int64_t) 0;
            } else {
                int64_t i_226437 = add64(x_226369, i_226432);
                int64_t defunc_0_add_arg_226438;
                
                defunc_0_add_arg_226438 =
                    ((int64_t *) mem_217654.mem)[gtid_210167 *
                                                 (defunc_0_f_res_203721 *
                                                  n_p_203574) + gtid_226078 *
                                                 defunc_0_f_res_203721 +
                                                 i_226437];
                
                int64_t defunc_1_add_res_226439 = add64((int64_t) 1,
                                                        defunc_0_add_arg_226438);
                
                defunc_0_f_res_226436 = defunc_1_add_res_226439;
            }
            
            double defunc_0_f_res_226440;
            
            if (cond_226435) {
                defunc_0_f_res_226440 = 0.0;
            } else {
                int64_t i_226441 = add64(x_226369, i_226432);
                double defunc_0_add_arg_226442;
                
                defunc_0_add_arg_226442 =
                    ((double *) mem_218175.mem)[gtid_210167 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_226078 *
                                                defunc_0_f_res_203721 +
                                                i_226441];
                defunc_0_f_res_226440 = defunc_0_add_arg_226442;
            }
            
            int64_t binop_p_226443 = sub64(defunc_0_f_res_226436,
                                           defunc_0_m_fun_res_226372);
            double defunc_0_f_res_226444 = sitofp_i64_f64(binop_p_226443);
            double abs_res_226445 = fabs(defunc_0_f_res_226444);
            double tmp1_226446 = abs_res_226445 / x_226370;
            double x_226447 = tmp1_226446 * tmp1_226446;
            double y_226448 = tmp1_226446 * x_226447;
            double tmp2_226449 = 1.0 - y_226448;
            double x_226450 = tmp2_226449 * tmp2_226449;
            double tmp3_226451 = tmp2_226449 * x_226450;
            double tmp4_226452 = defunc_0_f_res_226440 * tmp3_226451;
            double defunc_1_op_res_226453 = tmp4_226452 + redout_226433;
            
            ((double *) mem_226381)[i_226432] = tmp4_226452;
            
            double redout_tmp_226467 = defunc_1_op_res_226453;
            
            redout_226433 = redout_tmp_226467;
        }
        defunc_2_reduce_res_226383 = redout_226433;
        
        double a0_226408 = 1.0 / defunc_2_reduce_res_226383;
        double defunc_2_reduce_res_226409;
        double redout_226456 = 0.0;
        
        for (int64_t i_226455 = 0; i_226455 < q_s_203575; i_226455++) {
            double x_226457;
            
            x_226457 = ((double *) mem_226381)[i_226455];
            
            bool cond_226458 = sle64(x_226079, i_226455);
            double defunc_0_f_res_226459;
            
            if (cond_226458) {
                defunc_0_f_res_226459 = 0.0;
            } else {
                int64_t i_226460 = add64(x_226369, i_226455);
                double defunc_0_add_arg_226461;
                
                defunc_0_add_arg_226461 =
                    ((double *) mem_218170.mem)[gtid_210167 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_226078 *
                                                defunc_0_f_res_203721 +
                                                i_226460];
                defunc_0_f_res_226459 = defunc_0_add_arg_226461;
            }
            
            double x_226462 = a0_226408 * x_226457;
            double defunc_9_fit_fun_res_226463 = defunc_0_f_res_226459 *
                   x_226462;
            double defunc_1_op_res_226464 = defunc_9_fit_fun_res_226463 +
                   redout_226456;
            double redout_tmp_226469 = defunc_1_op_res_226464;
            
            redout_226456 = redout_tmp_226469;
        }
        defunc_2_reduce_res_226409 = redout_226456;
        ((double *) mem_226080.mem)[gtid_226368] = defunc_2_reduce_res_226409;
    }
    
  cleanup:
    { }
    free(mem_226381);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235982_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235982_end -
                 futhark_mc_segmap_parloop_235982_start;
        
        ctx->futhark_mc_segmap_parloop_235982_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235982_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235982_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235980(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226367 = tid;
    int num_tasks_226422 = info.nsubtasks;
    struct futhark_mc_task_235979 *futhark_mc_task_235979 =
                                  (struct futhark_mc_task_235979 *) args;
    struct futhark_context *ctx = futhark_mc_task_235979->ctx;
    uint64_t futhark_mc_segmap_task_235980_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235980_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235979->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235979->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235979->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235979->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235979->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235979->free_s_n_m_203726;
    int64_t gtid_210167 = futhark_mc_task_235979->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235979->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235979->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235979->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235979->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235979->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 = futhark_mc_task_235979->free_bytes_218546;
    int64_t gtid_226078 = futhark_mc_task_235979->free_gtid_226078;
    int64_t x_226079 = futhark_mc_task_235979->free_x_226079;
    struct memblock mem_226080 = {.desc ="mem_226080", .mem =
                                  futhark_mc_task_235979->free_mem_226080,
                                  .size =0, .references =NULL};
    int64_t iter_226423;
    struct futhark_mc_segmap_parloop_struct_235981
    futhark_mc_segmap_parloop_struct_235981;
    
    futhark_mc_segmap_parloop_struct_235981.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235981.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235981.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235981.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235981.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235981.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235981.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235981.free_gtid_210167 = gtid_210167;
    futhark_mc_segmap_parloop_struct_235981.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235981.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235981.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235981.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235981.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235981.free_bytes_218546 = bytes_218546;
    futhark_mc_segmap_parloop_struct_235981.free_gtid_226078 = gtid_226078;
    futhark_mc_segmap_parloop_struct_235981.free_x_226079 = x_226079;
    futhark_mc_segmap_parloop_struct_235981.free_mem_226080 = mem_226080.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235982_task;
    
    futhark_mc_segmap_parloop_235982_task.name =
        "futhark_mc_segmap_parloop_235982";
    futhark_mc_segmap_parloop_235982_task.fn = futhark_mc_segmap_parloop_235982;
    futhark_mc_segmap_parloop_235982_task.args =
        &futhark_mc_segmap_parloop_struct_235981;
    futhark_mc_segmap_parloop_235982_task.iterations = iterations;
    futhark_mc_segmap_parloop_235982_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235982_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235982_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235982_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235982_task);
    
    if (futhark_mc_segmap_parloop_235982_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235982_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235982_total_end -
                 futhark_mc_segmap_parloop_235982_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235982_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235982_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235982_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235980_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235980_end -
                 futhark_mc_segmap_task_235980_start;
        
        ctx->futhark_mc_segmap_task_235980_runs[tid]++;
        ctx->futhark_mc_segmap_task_235980_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235980_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_235985 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210167;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218546;
    int64_t free_gtid_226078;
    int64_t free_x_226079;
    unsigned char *free_mem_226080;
};
struct futhark_mc_task_235988 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_210167;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_226078;
    int64_t free_x_226079;
    int64_t free_x_226315;
    double free_x_226316;
    int64_t free_defunc_0_m_fun_res_226318;
    double *retval_defunc_2_reduce_res_226328;
    unsigned char *retval_mem_226327;
};
struct futhark_mc_segred_stage_1_parloop_struct_235991 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_210167;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_226078;
    int64_t free_x_226079;
    int64_t free_x_226315;
    double free_x_226316;
    int64_t free_defunc_0_m_fun_res_226318;
    unsigned char *free_mem_226327;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_226517;
};
static int futhark_mc_segred_stage_1_parloop_235992(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_226479,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235991
    *futhark_mc_segred_stage_1_parloop_struct_235991 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235991 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235991->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235992_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235992_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235991->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_235991->free_defunc_0_f_res_203721;
    int64_t gtid_210167 =
            futhark_mc_segred_stage_1_parloop_struct_235991->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235991->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235991->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_226078 =
            futhark_mc_segred_stage_1_parloop_struct_235991->free_gtid_226078;
    int64_t x_226079 =
            futhark_mc_segred_stage_1_parloop_struct_235991->free_x_226079;
    int64_t x_226315 =
            futhark_mc_segred_stage_1_parloop_struct_235991->free_x_226315;
    double x_226316 =
           futhark_mc_segred_stage_1_parloop_struct_235991->free_x_226316;
    int64_t defunc_0_m_fun_res_226318 =
            futhark_mc_segred_stage_1_parloop_struct_235991->free_defunc_0_m_fun_res_226318;
    struct memblock mem_226327 = {.desc ="mem_226327", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235991->free_mem_226327,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_226517 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_226517",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235991->free_reduce_stage_1_tid_res_arr_mem_226517,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_226519 = start;
    double x_226481;
    double x_226482;
    double local_acc_226520 = 0.0;
    
    for (; iter_226519 < end; iter_226519++) {
        int64_t gtid_226480 = iter_226519;
        bool cond_226484 = sle64(x_226079, gtid_226480);
        int64_t defunc_0_f_res_226485;
        
        if (cond_226484) {
            defunc_0_f_res_226485 = (int64_t) 0;
        } else {
            int64_t i_226486 = add64(x_226315, gtid_226480);
            int64_t defunc_0_add_arg_226487;
            
            defunc_0_add_arg_226487 = ((int64_t *) mem_217654.mem)[gtid_210167 *
                                                                   (defunc_0_f_res_203721 *
                                                                    n_p_203574) +
                                                                   gtid_226078 *
                                                                   defunc_0_f_res_203721 +
                                                                   i_226486];
            
            int64_t defunc_1_add_res_226488 = add64((int64_t) 1,
                                                    defunc_0_add_arg_226487);
            
            defunc_0_f_res_226485 = defunc_1_add_res_226488;
        }
        
        double defunc_0_f_res_226489;
        
        if (cond_226484) {
            defunc_0_f_res_226489 = 0.0;
        } else {
            int64_t i_226490 = add64(x_226315, gtid_226480);
            double defunc_0_add_arg_226491;
            
            defunc_0_add_arg_226491 = ((double *) mem_218175.mem)[gtid_210167 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_226078 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_226490];
            defunc_0_f_res_226489 = defunc_0_add_arg_226491;
        }
        
        int64_t binop_p_226492 = sub64(defunc_0_f_res_226485,
                                       defunc_0_m_fun_res_226318);
        double defunc_0_f_res_226493 = sitofp_i64_f64(binop_p_226492);
        double abs_res_226494 = fabs(defunc_0_f_res_226493);
        double tmp1_226495 = abs_res_226494 / x_226316;
        double x_226496 = tmp1_226495 * tmp1_226495;
        double y_226497 = tmp1_226495 * x_226496;
        double tmp2_226498 = 1.0 - y_226497;
        double x_226499 = tmp2_226498 * tmp2_226498;
        double tmp3_226500 = tmp2_226498 * x_226499;
        double tmp4_226501 = defunc_0_f_res_226489 * tmp3_226500;
        
        // save map-out results
        {
            ((double *) mem_226327.mem)[gtid_226480] = tmp4_226501;
        }
        // Load accum params
        {
            x_226481 = local_acc_226520;
        }
        // Load next params
        {
            x_226482 = tmp4_226501;
        }
        // Red body
        {
            double defunc_1_op_res_226483 = x_226481 + x_226482;
            
            local_acc_226520 = defunc_1_op_res_226483;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_226517.mem)[flat_tid_226479] =
        local_acc_226520;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235992_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235992_end -
                 futhark_mc_segred_stage_1_parloop_235992_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235992_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235992_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235992_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235989(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226479 = tid;
    int num_tasks_226516 = info.nsubtasks;
    struct futhark_mc_task_235988 *futhark_mc_task_235988 =
                                  (struct futhark_mc_task_235988 *) args;
    struct futhark_context *ctx = futhark_mc_task_235988->ctx;
    uint64_t futhark_mc_segred_task_235989_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235989_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235988->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235988->free_defunc_0_f_res_203721;
    int64_t gtid_210167 = futhark_mc_task_235988->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235988->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235988->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_226078 = futhark_mc_task_235988->free_gtid_226078;
    int64_t x_226079 = futhark_mc_task_235988->free_x_226079;
    int64_t x_226315 = futhark_mc_task_235988->free_x_226315;
    double x_226316 = futhark_mc_task_235988->free_x_226316;
    int64_t defunc_0_m_fun_res_226318 =
            futhark_mc_task_235988->free_defunc_0_m_fun_res_226318;
    double defunc_2_reduce_res_226328 =
           *futhark_mc_task_235988->retval_defunc_2_reduce_res_226328;
    struct memblock mem_226327 = {.desc ="mem_226327", .mem =
                                  futhark_mc_task_235988->retval_mem_226327,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_226517_cached_sizze_235990 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_226517 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_226517_cached_sizze_235990 <
        (size_t) ((int64_t) 8 * num_tasks_226516)) {
        reduce_stage_1_tid_res_arr_mem_226517 =
            realloc(reduce_stage_1_tid_res_arr_mem_226517, (int64_t) 8 *
                    num_tasks_226516);
        reduce_stage_1_tid_res_arr_mem_226517_cached_sizze_235990 =
            (int64_t) 8 * num_tasks_226516;
    }
    
    int64_t iter_226519;
    struct futhark_mc_segred_stage_1_parloop_struct_235991
    futhark_mc_segred_stage_1_parloop_struct_235991;
    
    futhark_mc_segred_stage_1_parloop_struct_235991.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_gtid_210167 =
        gtid_210167;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_mem_217654 =
        mem_217654.mem;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_mem_218175 =
        mem_218175.mem;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_gtid_226078 =
        gtid_226078;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_x_226079 = x_226079;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_x_226315 = x_226315;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_x_226316 = x_226316;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_defunc_0_m_fun_res_226318 =
        defunc_0_m_fun_res_226318;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_mem_226327 =
        mem_226327.mem;
    futhark_mc_segred_stage_1_parloop_struct_235991.free_reduce_stage_1_tid_res_arr_mem_226517 =
        reduce_stage_1_tid_res_arr_mem_226517;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235992_task;
    
    futhark_mc_segred_stage_1_parloop_235992_task.name =
        "futhark_mc_segred_stage_1_parloop_235992";
    futhark_mc_segred_stage_1_parloop_235992_task.fn =
        futhark_mc_segred_stage_1_parloop_235992;
    futhark_mc_segred_stage_1_parloop_235992_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235991;
    futhark_mc_segred_stage_1_parloop_235992_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235992_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235992_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235992_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235992_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235992_task);
    
    if (futhark_mc_segred_stage_1_parloop_235992_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235992_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235992_total_end -
                 futhark_mc_segred_stage_1_parloop_235992_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235992_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235992_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235992_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_226328 = 0.0;
    }
    
    double x_226521;
    double x_226522;
    
    for (int32_t i_226524 = 0; i_226524 < num_tasks_226516; i_226524++) {
        flat_tid_226479 = i_226524;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_226521 = defunc_2_reduce_res_226328;
            }
            // load next params
            {
                x_226522 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_226517)[flat_tid_226479];
            }
            // red body
            {
                double defunc_1_op_res_226523 = x_226521 + x_226522;
                
                defunc_2_reduce_res_226328 = defunc_1_op_res_226523;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_226517);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235989_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235989_end -
                 futhark_mc_segred_task_235989_start;
        
        ctx->futhark_mc_segred_task_235989_runs[tid]++;
        ctx->futhark_mc_segred_task_235989_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235989_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235988->retval_defunc_2_reduce_res_226328 =
            defunc_2_reduce_res_226328;
        futhark_mc_task_235988->retval_mem_226327 = mem_226327.mem;
    }
    return err;
}
struct futhark_mc_task_235993 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_210167;
    unsigned char *free_mem_218170;
    int64_t free_gtid_226078;
    int64_t free_x_226079;
    int64_t free_x_226315;
    unsigned char *free_mem_226327;
    double free_a0_226353;
    double *retval_defunc_2_reduce_res_226354;
};
struct futhark_mc_segred_stage_1_parloop_struct_235996 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_210167;
    unsigned char *free_mem_218170;
    int64_t free_gtid_226078;
    int64_t free_x_226079;
    int64_t free_x_226315;
    unsigned char *free_mem_226327;
    double free_a0_226353;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_226526;
};
static int futhark_mc_segred_stage_1_parloop_235997(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_226502,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_235996
    *futhark_mc_segred_stage_1_parloop_struct_235996 =
    (struct futhark_mc_segred_stage_1_parloop_struct_235996 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_235996->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_235997_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235997_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_235996->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_235996->free_defunc_0_f_res_203721;
    int64_t gtid_210167 =
            futhark_mc_segred_stage_1_parloop_struct_235996->free_gtid_210167;
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235996->free_mem_218170,
                                  .size =0, .references =NULL};
    int64_t gtid_226078 =
            futhark_mc_segred_stage_1_parloop_struct_235996->free_gtid_226078;
    int64_t x_226079 =
            futhark_mc_segred_stage_1_parloop_struct_235996->free_x_226079;
    int64_t x_226315 =
            futhark_mc_segred_stage_1_parloop_struct_235996->free_x_226315;
    struct memblock mem_226327 = {.desc ="mem_226327", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_235996->free_mem_226327,
                                  .size =0, .references =NULL};
    double a0_226353 =
           futhark_mc_segred_stage_1_parloop_struct_235996->free_a0_226353;
    struct memblock reduce_stage_1_tid_res_arr_mem_226526 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_226526",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_235996->free_reduce_stage_1_tid_res_arr_mem_226526,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_226528 = start;
    double x_226504;
    double x_226505;
    double local_acc_226529 = 0.0;
    
    for (; iter_226528 < end; iter_226528++) {
        int64_t gtid_226503 = iter_226528;
        double x_226507;
        
        x_226507 = ((double *) mem_226327.mem)[gtid_226503];
        
        bool cond_226508 = sle64(x_226079, gtid_226503);
        double defunc_0_f_res_226509;
        
        if (cond_226508) {
            defunc_0_f_res_226509 = 0.0;
        } else {
            int64_t i_226510 = add64(x_226315, gtid_226503);
            double defunc_0_add_arg_226511;
            
            defunc_0_add_arg_226511 = ((double *) mem_218170.mem)[gtid_210167 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_226078 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_226510];
            defunc_0_f_res_226509 = defunc_0_add_arg_226511;
        }
        
        double x_226512 = a0_226353 * x_226507;
        double defunc_9_fit_fun_res_226513 = defunc_0_f_res_226509 * x_226512;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_226504 = local_acc_226529;
        }
        // Load next params
        {
            x_226505 = defunc_9_fit_fun_res_226513;
        }
        // Red body
        {
            double defunc_1_op_res_226506 = x_226504 + x_226505;
            
            local_acc_226529 = defunc_1_op_res_226506;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_226526.mem)[flat_tid_226502] =
        local_acc_226529;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235997_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235997_end -
                 futhark_mc_segred_stage_1_parloop_235997_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_235997_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_235997_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_235997_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_235994(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226502 = tid;
    int num_tasks_226525 = info.nsubtasks;
    struct futhark_mc_task_235993 *futhark_mc_task_235993 =
                                  (struct futhark_mc_task_235993 *) args;
    struct futhark_context *ctx = futhark_mc_task_235993->ctx;
    uint64_t futhark_mc_segred_task_235994_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_235994_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235993->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235993->free_defunc_0_f_res_203721;
    int64_t gtid_210167 = futhark_mc_task_235993->free_gtid_210167;
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235993->free_mem_218170,
                                  .size =0, .references =NULL};
    int64_t gtid_226078 = futhark_mc_task_235993->free_gtid_226078;
    int64_t x_226079 = futhark_mc_task_235993->free_x_226079;
    int64_t x_226315 = futhark_mc_task_235993->free_x_226315;
    struct memblock mem_226327 = {.desc ="mem_226327", .mem =
                                  futhark_mc_task_235993->free_mem_226327,
                                  .size =0, .references =NULL};
    double a0_226353 = futhark_mc_task_235993->free_a0_226353;
    double defunc_2_reduce_res_226354 =
           *futhark_mc_task_235993->retval_defunc_2_reduce_res_226354;
    size_t reduce_stage_1_tid_res_arr_mem_226526_cached_sizze_235995 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_226526 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_226526_cached_sizze_235995 <
        (size_t) ((int64_t) 8 * num_tasks_226525)) {
        reduce_stage_1_tid_res_arr_mem_226526 =
            realloc(reduce_stage_1_tid_res_arr_mem_226526, (int64_t) 8 *
                    num_tasks_226525);
        reduce_stage_1_tid_res_arr_mem_226526_cached_sizze_235995 =
            (int64_t) 8 * num_tasks_226525;
    }
    
    int64_t iter_226528;
    struct futhark_mc_segred_stage_1_parloop_struct_235996
    futhark_mc_segred_stage_1_parloop_struct_235996;
    
    futhark_mc_segred_stage_1_parloop_struct_235996.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_gtid_210167 =
        gtid_210167;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_mem_218170 =
        mem_218170.mem;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_gtid_226078 =
        gtid_226078;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_x_226079 = x_226079;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_x_226315 = x_226315;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_mem_226327 =
        mem_226327.mem;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_a0_226353 = a0_226353;
    futhark_mc_segred_stage_1_parloop_struct_235996.free_reduce_stage_1_tid_res_arr_mem_226526 =
        reduce_stage_1_tid_res_arr_mem_226526;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_235997_task;
    
    futhark_mc_segred_stage_1_parloop_235997_task.name =
        "futhark_mc_segred_stage_1_parloop_235997";
    futhark_mc_segred_stage_1_parloop_235997_task.fn =
        futhark_mc_segred_stage_1_parloop_235997;
    futhark_mc_segred_stage_1_parloop_235997_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_235996;
    futhark_mc_segred_stage_1_parloop_235997_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_235997_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_235997_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_235997_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_235997_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_235997_task);
    
    if (futhark_mc_segred_stage_1_parloop_235997_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_235997_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_235997_total_end -
                 futhark_mc_segred_stage_1_parloop_235997_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235997_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235997_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_235997_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_226354 = 0.0;
    }
    
    double x_226530;
    double x_226531;
    
    for (int32_t i_226533 = 0; i_226533 < num_tasks_226525; i_226533++) {
        flat_tid_226502 = i_226533;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_226530 = defunc_2_reduce_res_226354;
            }
            // load next params
            {
                x_226531 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_226526)[flat_tid_226502];
            }
            // red body
            {
                double defunc_1_op_res_226532 = x_226530 + x_226531;
                
                defunc_2_reduce_res_226354 = defunc_1_op_res_226532;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_226526);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_235994_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_235994_end -
                 futhark_mc_segred_task_235994_start;
        
        ctx->futhark_mc_segred_task_235994_runs[tid]++;
        ctx->futhark_mc_segred_task_235994_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_235994_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_235993->retval_defunc_2_reduce_res_226354 =
            defunc_2_reduce_res_226354;
    }
    return err;
}
static int futhark_mc_segmap_parloop_235986(void *args, int64_t start,
                                            int64_t end, int flat_tid_226313,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235985
    *futhark_mc_segmap_parloop_struct_235985 =
    (struct futhark_mc_segmap_parloop_struct_235985 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235985->ctx;
    uint64_t futhark_mc_segmap_parloop_235986_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235986_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235985->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235985->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235985->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235985->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235985->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235985->free_s_n_m_203726;
    int64_t gtid_210167 =
            futhark_mc_segmap_parloop_struct_235985->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235985->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235985->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235985->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235985->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235985->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 =
            futhark_mc_segmap_parloop_struct_235985->free_bytes_218546;
    int64_t gtid_226078 =
            futhark_mc_segmap_parloop_struct_235985->free_gtid_226078;
    int64_t x_226079 = futhark_mc_segmap_parloop_struct_235985->free_x_226079;
    struct memblock mem_226080 = {.desc ="mem_226080", .mem =
                                  futhark_mc_segmap_parloop_struct_235985->free_mem_226080,
                                  .size =0, .references =NULL};
    size_t mem_226327_cached_sizze_235987 = 0;
    unsigned char *mem_226327 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226470 = start;
    
    if (mem_226327_cached_sizze_235987 < (size_t) bytes_218546) {
        mem_226327 = realloc(mem_226327, bytes_218546);
        mem_226327_cached_sizze_235987 = bytes_218546;
    }
    for (; iter_226470 < end; iter_226470++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226514 = s_n_m_203726;
        int64_t gtid_226314 = iter_226470;
        int64_t remnant_226515 = iter_226470 - gtid_226314;
        int64_t x_226315;
        
        x_226315 = ((int64_t *) mem_217828.mem)[gtid_210167 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_226078 * s_n_m_203726 +
                                                gtid_226314];
        
        double x_226316;
        
        x_226316 = ((double *) mem_217833.mem)[gtid_210167 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_226078 * s_n_m_203726 +
                                               gtid_226314];
        
        bool cond_226317 = gtid_226314 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_226318;
        
        if (cond_226317) {
            defunc_0_m_fun_res_226318 = (int64_t) 0;
        } else {
            int64_t y_226471 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_226472 = gtid_226314 == y_226471;
            int64_t defunc_0_m_fun_res_f_res_226473;
            
            if (cond_226472) {
                int64_t defunc_0_m_fun_res_f_res_t_res_226474 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_226473 =
                    defunc_0_m_fun_res_f_res_t_res_226474;
            } else {
                int64_t x_226475 = sub64(gtid_226314, (int64_t) 1);
                int64_t x_226476 = mul64(jump_s_203581, x_226475);
                int64_t min_arg_226477 = add64((int64_t) 1, x_226476);
                int64_t min_res_226478 = smin64(defunc_0_f_res_203721,
                                                min_arg_226477);
                
                defunc_0_m_fun_res_f_res_226473 = min_res_226478;
            }
            defunc_0_m_fun_res_226318 = defunc_0_m_fun_res_f_res_226473;
        }
        
        double defunc_2_reduce_res_226328;
        int64_t flat_tid_226479 = (int64_t) 0;
        int32_t num_tasks_226516;
        
        defunc_2_reduce_res_226328 = 0.0;
        
        struct futhark_mc_task_235988 futhark_mc_task_235988;
        
        futhark_mc_task_235988.ctx = ctx;
        futhark_mc_task_235988.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235988.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235988.free_gtid_210167 = gtid_210167;
        futhark_mc_task_235988.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235988.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235988.free_gtid_226078 = gtid_226078;
        futhark_mc_task_235988.free_x_226079 = x_226079;
        futhark_mc_task_235988.free_x_226315 = x_226315;
        futhark_mc_task_235988.free_x_226316 = x_226316;
        futhark_mc_task_235988.free_defunc_0_m_fun_res_226318 =
            defunc_0_m_fun_res_226318;
        futhark_mc_task_235988.retval_defunc_2_reduce_res_226328 =
            &defunc_2_reduce_res_226328;
        futhark_mc_task_235988.retval_mem_226327 = mem_226327;
        
        struct scheduler_segop futhark_mc_task_235988_task;
        
        futhark_mc_task_235988_task.args = &futhark_mc_task_235988;
        futhark_mc_task_235988_task.top_level_fn =
            futhark_mc_segred_task_235989;
        futhark_mc_task_235988_task.name = "futhark_mc_segred_task_235989";
        futhark_mc_task_235988_task.iterations = q_s_203575;
        futhark_mc_task_235988_task.task_time =
            &ctx->futhark_mc_segred_task_235989_total_time;
        futhark_mc_task_235988_task.task_iter =
            &ctx->futhark_mc_segred_task_235989_total_iter;
        futhark_mc_task_235988_task.sched = STATIC;
        futhark_mc_task_235988_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235989_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235988_task);
        
        if (futhark_mc_segred_task_235989_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_226353 = 1.0 / defunc_2_reduce_res_226328;
        double defunc_2_reduce_res_226354;
        int64_t flat_tid_226502 = (int64_t) 0;
        int32_t num_tasks_226525;
        
        defunc_2_reduce_res_226354 = 0.0;
        
        struct futhark_mc_task_235993 futhark_mc_task_235993;
        
        futhark_mc_task_235993.ctx = ctx;
        futhark_mc_task_235993.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235993.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235993.free_gtid_210167 = gtid_210167;
        futhark_mc_task_235993.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235993.free_gtid_226078 = gtid_226078;
        futhark_mc_task_235993.free_x_226079 = x_226079;
        futhark_mc_task_235993.free_x_226315 = x_226315;
        futhark_mc_task_235993.free_mem_226327 = mem_226327;
        futhark_mc_task_235993.free_a0_226353 = a0_226353;
        futhark_mc_task_235993.retval_defunc_2_reduce_res_226354 =
            &defunc_2_reduce_res_226354;
        
        struct scheduler_segop futhark_mc_task_235993_task;
        
        futhark_mc_task_235993_task.args = &futhark_mc_task_235993;
        futhark_mc_task_235993_task.top_level_fn =
            futhark_mc_segred_task_235994;
        futhark_mc_task_235993_task.name = "futhark_mc_segred_task_235994";
        futhark_mc_task_235993_task.iterations = q_s_203575;
        futhark_mc_task_235993_task.task_time =
            &ctx->futhark_mc_segred_task_235994_total_time;
        futhark_mc_task_235993_task.task_iter =
            &ctx->futhark_mc_segred_task_235994_total_iter;
        futhark_mc_task_235993_task.sched = STATIC;
        futhark_mc_task_235993_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_235994_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235993_task);
        
        if (futhark_mc_segred_task_235994_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_226080.mem)[gtid_226314] = defunc_2_reduce_res_226354;
    }
    
  cleanup:
    { }
    free(mem_226327);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235986_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235986_end -
                 futhark_mc_segmap_parloop_235986_start;
        
        ctx->futhark_mc_segmap_parloop_235986_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235986_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235986_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235984(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226313 = tid;
    int num_tasks_226422 = info.nsubtasks;
    struct futhark_mc_task_235979 *futhark_mc_task_235979 =
                                  (struct futhark_mc_task_235979 *) args;
    struct futhark_context *ctx = futhark_mc_task_235979->ctx;
    uint64_t futhark_mc_segmap_nested_task_235984_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235984_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235979->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235979->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235979->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235979->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235979->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235979->free_s_n_m_203726;
    int64_t gtid_210167 = futhark_mc_task_235979->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235979->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235979->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235979->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235979->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235979->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 = futhark_mc_task_235979->free_bytes_218546;
    int64_t gtid_226078 = futhark_mc_task_235979->free_gtid_226078;
    int64_t x_226079 = futhark_mc_task_235979->free_x_226079;
    struct memblock mem_226080 = {.desc ="mem_226080", .mem =
                                  futhark_mc_task_235979->free_mem_226080,
                                  .size =0, .references =NULL};
    int64_t iter_226470;
    struct futhark_mc_segmap_parloop_struct_235985
    futhark_mc_segmap_parloop_struct_235985;
    
    futhark_mc_segmap_parloop_struct_235985.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235985.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235985.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235985.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235985.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235985.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235985.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235985.free_gtid_210167 = gtid_210167;
    futhark_mc_segmap_parloop_struct_235985.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235985.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235985.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235985.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235985.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235985.free_bytes_218546 = bytes_218546;
    futhark_mc_segmap_parloop_struct_235985.free_gtid_226078 = gtid_226078;
    futhark_mc_segmap_parloop_struct_235985.free_x_226079 = x_226079;
    futhark_mc_segmap_parloop_struct_235985.free_mem_226080 = mem_226080.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235986_task;
    
    futhark_mc_segmap_parloop_235986_task.name =
        "futhark_mc_segmap_parloop_235986";
    futhark_mc_segmap_parloop_235986_task.fn = futhark_mc_segmap_parloop_235986;
    futhark_mc_segmap_parloop_235986_task.args =
        &futhark_mc_segmap_parloop_struct_235985;
    futhark_mc_segmap_parloop_235986_task.iterations = iterations;
    futhark_mc_segmap_parloop_235986_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235986_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235986_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235986_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235986_task);
    
    if (futhark_mc_segmap_parloop_235986_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235986_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235986_total_end -
                 futhark_mc_segmap_parloop_235986_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235986_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235986_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235986_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235984_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235984_end -
                 futhark_mc_segmap_nested_task_235984_start;
        
        ctx->futhark_mc_segmap_nested_task_235984_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235984_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235984_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235977(void *args, int64_t start,
                                            int64_t end, int flat_tid_226077,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235976
    *futhark_mc_segmap_parloop_struct_235976 =
    (struct futhark_mc_segmap_parloop_struct_235976 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235976->ctx;
    uint64_t futhark_mc_segmap_parloop_235977_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235977_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235976->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235976->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235976->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235976->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235976->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235976->free_s_n_m_203726;
    int64_t gtid_210167 =
            futhark_mc_segmap_parloop_struct_235976->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235976->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235976->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235976->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235976->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235976->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235976->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235976->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 =
            futhark_mc_segmap_parloop_struct_235976->free_bytes_218546;
    struct memblock mem_218599 = {.desc ="mem_218599", .mem =
                                  futhark_mc_segmap_parloop_struct_235976->free_mem_218599,
                                  .size =0, .references =NULL};
    size_t mem_226080_cached_sizze_235978 = 0;
    unsigned char *mem_226080 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226312 = start;
    
    if (mem_226080_cached_sizze_235978 < (size_t) bytes_217663) {
        mem_226080 = realloc(mem_226080, bytes_217663);
        mem_226080_cached_sizze_235978 = bytes_217663;
    }
    for (; iter_226312 < end; iter_226312++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226420 = n_p_203574;
        int64_t gtid_226078 = iter_226312;
        int64_t remnant_226421 = iter_226312 - gtid_226078;
        int64_t x_226079;
        
        x_226079 = ((int64_t *) mem_217658.mem)[gtid_210167 * n_p_203574 +
                                                gtid_226078];
        
        int64_t flat_tid_226367 = (int64_t) 0;
        int32_t num_tasks_226422;
        int64_t flat_tid_226313 = (int64_t) 0;
        struct futhark_mc_task_235979 futhark_mc_task_235979;
        
        futhark_mc_task_235979.ctx = ctx;
        futhark_mc_task_235979.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235979.free_q_s_203575 = q_s_203575;
        futhark_mc_task_235979.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235979.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235979.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235979.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235979.free_gtid_210167 = gtid_210167;
        futhark_mc_task_235979.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235979.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_235979.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_235979.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235979.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235979.free_bytes_218546 = bytes_218546;
        futhark_mc_task_235979.free_gtid_226078 = gtid_226078;
        futhark_mc_task_235979.free_x_226079 = x_226079;
        futhark_mc_task_235979.free_mem_226080 = mem_226080;
        
        struct scheduler_segop futhark_mc_task_235979_task;
        
        futhark_mc_task_235979_task.args = &futhark_mc_task_235979;
        futhark_mc_task_235979_task.top_level_fn =
            futhark_mc_segmap_task_235980;
        futhark_mc_task_235979_task.name = "futhark_mc_segmap_task_235980";
        futhark_mc_task_235979_task.iterations = s_n_m_203726;
        futhark_mc_task_235979_task.task_time =
            &ctx->futhark_mc_segmap_task_235980_total_time;
        futhark_mc_task_235979_task.task_iter =
            &ctx->futhark_mc_segmap_task_235980_total_iter;
        futhark_mc_task_235979_task.sched = STATIC;
        futhark_mc_task_235979_task.nested_fn =
            futhark_mc_segmap_nested_task_235984;
        
        int futhark_mc_segmap_task_235980_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235979_task);
        
        if (futhark_mc_segmap_task_235980_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218599.mem + gtid_226078 * s_n_m_203726 * (int64_t) 8,
                    mem_226080 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_226080);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235977_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235977_end -
                 futhark_mc_segmap_parloop_235977_start;
        
        ctx->futhark_mc_segmap_parloop_235977_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235977_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235977_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235975(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226077 = tid;
    int num_tasks_226251 = info.nsubtasks;
    struct futhark_mc_task_235969 *futhark_mc_task_235969 =
                                  (struct futhark_mc_task_235969 *) args;
    struct futhark_context *ctx = futhark_mc_task_235969->ctx;
    uint64_t futhark_mc_segmap_nested_task_235975_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235975_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235969->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235969->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235969->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235969->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235969->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235969->free_s_n_m_203726;
    int64_t gtid_210167 = futhark_mc_task_235969->free_gtid_210167;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235969->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235969->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235969->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235969->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235969->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235969->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235969->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 = futhark_mc_task_235969->free_bytes_218546;
    struct memblock mem_218599 = {.desc ="mem_218599", .mem =
                                  futhark_mc_task_235969->free_mem_218599,
                                  .size =0, .references =NULL};
    int64_t iter_226312;
    struct futhark_mc_segmap_parloop_struct_235976
    futhark_mc_segmap_parloop_struct_235976;
    
    futhark_mc_segmap_parloop_struct_235976.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235976.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235976.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235976.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235976.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235976.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235976.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235976.free_gtid_210167 = gtid_210167;
    futhark_mc_segmap_parloop_struct_235976.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235976.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235976.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235976.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235976.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235976.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235976.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235976.free_bytes_218546 = bytes_218546;
    futhark_mc_segmap_parloop_struct_235976.free_mem_218599 = mem_218599.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235977_task;
    
    futhark_mc_segmap_parloop_235977_task.name =
        "futhark_mc_segmap_parloop_235977";
    futhark_mc_segmap_parloop_235977_task.fn = futhark_mc_segmap_parloop_235977;
    futhark_mc_segmap_parloop_235977_task.args =
        &futhark_mc_segmap_parloop_struct_235976;
    futhark_mc_segmap_parloop_235977_task.iterations = iterations;
    futhark_mc_segmap_parloop_235977_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235977_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235977_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235977_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235977_task);
    
    if (futhark_mc_segmap_parloop_235977_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235977_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235977_total_end -
                 futhark_mc_segmap_parloop_235977_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235977_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235977_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235977_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235975_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235975_end -
                 futhark_mc_segmap_nested_task_235975_start;
        
        ctx->futhark_mc_segmap_nested_task_235975_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235975_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235975_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_235967(void *args, int64_t start,
                                            int64_t end, int flat_tid_210166,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_235966
    *futhark_mc_segmap_parloop_struct_235966 =
    (struct futhark_mc_segmap_parloop_struct_235966 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_235966->ctx;
    uint64_t futhark_mc_segmap_parloop_235967_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235967_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_235966->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_235966->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_235966->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_235966->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_235966->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_235966->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_235966->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_235966->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_235966->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_235966->free_bytes_217663;
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_235966->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_235966->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_235966->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_235966->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_235966->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 =
            futhark_mc_segmap_parloop_struct_235966->free_bytes_218546;
    struct memblock mem_218663 = {.desc ="mem_218663", .mem =
                                  futhark_mc_segmap_parloop_struct_235966->free_mem_218663,
                                  .size =0, .references =NULL};
    size_t mem_218599_cached_sizze_235968 = 0;
    unsigned char *mem_218599 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226076 = start;
    
    if (mem_218599_cached_sizze_235968 < (size_t) bytes_217715) {
        mem_218599 = realloc(mem_218599, bytes_217715);
        mem_218599_cached_sizze_235968 = bytes_217715;
    }
    for (; iter_226076 < end; iter_226076++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226249 = partition_sizze_203667;
        int64_t gtid_210167 = iter_226076;
        int64_t remnant_226250 = iter_226076 - gtid_210167;
        int64_t flat_tid_226189 = (int64_t) 0;
        int32_t num_tasks_226251;
        int64_t flat_tid_226077 = (int64_t) 0;
        struct futhark_mc_task_235969 futhark_mc_task_235969;
        
        futhark_mc_task_235969.ctx = ctx;
        futhark_mc_task_235969.free_n_p_203574 = n_p_203574;
        futhark_mc_task_235969.free_q_s_203575 = q_s_203575;
        futhark_mc_task_235969.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_235969.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_235969.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_235969.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_235969.free_gtid_210167 = gtid_210167;
        futhark_mc_task_235969.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_235969.free_mem_217658 = mem_217658.mem;
        futhark_mc_task_235969.free_bytes_217663 = bytes_217663;
        futhark_mc_task_235969.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_235969.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_235969.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_235969.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_235969.free_bytes_218546 = bytes_218546;
        futhark_mc_task_235969.free_mem_218599 = mem_218599;
        
        struct scheduler_segop futhark_mc_task_235969_task;
        
        futhark_mc_task_235969_task.args = &futhark_mc_task_235969;
        futhark_mc_task_235969_task.top_level_fn =
            futhark_mc_segmap_task_235970;
        futhark_mc_task_235969_task.name = "futhark_mc_segmap_task_235970";
        futhark_mc_task_235969_task.iterations = n_p_203574;
        futhark_mc_task_235969_task.task_time =
            &ctx->futhark_mc_segmap_task_235970_total_time;
        futhark_mc_task_235969_task.task_iter =
            &ctx->futhark_mc_segmap_task_235970_total_iter;
        futhark_mc_task_235969_task.sched = STATIC;
        futhark_mc_task_235969_task.nested_fn =
            futhark_mc_segmap_nested_task_235975;
        
        int futhark_mc_segmap_task_235970_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_235969_task);
        
        if (futhark_mc_segmap_task_235970_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218663.mem + gtid_210167 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218599 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218599);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235967_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235967_end -
                 futhark_mc_segmap_parloop_235967_start;
        
        ctx->futhark_mc_segmap_parloop_235967_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_235967_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_235967_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_235965(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_210166 = tid;
    int num_tasks_226010 = info.nsubtasks;
    struct futhark_mc_task_235959 *futhark_mc_task_235959 =
                                  (struct futhark_mc_task_235959 *) args;
    struct futhark_context *ctx = futhark_mc_task_235959->ctx;
    uint64_t futhark_mc_segmap_nested_task_235965_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_235965_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235959->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235959->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235959->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235959->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235959->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235959->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235959->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235959->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235959->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235959->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235959->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235959->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235959->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235959->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235959->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218546 = futhark_mc_task_235959->free_bytes_218546;
    struct memblock mem_218663 = {.desc ="mem_218663", .mem =
                                  futhark_mc_task_235959->free_mem_218663,
                                  .size =0, .references =NULL};
    int64_t iter_226076;
    struct futhark_mc_segmap_parloop_struct_235966
    futhark_mc_segmap_parloop_struct_235966;
    
    futhark_mc_segmap_parloop_struct_235966.ctx = ctx;
    futhark_mc_segmap_parloop_struct_235966.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_235966.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_235966.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_235966.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_235966.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_235966.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_235966.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_235966.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_235966.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_235966.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_235966.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_235966.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_235966.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_235966.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_235966.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_235966.free_bytes_218546 = bytes_218546;
    futhark_mc_segmap_parloop_struct_235966.free_mem_218663 = mem_218663.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_235967_task;
    
    futhark_mc_segmap_parloop_235967_task.name =
        "futhark_mc_segmap_parloop_235967";
    futhark_mc_segmap_parloop_235967_task.fn = futhark_mc_segmap_parloop_235967;
    futhark_mc_segmap_parloop_235967_task.args =
        &futhark_mc_segmap_parloop_struct_235966;
    futhark_mc_segmap_parloop_235967_task.iterations = iterations;
    futhark_mc_segmap_parloop_235967_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_235967_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_235967_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_235967_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_235967_task);
    
    if (futhark_mc_segmap_parloop_235967_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_235967_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_235967_total_end -
                 futhark_mc_segmap_parloop_235967_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235967_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235967_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_235967_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_235965_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_235965_end -
                 futhark_mc_segmap_nested_task_235965_start;
        
        ctx->futhark_mc_segmap_nested_task_235965_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_235965_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_235965_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_235998 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218665;
    unsigned char *free_mem_218896;
    unsigned char *free_mem_218901;
};
struct futhark_mc_segmap_parloop_struct_236000 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218665;
    unsigned char *free_mem_218896;
    unsigned char *free_mem_218901;
};
static int futhark_mc_segmap_parloop_236001(void *args, int64_t start,
                                            int64_t end, int flat_tid_210351,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236000
    *futhark_mc_segmap_parloop_struct_236000 =
    (struct futhark_mc_segmap_parloop_struct_236000 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236000->ctx;
    uint64_t futhark_mc_segmap_parloop_236001_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236001_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236000->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236000->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236000->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236000->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236000->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236000->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236000->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236000->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_236000->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_236000->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236000->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236000->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236000->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236000->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 =
            futhark_mc_segmap_parloop_struct_236000->free_bytes_218665;
    struct memblock mem_218896 = {.desc ="mem_218896", .mem =
                                  futhark_mc_segmap_parloop_struct_236000->free_mem_218896,
                                  .size =0, .references =NULL};
    struct memblock mem_218901 = {.desc ="mem_218901", .mem =
                                  futhark_mc_segmap_parloop_struct_236000->free_mem_218901,
                                  .size =0, .references =NULL};
    size_t mem_218777_cached_sizze_236002 = 0;
    unsigned char *mem_218777 = NULL;
    size_t mem_218781_cached_sizze_236003 = 0;
    unsigned char *mem_218781 = NULL;
    size_t mem_218826_cached_sizze_236004 = 0;
    unsigned char *mem_218826 = NULL;
    size_t mem_218829_cached_sizze_236005 = 0;
    unsigned char *mem_218829 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226535 = start;
    
    if (mem_218777_cached_sizze_236002 < (size_t) bytes_217715) {
        mem_218777 = realloc(mem_218777, bytes_217715);
        mem_218777_cached_sizze_236002 = bytes_217715;
    }
    if (mem_218781_cached_sizze_236003 < (size_t) bytes_217715) {
        mem_218781 = realloc(mem_218781, bytes_217715);
        mem_218781_cached_sizze_236003 = bytes_217715;
    }
    if (mem_218826_cached_sizze_236004 < (size_t) bytes_218665) {
        mem_218826 = realloc(mem_218826, bytes_218665);
        mem_218826_cached_sizze_236004 = bytes_218665;
    }
    if (mem_218829_cached_sizze_236005 < (size_t) bytes_218665) {
        mem_218829 = realloc(mem_218829, bytes_218665);
        mem_218829_cached_sizze_236005 = bytes_218665;
    }
    for (; iter_226535 < end; iter_226535++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226626 = partition_sizze_203667;
        int64_t gtid_210352 = iter_226535;
        int64_t remnant_226627 = iter_226535 - gtid_210352;
        
        for (int64_t i_226536 = 0; i_226536 < n_p_203574; i_226536++) {
            int64_t x_226539;
            
            x_226539 = ((int64_t *) mem_217658.mem)[gtid_210352 * n_p_203574 +
                                                    i_226536];
            for (int64_t i_226542 = 0; i_226542 < s_n_m_203726; i_226542++) {
                int64_t x_226545;
                
                x_226545 = ((int64_t *) mem_217828.mem)[gtid_210352 *
                                                        (s_n_m_203726 *
                                                         n_p_203574) +
                                                        i_226536 *
                                                        s_n_m_203726 +
                                                        i_226542];
                
                double x_226546;
                
                x_226546 = ((double *) mem_217833.mem)[gtid_210352 *
                                                       (s_n_m_203726 *
                                                        n_p_203574) + i_226536 *
                                                       s_n_m_203726 + i_226542];
                
                bool cond_226547 = i_226542 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_226548;
                
                if (cond_226547) {
                    defunc_0_m_fun_res_226548 = (int64_t) 0;
                } else {
                    int64_t y_226549 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_226550 = i_226542 == y_226549;
                    int64_t defunc_0_m_fun_res_f_res_226551;
                    
                    if (cond_226550) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_226552 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_226551 =
                            defunc_0_m_fun_res_f_res_t_res_226552;
                    } else {
                        int64_t x_226553 = sub64(i_226542, (int64_t) 1);
                        int64_t x_226554 = mul64(jump_s_203581, x_226553);
                        int64_t min_arg_226555 = add64((int64_t) 1, x_226554);
                        int64_t min_res_226556 = smin64(defunc_0_f_res_203721,
                                                        min_arg_226555);
                        
                        defunc_0_m_fun_res_f_res_226551 = min_res_226556;
                    }
                    defunc_0_m_fun_res_226548 = defunc_0_m_fun_res_f_res_226551;
                }
                
                double defunc_2_reduce_res_226559;
                double defunc_2_reduce_res_226560;
                double defunc_2_reduce_res_226561;
                double redout_226565;
                double redout_226566;
                double redout_226567;
                
                redout_226565 = 0.0;
                redout_226566 = 0.0;
                redout_226567 = 0.0;
                for (int64_t i_226564 = 0; i_226564 < q_s_203575; i_226564++) {
                    bool cond_226570 = sle64(x_226539, i_226564);
                    int64_t defunc_0_f_res_226571;
                    
                    if (cond_226570) {
                        defunc_0_f_res_226571 = (int64_t) 0;
                    } else {
                        int64_t i_226572 = add64(x_226545, i_226564);
                        int64_t defunc_0_add_arg_226573;
                        
                        defunc_0_add_arg_226573 =
                            ((int64_t *) mem_217654.mem)[gtid_210352 *
                                                         (defunc_0_f_res_203721 *
                                                          n_p_203574) +
                                                         i_226536 *
                                                         defunc_0_f_res_203721 +
                                                         i_226572];
                        
                        int64_t defunc_1_add_res_226574 = add64((int64_t) 1,
                                                                defunc_0_add_arg_226573);
                        
                        defunc_0_f_res_226571 = defunc_1_add_res_226574;
                    }
                    
                    double defunc_0_f_res_226575;
                    
                    if (cond_226570) {
                        defunc_0_f_res_226575 = 0.0;
                    } else {
                        int64_t i_226576 = add64(x_226545, i_226564);
                        double defunc_0_add_arg_226577;
                        
                        defunc_0_add_arg_226577 =
                            ((double *) mem_218175.mem)[gtid_210352 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_226536 *
                                                        defunc_0_f_res_203721 +
                                                        i_226576];
                        defunc_0_f_res_226575 = defunc_0_add_arg_226577;
                    }
                    
                    int64_t binop_p_226578 = sub64(defunc_0_f_res_226571,
                                                   defunc_0_m_fun_res_226548);
                    double defunc_0_f_res_226579 =
                           sitofp_i64_f64(binop_p_226578);
                    double abs_res_226580 = fabs(defunc_0_f_res_226579);
                    double tmp1_226581 = abs_res_226580 / x_226546;
                    double x_226582 = tmp1_226581 * tmp1_226581;
                    double y_226583 = tmp1_226581 * x_226582;
                    double tmp2_226584 = 1.0 - y_226583;
                    double x_226585 = tmp2_226584 * tmp2_226584;
                    double tmp3_226586 = tmp2_226584 * x_226585;
                    double tmp4_226587 = defunc_0_f_res_226575 * tmp3_226586;
                    double defunc_1_f_res_226588 = defunc_0_f_res_226579 *
                           tmp4_226587;
                    double defunc_1_f_res_226589 = defunc_0_f_res_226579 *
                           defunc_1_f_res_226588;
                    double defunc_1_op_res_226590 = tmp4_226587 + redout_226565;
                    double defunc_1_op_res_226591 = defunc_1_f_res_226588 +
                           redout_226566;
                    double defunc_1_op_res_226592 = defunc_1_f_res_226589 +
                           redout_226567;
                    
                    ((double *) mem_218826)[i_226564] = defunc_1_f_res_226588;
                    ((double *) mem_218829)[i_226564] = tmp4_226587;
                    
                    double redout_tmp_226632 = defunc_1_op_res_226590;
                    double redout_tmp_226633 = defunc_1_op_res_226591;
                    double redout_tmp_226634 = defunc_1_op_res_226592;
                    
                    redout_226565 = redout_tmp_226632;
                    redout_226566 = redout_tmp_226633;
                    redout_226567 = redout_tmp_226634;
                }
                defunc_2_reduce_res_226559 = redout_226565;
                defunc_2_reduce_res_226560 = redout_226566;
                defunc_2_reduce_res_226561 = redout_226567;
                
                double x_226595 = defunc_2_reduce_res_226559 *
                       defunc_2_reduce_res_226561;
                double y_226596 = defunc_2_reduce_res_226560 *
                       defunc_2_reduce_res_226560;
                double y_226597 = x_226595 - y_226596;
                double det1_226598 = 1.0 / y_226597;
                double a11_226599 = defunc_2_reduce_res_226561 * det1_226598;
                double x_226600 = 0.0 - defunc_2_reduce_res_226560;
                double b11_226601 = det1_226598 * x_226600;
                double c11_226602 = defunc_2_reduce_res_226559 * det1_226598;
                double defunc_2_reduce_res_226603;
                double defunc_2_reduce_res_226604;
                double redout_226606;
                double redout_226607;
                
                redout_226606 = 0.0;
                redout_226607 = 0.0;
                for (int64_t i_226605 = 0; i_226605 < q_s_203575; i_226605++) {
                    double x_226608;
                    
                    x_226608 = ((double *) mem_218829)[i_226605];
                    
                    double x_226609;
                    
                    x_226609 = ((double *) mem_218826)[i_226605];
                    
                    bool cond_226610 = sle64(x_226539, i_226605);
                    double defunc_0_f_res_226611;
                    
                    if (cond_226610) {
                        defunc_0_f_res_226611 = 0.0;
                    } else {
                        int64_t i_226612 = add64(x_226545, i_226605);
                        double defunc_0_add_arg_226613;
                        
                        defunc_0_add_arg_226613 =
                            ((double *) mem_218170.mem)[gtid_210352 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_226536 *
                                                        defunc_0_f_res_203721 +
                                                        i_226612];
                        defunc_0_f_res_226611 = defunc_0_add_arg_226613;
                    }
                    
                    double x_226614 = a11_226599 * x_226608;
                    double y_226615 = b11_226601 * x_226609;
                    double x_226616 = x_226614 + y_226615;
                    double defunc_9_fit_fun_res_226617 = defunc_0_f_res_226611 *
                           x_226616;
                    double x_226618 = b11_226601 * x_226608;
                    double y_226619 = c11_226602 * x_226609;
                    double x_226620 = x_226618 + y_226619;
                    double defunc_9_slope_fun_res_226621 =
                           defunc_0_f_res_226611 * x_226620;
                    double defunc_1_op_res_226622 =
                           defunc_9_fit_fun_res_226617 + redout_226606;
                    double defunc_1_op_res_226623 =
                           defunc_9_slope_fun_res_226621 + redout_226607;
                    double redout_tmp_226637 = defunc_1_op_res_226622;
                    double redout_tmp_226638 = defunc_1_op_res_226623;
                    
                    redout_226606 = redout_tmp_226637;
                    redout_226607 = redout_tmp_226638;
                }
                defunc_2_reduce_res_226603 = redout_226606;
                defunc_2_reduce_res_226604 = redout_226607;
                ((double *) mem_218777)[i_226536 * s_n_m_203726 + i_226542] =
                    defunc_2_reduce_res_226603;
                ((double *) mem_218781)[i_226536 * s_n_m_203726 + i_226542] =
                    defunc_2_reduce_res_226604;
            }
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218896.mem + gtid_210352 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218777 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218901.mem + gtid_210352 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218781 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218777);
    free(mem_218781);
    free(mem_218826);
    free(mem_218829);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236001_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236001_end -
                 futhark_mc_segmap_parloop_236001_start;
        
        ctx->futhark_mc_segmap_parloop_236001_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236001_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236001_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_235999(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_210351 = tid;
    int num_tasks_226534 = info.nsubtasks;
    struct futhark_mc_task_235998 *futhark_mc_task_235998 =
                                  (struct futhark_mc_task_235998 *) args;
    struct futhark_context *ctx = futhark_mc_task_235998->ctx;
    uint64_t futhark_mc_segmap_task_235999_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_235999_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235998->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235998->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235998->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235998->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235998->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235998->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235998->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235998->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235998->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235998->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235998->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235998->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235998->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235998->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235998->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 = futhark_mc_task_235998->free_bytes_218665;
    struct memblock mem_218896 = {.desc ="mem_218896", .mem =
                                  futhark_mc_task_235998->free_mem_218896,
                                  .size =0, .references =NULL};
    struct memblock mem_218901 = {.desc ="mem_218901", .mem =
                                  futhark_mc_task_235998->free_mem_218901,
                                  .size =0, .references =NULL};
    int64_t iter_226535;
    struct futhark_mc_segmap_parloop_struct_236000
    futhark_mc_segmap_parloop_struct_236000;
    
    futhark_mc_segmap_parloop_struct_236000.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236000.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236000.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236000.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236000.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236000.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236000.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236000.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236000.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236000.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_236000.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_236000.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236000.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236000.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236000.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236000.free_bytes_218665 = bytes_218665;
    futhark_mc_segmap_parloop_struct_236000.free_mem_218896 = mem_218896.mem;
    futhark_mc_segmap_parloop_struct_236000.free_mem_218901 = mem_218901.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236001_task;
    
    futhark_mc_segmap_parloop_236001_task.name =
        "futhark_mc_segmap_parloop_236001";
    futhark_mc_segmap_parloop_236001_task.fn = futhark_mc_segmap_parloop_236001;
    futhark_mc_segmap_parloop_236001_task.args =
        &futhark_mc_segmap_parloop_struct_236000;
    futhark_mc_segmap_parloop_236001_task.iterations = iterations;
    futhark_mc_segmap_parloop_236001_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236001_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236001_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236001_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236001_task);
    
    if (futhark_mc_segmap_parloop_236001_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236001_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236001_total_end -
                 futhark_mc_segmap_parloop_236001_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236001_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236001_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236001_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_235999_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_235999_end -
                 futhark_mc_segmap_task_235999_start;
        
        ctx->futhark_mc_segmap_task_235999_runs[tid]++;
        ctx->futhark_mc_segmap_task_235999_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_235999_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236007 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218665;
    unsigned char *free_mem_218896;
    unsigned char *free_mem_218901;
};
struct futhark_mc_task_236011 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210629;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218665;
    unsigned char *free_mem_218769;
    unsigned char *free_mem_218773;
};
struct futhark_mc_segmap_parloop_struct_236013 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210629;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218665;
    unsigned char *free_mem_218769;
    unsigned char *free_mem_218773;
};
static int futhark_mc_segmap_parloop_236014(void *args, int64_t start,
                                            int64_t end, int flat_tid_226814,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236013
    *futhark_mc_segmap_parloop_struct_236013 =
    (struct futhark_mc_segmap_parloop_struct_236013 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236013->ctx;
    uint64_t futhark_mc_segmap_parloop_236014_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236014_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236013->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236013->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236013->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236013->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236013->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236013->free_s_n_m_203726;
    int64_t gtid_210629 =
            futhark_mc_segmap_parloop_struct_236013->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236013->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_236013->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_236013->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236013->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236013->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236013->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236013->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 =
            futhark_mc_segmap_parloop_struct_236013->free_bytes_218665;
    struct memblock mem_218769 = {.desc ="mem_218769", .mem =
                                  futhark_mc_segmap_parloop_struct_236013->free_mem_218769,
                                  .size =0, .references =NULL};
    struct memblock mem_218773 = {.desc ="mem_218773", .mem =
                                  futhark_mc_segmap_parloop_struct_236013->free_mem_218773,
                                  .size =0, .references =NULL};
    size_t mem_226817_cached_sizze_236015 = 0;
    unsigned char *mem_226817 = NULL;
    size_t mem_226819_cached_sizze_236016 = 0;
    unsigned char *mem_226819 = NULL;
    size_t mem_226821_cached_sizze_236017 = 0;
    unsigned char *mem_226821 = NULL;
    size_t mem_226822_cached_sizze_236018 = 0;
    unsigned char *mem_226822 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226912 = start;
    
    if (mem_226817_cached_sizze_236015 < (size_t) bytes_217663) {
        mem_226817 = realloc(mem_226817, bytes_217663);
        mem_226817_cached_sizze_236015 = bytes_217663;
    }
    if (mem_226819_cached_sizze_236016 < (size_t) bytes_217663) {
        mem_226819 = realloc(mem_226819, bytes_217663);
        mem_226819_cached_sizze_236016 = bytes_217663;
    }
    if (mem_226821_cached_sizze_236017 < (size_t) bytes_218665) {
        mem_226821 = realloc(mem_226821, bytes_218665);
        mem_226821_cached_sizze_236017 = bytes_218665;
    }
    if (mem_226822_cached_sizze_236018 < (size_t) bytes_218665) {
        mem_226822 = realloc(mem_226822, bytes_218665);
        mem_226822_cached_sizze_236018 = bytes_218665;
    }
    for (; iter_226912 < end; iter_226912++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226997 = n_p_203574;
        int64_t gtid_226815 = iter_226912;
        int64_t remnant_226998 = iter_226912 - gtid_226815;
        int64_t x_226816;
        
        x_226816 = ((int64_t *) mem_217658.mem)[gtid_210629 * n_p_203574 +
                                                gtid_226815];
        for (int64_t i_226913 = 0; i_226913 < s_n_m_203726; i_226913++) {
            int64_t x_226916;
            
            x_226916 = ((int64_t *) mem_217828.mem)[gtid_210629 *
                                                    (s_n_m_203726 *
                                                     n_p_203574) + gtid_226815 *
                                                    s_n_m_203726 + i_226913];
            
            double x_226917;
            
            x_226917 = ((double *) mem_217833.mem)[gtid_210629 * (s_n_m_203726 *
                                                                  n_p_203574) +
                                                   gtid_226815 * s_n_m_203726 +
                                                   i_226913];
            
            bool cond_226918 = i_226913 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_226919;
            
            if (cond_226918) {
                defunc_0_m_fun_res_226919 = (int64_t) 0;
            } else {
                int64_t y_226920 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_226921 = i_226913 == y_226920;
                int64_t defunc_0_m_fun_res_f_res_226922;
                
                if (cond_226921) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_226923 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_226922 =
                        defunc_0_m_fun_res_f_res_t_res_226923;
                } else {
                    int64_t x_226924 = sub64(i_226913, (int64_t) 1);
                    int64_t x_226925 = mul64(jump_s_203581, x_226924);
                    int64_t min_arg_226926 = add64((int64_t) 1, x_226925);
                    int64_t min_res_226927 = smin64(defunc_0_f_res_203721,
                                                    min_arg_226926);
                    
                    defunc_0_m_fun_res_f_res_226922 = min_res_226927;
                }
                defunc_0_m_fun_res_226919 = defunc_0_m_fun_res_f_res_226922;
            }
            
            double defunc_2_reduce_res_226930;
            double defunc_2_reduce_res_226931;
            double defunc_2_reduce_res_226932;
            double redout_226936;
            double redout_226937;
            double redout_226938;
            
            redout_226936 = 0.0;
            redout_226937 = 0.0;
            redout_226938 = 0.0;
            for (int64_t i_226935 = 0; i_226935 < q_s_203575; i_226935++) {
                bool cond_226941 = sle64(x_226816, i_226935);
                int64_t defunc_0_f_res_226942;
                
                if (cond_226941) {
                    defunc_0_f_res_226942 = (int64_t) 0;
                } else {
                    int64_t i_226943 = add64(x_226916, i_226935);
                    int64_t defunc_0_add_arg_226944;
                    
                    defunc_0_add_arg_226944 =
                        ((int64_t *) mem_217654.mem)[gtid_210629 *
                                                     (defunc_0_f_res_203721 *
                                                      n_p_203574) +
                                                     gtid_226815 *
                                                     defunc_0_f_res_203721 +
                                                     i_226943];
                    
                    int64_t defunc_1_add_res_226945 = add64((int64_t) 1,
                                                            defunc_0_add_arg_226944);
                    
                    defunc_0_f_res_226942 = defunc_1_add_res_226945;
                }
                
                double defunc_0_f_res_226946;
                
                if (cond_226941) {
                    defunc_0_f_res_226946 = 0.0;
                } else {
                    int64_t i_226947 = add64(x_226916, i_226935);
                    double defunc_0_add_arg_226948;
                    
                    defunc_0_add_arg_226948 =
                        ((double *) mem_218175.mem)[gtid_210629 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_226815 *
                                                    defunc_0_f_res_203721 +
                                                    i_226947];
                    defunc_0_f_res_226946 = defunc_0_add_arg_226948;
                }
                
                int64_t binop_p_226949 = sub64(defunc_0_f_res_226942,
                                               defunc_0_m_fun_res_226919);
                double defunc_0_f_res_226950 = sitofp_i64_f64(binop_p_226949);
                double abs_res_226951 = fabs(defunc_0_f_res_226950);
                double tmp1_226952 = abs_res_226951 / x_226917;
                double x_226953 = tmp1_226952 * tmp1_226952;
                double y_226954 = tmp1_226952 * x_226953;
                double tmp2_226955 = 1.0 - y_226954;
                double x_226956 = tmp2_226955 * tmp2_226955;
                double tmp3_226957 = tmp2_226955 * x_226956;
                double tmp4_226958 = defunc_0_f_res_226946 * tmp3_226957;
                double defunc_1_f_res_226959 = defunc_0_f_res_226950 *
                       tmp4_226958;
                double defunc_1_f_res_226960 = defunc_0_f_res_226950 *
                       defunc_1_f_res_226959;
                double defunc_1_op_res_226961 = tmp4_226958 + redout_226936;
                double defunc_1_op_res_226962 = defunc_1_f_res_226959 +
                       redout_226937;
                double defunc_1_op_res_226963 = defunc_1_f_res_226960 +
                       redout_226938;
                
                ((double *) mem_226821)[i_226935] = defunc_1_f_res_226959;
                ((double *) mem_226822)[i_226935] = tmp4_226958;
                
                double redout_tmp_227001 = defunc_1_op_res_226961;
                double redout_tmp_227002 = defunc_1_op_res_226962;
                double redout_tmp_227003 = defunc_1_op_res_226963;
                
                redout_226936 = redout_tmp_227001;
                redout_226937 = redout_tmp_227002;
                redout_226938 = redout_tmp_227003;
            }
            defunc_2_reduce_res_226930 = redout_226936;
            defunc_2_reduce_res_226931 = redout_226937;
            defunc_2_reduce_res_226932 = redout_226938;
            
            double x_226966 = defunc_2_reduce_res_226930 *
                   defunc_2_reduce_res_226932;
            double y_226967 = defunc_2_reduce_res_226931 *
                   defunc_2_reduce_res_226931;
            double y_226968 = x_226966 - y_226967;
            double det1_226969 = 1.0 / y_226968;
            double a11_226970 = defunc_2_reduce_res_226932 * det1_226969;
            double x_226971 = 0.0 - defunc_2_reduce_res_226931;
            double b11_226972 = det1_226969 * x_226971;
            double c11_226973 = defunc_2_reduce_res_226930 * det1_226969;
            double defunc_2_reduce_res_226974;
            double defunc_2_reduce_res_226975;
            double redout_226977;
            double redout_226978;
            
            redout_226977 = 0.0;
            redout_226978 = 0.0;
            for (int64_t i_226976 = 0; i_226976 < q_s_203575; i_226976++) {
                double x_226979;
                
                x_226979 = ((double *) mem_226822)[i_226976];
                
                double x_226980;
                
                x_226980 = ((double *) mem_226821)[i_226976];
                
                bool cond_226981 = sle64(x_226816, i_226976);
                double defunc_0_f_res_226982;
                
                if (cond_226981) {
                    defunc_0_f_res_226982 = 0.0;
                } else {
                    int64_t i_226983 = add64(x_226916, i_226976);
                    double defunc_0_add_arg_226984;
                    
                    defunc_0_add_arg_226984 =
                        ((double *) mem_218170.mem)[gtid_210629 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_226815 *
                                                    defunc_0_f_res_203721 +
                                                    i_226983];
                    defunc_0_f_res_226982 = defunc_0_add_arg_226984;
                }
                
                double x_226985 = a11_226970 * x_226979;
                double y_226986 = b11_226972 * x_226980;
                double x_226987 = x_226985 + y_226986;
                double defunc_9_fit_fun_res_226988 = defunc_0_f_res_226982 *
                       x_226987;
                double x_226989 = b11_226972 * x_226979;
                double y_226990 = c11_226973 * x_226980;
                double x_226991 = x_226989 + y_226990;
                double defunc_9_slope_fun_res_226992 = defunc_0_f_res_226982 *
                       x_226991;
                double defunc_1_op_res_226993 = defunc_9_fit_fun_res_226988 +
                       redout_226977;
                double defunc_1_op_res_226994 = defunc_9_slope_fun_res_226992 +
                       redout_226978;
                double redout_tmp_227006 = defunc_1_op_res_226993;
                double redout_tmp_227007 = defunc_1_op_res_226994;
                
                redout_226977 = redout_tmp_227006;
                redout_226978 = redout_tmp_227007;
            }
            defunc_2_reduce_res_226974 = redout_226977;
            defunc_2_reduce_res_226975 = redout_226978;
            ((double *) mem_226817)[i_226913] = defunc_2_reduce_res_226974;
            ((double *) mem_226819)[i_226913] = defunc_2_reduce_res_226975;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218769.mem + gtid_226815 * s_n_m_203726 * (int64_t) 8,
                    mem_226817 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218773.mem + gtid_226815 * s_n_m_203726 * (int64_t) 8,
                    mem_226819 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_226817);
    free(mem_226819);
    free(mem_226821);
    free(mem_226822);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236014_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236014_end -
                 futhark_mc_segmap_parloop_236014_start;
        
        ctx->futhark_mc_segmap_parloop_236014_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236014_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236014_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236012(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226814 = tid;
    int num_tasks_226911 = info.nsubtasks;
    struct futhark_mc_task_236011 *futhark_mc_task_236011 =
                                  (struct futhark_mc_task_236011 *) args;
    struct futhark_context *ctx = futhark_mc_task_236011->ctx;
    uint64_t futhark_mc_segmap_task_236012_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236012_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236011->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236011->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236011->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236011->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236011->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236011->free_s_n_m_203726;
    int64_t gtid_210629 = futhark_mc_task_236011->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236011->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_236011->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_236011->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236011->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236011->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236011->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236011->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 = futhark_mc_task_236011->free_bytes_218665;
    struct memblock mem_218769 = {.desc ="mem_218769", .mem =
                                  futhark_mc_task_236011->free_mem_218769,
                                  .size =0, .references =NULL};
    struct memblock mem_218773 = {.desc ="mem_218773", .mem =
                                  futhark_mc_task_236011->free_mem_218773,
                                  .size =0, .references =NULL};
    int64_t iter_226912;
    struct futhark_mc_segmap_parloop_struct_236013
    futhark_mc_segmap_parloop_struct_236013;
    
    futhark_mc_segmap_parloop_struct_236013.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236013.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236013.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236013.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236013.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236013.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236013.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236013.free_gtid_210629 = gtid_210629;
    futhark_mc_segmap_parloop_struct_236013.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236013.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_236013.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_236013.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236013.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236013.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236013.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236013.free_bytes_218665 = bytes_218665;
    futhark_mc_segmap_parloop_struct_236013.free_mem_218769 = mem_218769.mem;
    futhark_mc_segmap_parloop_struct_236013.free_mem_218773 = mem_218773.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236014_task;
    
    futhark_mc_segmap_parloop_236014_task.name =
        "futhark_mc_segmap_parloop_236014";
    futhark_mc_segmap_parloop_236014_task.fn = futhark_mc_segmap_parloop_236014;
    futhark_mc_segmap_parloop_236014_task.args =
        &futhark_mc_segmap_parloop_struct_236013;
    futhark_mc_segmap_parloop_236014_task.iterations = iterations;
    futhark_mc_segmap_parloop_236014_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236014_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236014_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236014_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236014_task);
    
    if (futhark_mc_segmap_parloop_236014_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236014_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236014_total_end -
                 futhark_mc_segmap_parloop_236014_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236014_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236014_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236014_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236012_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236012_end -
                 futhark_mc_segmap_task_236012_start;
        
        ctx->futhark_mc_segmap_task_236012_runs[tid]++;
        ctx->futhark_mc_segmap_task_236012_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236012_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236020 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210629;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218665;
    unsigned char *free_mem_218769;
    unsigned char *free_mem_218773;
};
struct futhark_mc_task_236024 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210629;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218665;
    int64_t free_gtid_226641;
    int64_t free_x_226642;
    unsigned char *free_mem_226643;
    unsigned char *free_mem_226644;
};
struct futhark_mc_segmap_parloop_struct_236026 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210629;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218665;
    int64_t free_gtid_226641;
    int64_t free_x_226642;
    unsigned char *free_mem_226643;
    unsigned char *free_mem_226644;
};
static int futhark_mc_segmap_parloop_236027(void *args, int64_t start,
                                            int64_t end, int flat_tid_227093,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236026
    *futhark_mc_segmap_parloop_struct_236026 =
    (struct futhark_mc_segmap_parloop_struct_236026 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236026->ctx;
    uint64_t futhark_mc_segmap_parloop_236027_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236027_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236026->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236026->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236026->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236026->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236026->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236026->free_s_n_m_203726;
    int64_t gtid_210629 =
            futhark_mc_segmap_parloop_struct_236026->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236026->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236026->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236026->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236026->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236026->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 =
            futhark_mc_segmap_parloop_struct_236026->free_bytes_218665;
    int64_t gtid_226641 =
            futhark_mc_segmap_parloop_struct_236026->free_gtid_226641;
    int64_t x_226642 = futhark_mc_segmap_parloop_struct_236026->free_x_226642;
    struct memblock mem_226643 = {.desc ="mem_226643", .mem =
                                  futhark_mc_segmap_parloop_struct_236026->free_mem_226643,
                                  .size =0, .references =NULL};
    struct memblock mem_226644 = {.desc ="mem_226644", .mem =
                                  futhark_mc_segmap_parloop_struct_236026->free_mem_226644,
                                  .size =0, .references =NULL};
    size_t mem_227107_cached_sizze_236028 = 0;
    unsigned char *mem_227107 = NULL;
    size_t mem_227109_cached_sizze_236029 = 0;
    unsigned char *mem_227109 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227179 = start;
    
    if (mem_227107_cached_sizze_236028 < (size_t) bytes_218665) {
        mem_227107 = realloc(mem_227107, bytes_218665);
        mem_227107_cached_sizze_236028 = bytes_218665;
    }
    if (mem_227109_cached_sizze_236029 < (size_t) bytes_218665) {
        mem_227109 = realloc(mem_227109, bytes_218665);
        mem_227109_cached_sizze_236029 = bytes_218665;
    }
    for (; iter_227179 < end; iter_227179++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227238 = s_n_m_203726;
        int64_t gtid_227094 = iter_227179;
        int64_t remnant_227239 = iter_227179 - gtid_227094;
        int64_t x_227095;
        
        x_227095 = ((int64_t *) mem_217828.mem)[gtid_210629 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_226641 * s_n_m_203726 +
                                                gtid_227094];
        
        double x_227096;
        
        x_227096 = ((double *) mem_217833.mem)[gtid_210629 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_226641 * s_n_m_203726 +
                                               gtid_227094];
        
        bool cond_227097 = gtid_227094 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_227098;
        
        if (cond_227097) {
            defunc_0_m_fun_res_227098 = (int64_t) 0;
        } else {
            int64_t y_227180 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_227181 = gtid_227094 == y_227180;
            int64_t defunc_0_m_fun_res_f_res_227182;
            
            if (cond_227181) {
                int64_t defunc_0_m_fun_res_f_res_t_res_227183 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_227182 =
                    defunc_0_m_fun_res_f_res_t_res_227183;
            } else {
                int64_t x_227184 = sub64(gtid_227094, (int64_t) 1);
                int64_t x_227185 = mul64(jump_s_203581, x_227184);
                int64_t min_arg_227186 = add64((int64_t) 1, x_227185);
                int64_t min_res_227187 = smin64(defunc_0_f_res_203721,
                                                min_arg_227186);
                
                defunc_0_m_fun_res_f_res_227182 = min_res_227187;
            }
            defunc_0_m_fun_res_227098 = defunc_0_m_fun_res_f_res_227182;
        }
        
        double defunc_2_reduce_res_227111;
        double defunc_2_reduce_res_227112;
        double defunc_2_reduce_res_227113;
        double redout_227189;
        double redout_227190;
        double redout_227191;
        
        redout_227189 = 0.0;
        redout_227190 = 0.0;
        redout_227191 = 0.0;
        for (int64_t i_227188 = 0; i_227188 < q_s_203575; i_227188++) {
            bool cond_227194 = sle64(x_226642, i_227188);
            int64_t defunc_0_f_res_227195;
            
            if (cond_227194) {
                defunc_0_f_res_227195 = (int64_t) 0;
            } else {
                int64_t i_227196 = add64(x_227095, i_227188);
                int64_t defunc_0_add_arg_227197;
                
                defunc_0_add_arg_227197 =
                    ((int64_t *) mem_217654.mem)[gtid_210629 *
                                                 (defunc_0_f_res_203721 *
                                                  n_p_203574) + gtid_226641 *
                                                 defunc_0_f_res_203721 +
                                                 i_227196];
                
                int64_t defunc_1_add_res_227198 = add64((int64_t) 1,
                                                        defunc_0_add_arg_227197);
                
                defunc_0_f_res_227195 = defunc_1_add_res_227198;
            }
            
            double defunc_0_f_res_227199;
            
            if (cond_227194) {
                defunc_0_f_res_227199 = 0.0;
            } else {
                int64_t i_227200 = add64(x_227095, i_227188);
                double defunc_0_add_arg_227201;
                
                defunc_0_add_arg_227201 =
                    ((double *) mem_218175.mem)[gtid_210629 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_226641 *
                                                defunc_0_f_res_203721 +
                                                i_227200];
                defunc_0_f_res_227199 = defunc_0_add_arg_227201;
            }
            
            int64_t binop_p_227202 = sub64(defunc_0_f_res_227195,
                                           defunc_0_m_fun_res_227098);
            double defunc_0_f_res_227203 = sitofp_i64_f64(binop_p_227202);
            double abs_res_227204 = fabs(defunc_0_f_res_227203);
            double tmp1_227205 = abs_res_227204 / x_227096;
            double x_227206 = tmp1_227205 * tmp1_227205;
            double y_227207 = tmp1_227205 * x_227206;
            double tmp2_227208 = 1.0 - y_227207;
            double x_227209 = tmp2_227208 * tmp2_227208;
            double tmp3_227210 = tmp2_227208 * x_227209;
            double tmp4_227211 = defunc_0_f_res_227199 * tmp3_227210;
            double defunc_1_f_res_227212 = defunc_0_f_res_227203 * tmp4_227211;
            double defunc_1_f_res_227213 = defunc_0_f_res_227203 *
                   defunc_1_f_res_227212;
            double defunc_1_op_res_227214 = tmp4_227211 + redout_227189;
            double defunc_1_op_res_227215 = defunc_1_f_res_227212 +
                   redout_227190;
            double defunc_1_op_res_227216 = defunc_1_f_res_227213 +
                   redout_227191;
            
            ((double *) mem_227107)[i_227188] = defunc_1_f_res_227212;
            ((double *) mem_227109)[i_227188] = tmp4_227211;
            
            double redout_tmp_227240 = defunc_1_op_res_227214;
            double redout_tmp_227241 = defunc_1_op_res_227215;
            double redout_tmp_227242 = defunc_1_op_res_227216;
            
            redout_227189 = redout_tmp_227240;
            redout_227190 = redout_tmp_227241;
            redout_227191 = redout_tmp_227242;
        }
        defunc_2_reduce_res_227111 = redout_227189;
        defunc_2_reduce_res_227112 = redout_227190;
        defunc_2_reduce_res_227113 = redout_227191;
        
        double x_227147 = defunc_2_reduce_res_227111 *
               defunc_2_reduce_res_227113;
        double y_227148 = defunc_2_reduce_res_227112 *
               defunc_2_reduce_res_227112;
        double y_227149 = x_227147 - y_227148;
        double det1_227150 = 1.0 / y_227149;
        double a11_227151 = defunc_2_reduce_res_227113 * det1_227150;
        double x_227152 = 0.0 - defunc_2_reduce_res_227112;
        double b11_227153 = det1_227150 * x_227152;
        double c11_227154 = defunc_2_reduce_res_227111 * det1_227150;
        double defunc_2_reduce_res_227155;
        double defunc_2_reduce_res_227156;
        double redout_227220;
        double redout_227221;
        
        redout_227220 = 0.0;
        redout_227221 = 0.0;
        for (int64_t i_227219 = 0; i_227219 < q_s_203575; i_227219++) {
            double x_227222;
            
            x_227222 = ((double *) mem_227109)[i_227219];
            
            double x_227223;
            
            x_227223 = ((double *) mem_227107)[i_227219];
            
            bool cond_227224 = sle64(x_226642, i_227219);
            double defunc_0_f_res_227225;
            
            if (cond_227224) {
                defunc_0_f_res_227225 = 0.0;
            } else {
                int64_t i_227226 = add64(x_227095, i_227219);
                double defunc_0_add_arg_227227;
                
                defunc_0_add_arg_227227 =
                    ((double *) mem_218170.mem)[gtid_210629 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_226641 *
                                                defunc_0_f_res_203721 +
                                                i_227226];
                defunc_0_f_res_227225 = defunc_0_add_arg_227227;
            }
            
            double x_227228 = a11_227151 * x_227222;
            double y_227229 = b11_227153 * x_227223;
            double x_227230 = x_227228 + y_227229;
            double defunc_9_fit_fun_res_227231 = defunc_0_f_res_227225 *
                   x_227230;
            double x_227232 = b11_227153 * x_227222;
            double y_227233 = c11_227154 * x_227223;
            double x_227234 = x_227232 + y_227233;
            double defunc_9_slope_fun_res_227235 = defunc_0_f_res_227225 *
                   x_227234;
            double defunc_1_op_res_227236 = defunc_9_fit_fun_res_227231 +
                   redout_227220;
            double defunc_1_op_res_227237 = defunc_9_slope_fun_res_227235 +
                   redout_227221;
            double redout_tmp_227245 = defunc_1_op_res_227236;
            double redout_tmp_227246 = defunc_1_op_res_227237;
            
            redout_227220 = redout_tmp_227245;
            redout_227221 = redout_tmp_227246;
        }
        defunc_2_reduce_res_227155 = redout_227220;
        defunc_2_reduce_res_227156 = redout_227221;
        ((double *) mem_226643.mem)[gtid_227094] = defunc_2_reduce_res_227155;
        ((double *) mem_226644.mem)[gtid_227094] = defunc_2_reduce_res_227156;
    }
    
  cleanup:
    { }
    free(mem_227107);
    free(mem_227109);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236027_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236027_end -
                 futhark_mc_segmap_parloop_236027_start;
        
        ctx->futhark_mc_segmap_parloop_236027_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236027_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236027_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236025(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227093 = tid;
    int num_tasks_227178 = info.nsubtasks;
    struct futhark_mc_task_236024 *futhark_mc_task_236024 =
                                  (struct futhark_mc_task_236024 *) args;
    struct futhark_context *ctx = futhark_mc_task_236024->ctx;
    uint64_t futhark_mc_segmap_task_236025_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236025_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236024->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236024->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236024->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236024->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236024->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236024->free_s_n_m_203726;
    int64_t gtid_210629 = futhark_mc_task_236024->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236024->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236024->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236024->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236024->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236024->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 = futhark_mc_task_236024->free_bytes_218665;
    int64_t gtid_226641 = futhark_mc_task_236024->free_gtid_226641;
    int64_t x_226642 = futhark_mc_task_236024->free_x_226642;
    struct memblock mem_226643 = {.desc ="mem_226643", .mem =
                                  futhark_mc_task_236024->free_mem_226643,
                                  .size =0, .references =NULL};
    struct memblock mem_226644 = {.desc ="mem_226644", .mem =
                                  futhark_mc_task_236024->free_mem_226644,
                                  .size =0, .references =NULL};
    int64_t iter_227179;
    struct futhark_mc_segmap_parloop_struct_236026
    futhark_mc_segmap_parloop_struct_236026;
    
    futhark_mc_segmap_parloop_struct_236026.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236026.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236026.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236026.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236026.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236026.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236026.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236026.free_gtid_210629 = gtid_210629;
    futhark_mc_segmap_parloop_struct_236026.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236026.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236026.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236026.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236026.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236026.free_bytes_218665 = bytes_218665;
    futhark_mc_segmap_parloop_struct_236026.free_gtid_226641 = gtid_226641;
    futhark_mc_segmap_parloop_struct_236026.free_x_226642 = x_226642;
    futhark_mc_segmap_parloop_struct_236026.free_mem_226643 = mem_226643.mem;
    futhark_mc_segmap_parloop_struct_236026.free_mem_226644 = mem_226644.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236027_task;
    
    futhark_mc_segmap_parloop_236027_task.name =
        "futhark_mc_segmap_parloop_236027";
    futhark_mc_segmap_parloop_236027_task.fn = futhark_mc_segmap_parloop_236027;
    futhark_mc_segmap_parloop_236027_task.args =
        &futhark_mc_segmap_parloop_struct_236026;
    futhark_mc_segmap_parloop_236027_task.iterations = iterations;
    futhark_mc_segmap_parloop_236027_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236027_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236027_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236027_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236027_task);
    
    if (futhark_mc_segmap_parloop_236027_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236027_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236027_total_end -
                 futhark_mc_segmap_parloop_236027_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236027_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236027_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236027_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236025_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236025_end -
                 futhark_mc_segmap_task_236025_start;
        
        ctx->futhark_mc_segmap_task_236025_runs[tid]++;
        ctx->futhark_mc_segmap_task_236025_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236025_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236031 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_210629;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218665;
    int64_t free_gtid_226641;
    int64_t free_x_226642;
    unsigned char *free_mem_226643;
    unsigned char *free_mem_226644;
};
struct futhark_mc_task_236035 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_210629;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_226641;
    int64_t free_x_226642;
    int64_t free_x_227011;
    double free_x_227012;
    int64_t free_defunc_0_m_fun_res_227014;
    double *retval_defunc_2_reduce_res_227025;
    double *retval_defunc_2_reduce_res_227026;
    double *retval_defunc_2_reduce_res_227027;
    unsigned char *retval_mem_227023;
    unsigned char *retval_mem_227024;
};
struct futhark_mc_segred_stage_1_parloop_struct_236040 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_210629;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_226641;
    int64_t free_x_226642;
    int64_t free_x_227011;
    double free_x_227012;
    int64_t free_defunc_0_m_fun_res_227014;
    unsigned char *free_mem_227023;
    unsigned char *free_mem_227024;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227312;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227314;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227316;
};
static int futhark_mc_segred_stage_1_parloop_236041(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_227256,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236040
    *futhark_mc_segred_stage_1_parloop_struct_236040 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236040 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236040->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236041_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236041_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_236040->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_236040->free_defunc_0_f_res_203721;
    int64_t gtid_210629 =
            futhark_mc_segred_stage_1_parloop_struct_236040->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236040->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236040->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_226641 =
            futhark_mc_segred_stage_1_parloop_struct_236040->free_gtid_226641;
    int64_t x_226642 =
            futhark_mc_segred_stage_1_parloop_struct_236040->free_x_226642;
    int64_t x_227011 =
            futhark_mc_segred_stage_1_parloop_struct_236040->free_x_227011;
    double x_227012 =
           futhark_mc_segred_stage_1_parloop_struct_236040->free_x_227012;
    int64_t defunc_0_m_fun_res_227014 =
            futhark_mc_segred_stage_1_parloop_struct_236040->free_defunc_0_m_fun_res_227014;
    struct memblock mem_227023 = {.desc ="mem_227023", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236040->free_mem_227023,
                                  .size =0, .references =NULL};
    struct memblock mem_227024 = {.desc ="mem_227024", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236040->free_mem_227024,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_227312 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227312",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236040->free_reduce_stage_1_tid_res_arr_mem_227312,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_227314 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227314",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236040->free_reduce_stage_1_tid_res_arr_mem_227314,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_227316 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227316",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236040->free_reduce_stage_1_tid_res_arr_mem_227316,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_227318 = start;
    double x_227258;
    double x_227259;
    double x_227261;
    double x_227262;
    double x_227264;
    double x_227265;
    double local_acc_227319 = 0.0;
    double local_acc_227320 = 0.0;
    double local_acc_227321 = 0.0;
    
    for (; iter_227318 < end; iter_227318++) {
        int64_t gtid_227257 = iter_227318;
        bool cond_227267 = sle64(x_226642, gtid_227257);
        int64_t defunc_0_f_res_227268;
        
        if (cond_227267) {
            defunc_0_f_res_227268 = (int64_t) 0;
        } else {
            int64_t i_227269 = add64(x_227011, gtid_227257);
            int64_t defunc_0_add_arg_227270;
            
            defunc_0_add_arg_227270 = ((int64_t *) mem_217654.mem)[gtid_210629 *
                                                                   (defunc_0_f_res_203721 *
                                                                    n_p_203574) +
                                                                   gtid_226641 *
                                                                   defunc_0_f_res_203721 +
                                                                   i_227269];
            
            int64_t defunc_1_add_res_227271 = add64((int64_t) 1,
                                                    defunc_0_add_arg_227270);
            
            defunc_0_f_res_227268 = defunc_1_add_res_227271;
        }
        
        double defunc_0_f_res_227272;
        
        if (cond_227267) {
            defunc_0_f_res_227272 = 0.0;
        } else {
            int64_t i_227273 = add64(x_227011, gtid_227257);
            double defunc_0_add_arg_227274;
            
            defunc_0_add_arg_227274 = ((double *) mem_218175.mem)[gtid_210629 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_226641 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_227273];
            defunc_0_f_res_227272 = defunc_0_add_arg_227274;
        }
        
        int64_t binop_p_227275 = sub64(defunc_0_f_res_227268,
                                       defunc_0_m_fun_res_227014);
        double defunc_0_f_res_227276 = sitofp_i64_f64(binop_p_227275);
        double abs_res_227277 = fabs(defunc_0_f_res_227276);
        double tmp1_227278 = abs_res_227277 / x_227012;
        double x_227279 = tmp1_227278 * tmp1_227278;
        double y_227280 = tmp1_227278 * x_227279;
        double tmp2_227281 = 1.0 - y_227280;
        double x_227282 = tmp2_227281 * tmp2_227281;
        double tmp3_227283 = tmp2_227281 * x_227282;
        double tmp4_227284 = defunc_0_f_res_227272 * tmp3_227283;
        double defunc_1_f_res_227285 = defunc_0_f_res_227276 * tmp4_227284;
        double defunc_1_f_res_227286 = defunc_0_f_res_227276 *
               defunc_1_f_res_227285;
        
        // save map-out results
        {
            ((double *) mem_227023.mem)[gtid_227257] = defunc_1_f_res_227285;
            ((double *) mem_227024.mem)[gtid_227257] = tmp4_227284;
        }
        // Load accum params
        {
            x_227258 = local_acc_227319;
        }
        // Load next params
        {
            x_227259 = tmp4_227284;
        }
        // Red body
        {
            double defunc_1_op_res_227260 = x_227258 + x_227259;
            
            local_acc_227319 = defunc_1_op_res_227260;
        }
        // Load accum params
        {
            x_227261 = local_acc_227320;
        }
        // Load next params
        {
            x_227262 = defunc_1_f_res_227285;
        }
        // Red body
        {
            double defunc_1_op_res_227263 = x_227261 + x_227262;
            
            local_acc_227320 = defunc_1_op_res_227263;
        }
        // Load accum params
        {
            x_227264 = local_acc_227321;
        }
        // Load next params
        {
            x_227265 = defunc_1_f_res_227286;
        }
        // Red body
        {
            double defunc_1_op_res_227266 = x_227264 + x_227265;
            
            local_acc_227321 = defunc_1_op_res_227266;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_227312.mem)[flat_tid_227256] =
        local_acc_227319;
    ((double *) reduce_stage_1_tid_res_arr_mem_227314.mem)[flat_tid_227256] =
        local_acc_227320;
    ((double *) reduce_stage_1_tid_res_arr_mem_227316.mem)[flat_tid_227256] =
        local_acc_227321;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236041_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236041_end -
                 futhark_mc_segred_stage_1_parloop_236041_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236041_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236041_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236041_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236036(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227256 = tid;
    int num_tasks_227311 = info.nsubtasks;
    struct futhark_mc_task_236035 *futhark_mc_task_236035 =
                                  (struct futhark_mc_task_236035 *) args;
    struct futhark_context *ctx = futhark_mc_task_236035->ctx;
    uint64_t futhark_mc_segred_task_236036_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236036_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236035->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236035->free_defunc_0_f_res_203721;
    int64_t gtid_210629 = futhark_mc_task_236035->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236035->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236035->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_226641 = futhark_mc_task_236035->free_gtid_226641;
    int64_t x_226642 = futhark_mc_task_236035->free_x_226642;
    int64_t x_227011 = futhark_mc_task_236035->free_x_227011;
    double x_227012 = futhark_mc_task_236035->free_x_227012;
    int64_t defunc_0_m_fun_res_227014 =
            futhark_mc_task_236035->free_defunc_0_m_fun_res_227014;
    double defunc_2_reduce_res_227025 =
           *futhark_mc_task_236035->retval_defunc_2_reduce_res_227025;
    double defunc_2_reduce_res_227026 =
           *futhark_mc_task_236035->retval_defunc_2_reduce_res_227026;
    double defunc_2_reduce_res_227027 =
           *futhark_mc_task_236035->retval_defunc_2_reduce_res_227027;
    struct memblock mem_227023 = {.desc ="mem_227023", .mem =
                                  futhark_mc_task_236035->retval_mem_227023,
                                  .size =0, .references =NULL};
    struct memblock mem_227024 = {.desc ="mem_227024", .mem =
                                  futhark_mc_task_236035->retval_mem_227024,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_227312_cached_sizze_236037 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227312 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_227314_cached_sizze_236038 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227314 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_227316_cached_sizze_236039 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227316 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_227312_cached_sizze_236037 <
        (size_t) ((int64_t) 8 * num_tasks_227311)) {
        reduce_stage_1_tid_res_arr_mem_227312 =
            realloc(reduce_stage_1_tid_res_arr_mem_227312, (int64_t) 8 *
                    num_tasks_227311);
        reduce_stage_1_tid_res_arr_mem_227312_cached_sizze_236037 =
            (int64_t) 8 * num_tasks_227311;
    }
    if (reduce_stage_1_tid_res_arr_mem_227314_cached_sizze_236038 <
        (size_t) ((int64_t) 8 * num_tasks_227311)) {
        reduce_stage_1_tid_res_arr_mem_227314 =
            realloc(reduce_stage_1_tid_res_arr_mem_227314, (int64_t) 8 *
                    num_tasks_227311);
        reduce_stage_1_tid_res_arr_mem_227314_cached_sizze_236038 =
            (int64_t) 8 * num_tasks_227311;
    }
    if (reduce_stage_1_tid_res_arr_mem_227316_cached_sizze_236039 <
        (size_t) ((int64_t) 8 * num_tasks_227311)) {
        reduce_stage_1_tid_res_arr_mem_227316 =
            realloc(reduce_stage_1_tid_res_arr_mem_227316, (int64_t) 8 *
                    num_tasks_227311);
        reduce_stage_1_tid_res_arr_mem_227316_cached_sizze_236039 =
            (int64_t) 8 * num_tasks_227311;
    }
    
    int64_t iter_227318;
    struct futhark_mc_segred_stage_1_parloop_struct_236040
    futhark_mc_segred_stage_1_parloop_struct_236040;
    
    futhark_mc_segred_stage_1_parloop_struct_236040.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_gtid_210629 =
        gtid_210629;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_mem_217654 =
        mem_217654.mem;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_mem_218175 =
        mem_218175.mem;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_gtid_226641 =
        gtid_226641;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_x_226642 = x_226642;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_x_227011 = x_227011;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_x_227012 = x_227012;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_defunc_0_m_fun_res_227014 =
        defunc_0_m_fun_res_227014;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_mem_227023 =
        mem_227023.mem;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_mem_227024 =
        mem_227024.mem;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_reduce_stage_1_tid_res_arr_mem_227312 =
        reduce_stage_1_tid_res_arr_mem_227312;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_reduce_stage_1_tid_res_arr_mem_227314 =
        reduce_stage_1_tid_res_arr_mem_227314;
    futhark_mc_segred_stage_1_parloop_struct_236040.free_reduce_stage_1_tid_res_arr_mem_227316 =
        reduce_stage_1_tid_res_arr_mem_227316;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236041_task;
    
    futhark_mc_segred_stage_1_parloop_236041_task.name =
        "futhark_mc_segred_stage_1_parloop_236041";
    futhark_mc_segred_stage_1_parloop_236041_task.fn =
        futhark_mc_segred_stage_1_parloop_236041;
    futhark_mc_segred_stage_1_parloop_236041_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236040;
    futhark_mc_segred_stage_1_parloop_236041_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236041_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236041_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236041_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236041_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236041_task);
    
    if (futhark_mc_segred_stage_1_parloop_236041_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236041_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236041_total_end -
                 futhark_mc_segred_stage_1_parloop_236041_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236041_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236041_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236041_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_227025 = 0.0;
        defunc_2_reduce_res_227026 = 0.0;
        defunc_2_reduce_res_227027 = 0.0;
    }
    
    double x_227322;
    double x_227323;
    double x_227325;
    double x_227326;
    double x_227328;
    double x_227329;
    
    for (int32_t i_227331 = 0; i_227331 < num_tasks_227311; i_227331++) {
        flat_tid_227256 = i_227331;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_227322 = defunc_2_reduce_res_227025;
            }
            // load next params
            {
                x_227323 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227312)[flat_tid_227256];
            }
            // red body
            {
                double defunc_1_op_res_227324 = x_227322 + x_227323;
                
                defunc_2_reduce_res_227025 = defunc_1_op_res_227324;
            }
            // load acc params
            {
                x_227325 = defunc_2_reduce_res_227026;
            }
            // load next params
            {
                x_227326 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227314)[flat_tid_227256];
            }
            // red body
            {
                double defunc_1_op_res_227327 = x_227325 + x_227326;
                
                defunc_2_reduce_res_227026 = defunc_1_op_res_227327;
            }
            // load acc params
            {
                x_227328 = defunc_2_reduce_res_227027;
            }
            // load next params
            {
                x_227329 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227316)[flat_tid_227256];
            }
            // red body
            {
                double defunc_1_op_res_227330 = x_227328 + x_227329;
                
                defunc_2_reduce_res_227027 = defunc_1_op_res_227330;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_227312);
        free(reduce_stage_1_tid_res_arr_mem_227314);
        free(reduce_stage_1_tid_res_arr_mem_227316);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236036_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236036_end -
                 futhark_mc_segred_task_236036_start;
        
        ctx->futhark_mc_segred_task_236036_runs[tid]++;
        ctx->futhark_mc_segred_task_236036_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236036_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236035->retval_defunc_2_reduce_res_227025 =
            defunc_2_reduce_res_227025;
        *futhark_mc_task_236035->retval_defunc_2_reduce_res_227026 =
            defunc_2_reduce_res_227026;
        *futhark_mc_task_236035->retval_defunc_2_reduce_res_227027 =
            defunc_2_reduce_res_227027;
        futhark_mc_task_236035->retval_mem_227023 = mem_227023.mem;
        futhark_mc_task_236035->retval_mem_227024 = mem_227024.mem;
    }
    return err;
}
struct futhark_mc_task_236042 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_210629;
    unsigned char *free_mem_218170;
    int64_t free_gtid_226641;
    int64_t free_x_226642;
    int64_t free_x_227011;
    unsigned char *free_mem_227023;
    unsigned char *free_mem_227024;
    double free_a11_227065;
    double free_b11_227067;
    double free_c11_227068;
    double *retval_defunc_2_reduce_res_227069;
    double *retval_defunc_2_reduce_res_227070;
};
struct futhark_mc_segred_stage_1_parloop_struct_236046 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_210629;
    unsigned char *free_mem_218170;
    int64_t free_gtid_226641;
    int64_t free_x_226642;
    int64_t free_x_227011;
    unsigned char *free_mem_227023;
    unsigned char *free_mem_227024;
    double free_a11_227065;
    double free_b11_227067;
    double free_c11_227068;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227333;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_227335;
};
static int futhark_mc_segred_stage_1_parloop_236047(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_227287,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236046
    *futhark_mc_segred_stage_1_parloop_struct_236046 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236046 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236046->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236047_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236047_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_236046->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_236046->free_defunc_0_f_res_203721;
    int64_t gtid_210629 =
            futhark_mc_segred_stage_1_parloop_struct_236046->free_gtid_210629;
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236046->free_mem_218170,
                                  .size =0, .references =NULL};
    int64_t gtid_226641 =
            futhark_mc_segred_stage_1_parloop_struct_236046->free_gtid_226641;
    int64_t x_226642 =
            futhark_mc_segred_stage_1_parloop_struct_236046->free_x_226642;
    int64_t x_227011 =
            futhark_mc_segred_stage_1_parloop_struct_236046->free_x_227011;
    struct memblock mem_227023 = {.desc ="mem_227023", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236046->free_mem_227023,
                                  .size =0, .references =NULL};
    struct memblock mem_227024 = {.desc ="mem_227024", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236046->free_mem_227024,
                                  .size =0, .references =NULL};
    double a11_227065 =
           futhark_mc_segred_stage_1_parloop_struct_236046->free_a11_227065;
    double b11_227067 =
           futhark_mc_segred_stage_1_parloop_struct_236046->free_b11_227067;
    double c11_227068 =
           futhark_mc_segred_stage_1_parloop_struct_236046->free_c11_227068;
    struct memblock reduce_stage_1_tid_res_arr_mem_227333 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227333",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236046->free_reduce_stage_1_tid_res_arr_mem_227333,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_227335 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_227335",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236046->free_reduce_stage_1_tid_res_arr_mem_227335,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_227337 = start;
    double x_227289;
    double x_227290;
    double x_227292;
    double x_227293;
    double local_acc_227338 = 0.0;
    double local_acc_227339 = 0.0;
    
    for (; iter_227337 < end; iter_227337++) {
        int64_t gtid_227288 = iter_227337;
        double x_227295;
        
        x_227295 = ((double *) mem_227024.mem)[gtid_227288];
        
        double x_227296;
        
        x_227296 = ((double *) mem_227023.mem)[gtid_227288];
        
        bool cond_227297 = sle64(x_226642, gtid_227288);
        double defunc_0_f_res_227298;
        
        if (cond_227297) {
            defunc_0_f_res_227298 = 0.0;
        } else {
            int64_t i_227299 = add64(x_227011, gtid_227288);
            double defunc_0_add_arg_227300;
            
            defunc_0_add_arg_227300 = ((double *) mem_218170.mem)[gtid_210629 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_226641 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_227299];
            defunc_0_f_res_227298 = defunc_0_add_arg_227300;
        }
        
        double x_227301 = a11_227065 * x_227295;
        double y_227302 = b11_227067 * x_227296;
        double x_227303 = x_227301 + y_227302;
        double defunc_9_fit_fun_res_227304 = defunc_0_f_res_227298 * x_227303;
        double x_227305 = b11_227067 * x_227295;
        double y_227306 = c11_227068 * x_227296;
        double x_227307 = x_227305 + y_227306;
        double defunc_9_slope_fun_res_227308 = defunc_0_f_res_227298 * x_227307;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_227289 = local_acc_227338;
        }
        // Load next params
        {
            x_227290 = defunc_9_fit_fun_res_227304;
        }
        // Red body
        {
            double defunc_1_op_res_227291 = x_227289 + x_227290;
            
            local_acc_227338 = defunc_1_op_res_227291;
        }
        // Load accum params
        {
            x_227292 = local_acc_227339;
        }
        // Load next params
        {
            x_227293 = defunc_9_slope_fun_res_227308;
        }
        // Red body
        {
            double defunc_1_op_res_227294 = x_227292 + x_227293;
            
            local_acc_227339 = defunc_1_op_res_227294;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_227333.mem)[flat_tid_227287] =
        local_acc_227338;
    ((double *) reduce_stage_1_tid_res_arr_mem_227335.mem)[flat_tid_227287] =
        local_acc_227339;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236047_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236047_end -
                 futhark_mc_segred_stage_1_parloop_236047_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236047_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236047_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236047_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236043(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227287 = tid;
    int num_tasks_227332 = info.nsubtasks;
    struct futhark_mc_task_236042 *futhark_mc_task_236042 =
                                  (struct futhark_mc_task_236042 *) args;
    struct futhark_context *ctx = futhark_mc_task_236042->ctx;
    uint64_t futhark_mc_segred_task_236043_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236043_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236042->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236042->free_defunc_0_f_res_203721;
    int64_t gtid_210629 = futhark_mc_task_236042->free_gtid_210629;
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236042->free_mem_218170,
                                  .size =0, .references =NULL};
    int64_t gtid_226641 = futhark_mc_task_236042->free_gtid_226641;
    int64_t x_226642 = futhark_mc_task_236042->free_x_226642;
    int64_t x_227011 = futhark_mc_task_236042->free_x_227011;
    struct memblock mem_227023 = {.desc ="mem_227023", .mem =
                                  futhark_mc_task_236042->free_mem_227023,
                                  .size =0, .references =NULL};
    struct memblock mem_227024 = {.desc ="mem_227024", .mem =
                                  futhark_mc_task_236042->free_mem_227024,
                                  .size =0, .references =NULL};
    double a11_227065 = futhark_mc_task_236042->free_a11_227065;
    double b11_227067 = futhark_mc_task_236042->free_b11_227067;
    double c11_227068 = futhark_mc_task_236042->free_c11_227068;
    double defunc_2_reduce_res_227069 =
           *futhark_mc_task_236042->retval_defunc_2_reduce_res_227069;
    double defunc_2_reduce_res_227070 =
           *futhark_mc_task_236042->retval_defunc_2_reduce_res_227070;
    size_t reduce_stage_1_tid_res_arr_mem_227333_cached_sizze_236044 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227333 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_227335_cached_sizze_236045 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_227335 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_227333_cached_sizze_236044 <
        (size_t) ((int64_t) 8 * num_tasks_227332)) {
        reduce_stage_1_tid_res_arr_mem_227333 =
            realloc(reduce_stage_1_tid_res_arr_mem_227333, (int64_t) 8 *
                    num_tasks_227332);
        reduce_stage_1_tid_res_arr_mem_227333_cached_sizze_236044 =
            (int64_t) 8 * num_tasks_227332;
    }
    if (reduce_stage_1_tid_res_arr_mem_227335_cached_sizze_236045 <
        (size_t) ((int64_t) 8 * num_tasks_227332)) {
        reduce_stage_1_tid_res_arr_mem_227335 =
            realloc(reduce_stage_1_tid_res_arr_mem_227335, (int64_t) 8 *
                    num_tasks_227332);
        reduce_stage_1_tid_res_arr_mem_227335_cached_sizze_236045 =
            (int64_t) 8 * num_tasks_227332;
    }
    
    int64_t iter_227337;
    struct futhark_mc_segred_stage_1_parloop_struct_236046
    futhark_mc_segred_stage_1_parloop_struct_236046;
    
    futhark_mc_segred_stage_1_parloop_struct_236046.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_gtid_210629 =
        gtid_210629;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_mem_218170 =
        mem_218170.mem;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_gtid_226641 =
        gtid_226641;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_x_226642 = x_226642;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_x_227011 = x_227011;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_mem_227023 =
        mem_227023.mem;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_mem_227024 =
        mem_227024.mem;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_a11_227065 =
        a11_227065;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_b11_227067 =
        b11_227067;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_c11_227068 =
        c11_227068;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_reduce_stage_1_tid_res_arr_mem_227333 =
        reduce_stage_1_tid_res_arr_mem_227333;
    futhark_mc_segred_stage_1_parloop_struct_236046.free_reduce_stage_1_tid_res_arr_mem_227335 =
        reduce_stage_1_tid_res_arr_mem_227335;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236047_task;
    
    futhark_mc_segred_stage_1_parloop_236047_task.name =
        "futhark_mc_segred_stage_1_parloop_236047";
    futhark_mc_segred_stage_1_parloop_236047_task.fn =
        futhark_mc_segred_stage_1_parloop_236047;
    futhark_mc_segred_stage_1_parloop_236047_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236046;
    futhark_mc_segred_stage_1_parloop_236047_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236047_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236047_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236047_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236047_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236047_task);
    
    if (futhark_mc_segred_stage_1_parloop_236047_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236047_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236047_total_end -
                 futhark_mc_segred_stage_1_parloop_236047_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236047_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236047_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236047_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_227069 = 0.0;
        defunc_2_reduce_res_227070 = 0.0;
    }
    
    double x_227340;
    double x_227341;
    double x_227343;
    double x_227344;
    
    for (int32_t i_227346 = 0; i_227346 < num_tasks_227332; i_227346++) {
        flat_tid_227287 = i_227346;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_227340 = defunc_2_reduce_res_227069;
            }
            // load next params
            {
                x_227341 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227333)[flat_tid_227287];
            }
            // red body
            {
                double defunc_1_op_res_227342 = x_227340 + x_227341;
                
                defunc_2_reduce_res_227069 = defunc_1_op_res_227342;
            }
            // load acc params
            {
                x_227343 = defunc_2_reduce_res_227070;
            }
            // load next params
            {
                x_227344 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_227335)[flat_tid_227287];
            }
            // red body
            {
                double defunc_1_op_res_227345 = x_227343 + x_227344;
                
                defunc_2_reduce_res_227070 = defunc_1_op_res_227345;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_227333);
        free(reduce_stage_1_tid_res_arr_mem_227335);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236043_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236043_end -
                 futhark_mc_segred_task_236043_start;
        
        ctx->futhark_mc_segred_task_236043_runs[tid]++;
        ctx->futhark_mc_segred_task_236043_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236043_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236042->retval_defunc_2_reduce_res_227069 =
            defunc_2_reduce_res_227069;
        *futhark_mc_task_236042->retval_defunc_2_reduce_res_227070 =
            defunc_2_reduce_res_227070;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236032(void *args, int64_t start,
                                            int64_t end, int flat_tid_227009,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236031
    *futhark_mc_segmap_parloop_struct_236031 =
    (struct futhark_mc_segmap_parloop_struct_236031 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236031->ctx;
    uint64_t futhark_mc_segmap_parloop_236032_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236032_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236031->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236031->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236031->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236031->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236031->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236031->free_s_n_m_203726;
    int64_t gtid_210629 =
            futhark_mc_segmap_parloop_struct_236031->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236031->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236031->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236031->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236031->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236031->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 =
            futhark_mc_segmap_parloop_struct_236031->free_bytes_218665;
    int64_t gtid_226641 =
            futhark_mc_segmap_parloop_struct_236031->free_gtid_226641;
    int64_t x_226642 = futhark_mc_segmap_parloop_struct_236031->free_x_226642;
    struct memblock mem_226643 = {.desc ="mem_226643", .mem =
                                  futhark_mc_segmap_parloop_struct_236031->free_mem_226643,
                                  .size =0, .references =NULL};
    struct memblock mem_226644 = {.desc ="mem_226644", .mem =
                                  futhark_mc_segmap_parloop_struct_236031->free_mem_226644,
                                  .size =0, .references =NULL};
    size_t mem_227023_cached_sizze_236033 = 0;
    unsigned char *mem_227023 = NULL;
    size_t mem_227024_cached_sizze_236034 = 0;
    unsigned char *mem_227024 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227247 = start;
    
    if (mem_227023_cached_sizze_236033 < (size_t) bytes_218665) {
        mem_227023 = realloc(mem_227023, bytes_218665);
        mem_227023_cached_sizze_236033 = bytes_218665;
    }
    if (mem_227024_cached_sizze_236034 < (size_t) bytes_218665) {
        mem_227024 = realloc(mem_227024, bytes_218665);
        mem_227024_cached_sizze_236034 = bytes_218665;
    }
    for (; iter_227247 < end; iter_227247++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227309 = s_n_m_203726;
        int64_t gtid_227010 = iter_227247;
        int64_t remnant_227310 = iter_227247 - gtid_227010;
        int64_t x_227011;
        
        x_227011 = ((int64_t *) mem_217828.mem)[gtid_210629 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_226641 * s_n_m_203726 +
                                                gtid_227010];
        
        double x_227012;
        
        x_227012 = ((double *) mem_217833.mem)[gtid_210629 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_226641 * s_n_m_203726 +
                                               gtid_227010];
        
        bool cond_227013 = gtid_227010 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_227014;
        
        if (cond_227013) {
            defunc_0_m_fun_res_227014 = (int64_t) 0;
        } else {
            int64_t y_227248 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_227249 = gtid_227010 == y_227248;
            int64_t defunc_0_m_fun_res_f_res_227250;
            
            if (cond_227249) {
                int64_t defunc_0_m_fun_res_f_res_t_res_227251 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_227250 =
                    defunc_0_m_fun_res_f_res_t_res_227251;
            } else {
                int64_t x_227252 = sub64(gtid_227010, (int64_t) 1);
                int64_t x_227253 = mul64(jump_s_203581, x_227252);
                int64_t min_arg_227254 = add64((int64_t) 1, x_227253);
                int64_t min_res_227255 = smin64(defunc_0_f_res_203721,
                                                min_arg_227254);
                
                defunc_0_m_fun_res_f_res_227250 = min_res_227255;
            }
            defunc_0_m_fun_res_227014 = defunc_0_m_fun_res_f_res_227250;
        }
        
        double defunc_2_reduce_res_227025;
        double defunc_2_reduce_res_227026;
        double defunc_2_reduce_res_227027;
        int64_t flat_tid_227256 = (int64_t) 0;
        int32_t num_tasks_227311;
        
        defunc_2_reduce_res_227025 = 0.0;
        defunc_2_reduce_res_227026 = 0.0;
        defunc_2_reduce_res_227027 = 0.0;
        
        struct futhark_mc_task_236035 futhark_mc_task_236035;
        
        futhark_mc_task_236035.ctx = ctx;
        futhark_mc_task_236035.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236035.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236035.free_gtid_210629 = gtid_210629;
        futhark_mc_task_236035.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_236035.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_236035.free_gtid_226641 = gtid_226641;
        futhark_mc_task_236035.free_x_226642 = x_226642;
        futhark_mc_task_236035.free_x_227011 = x_227011;
        futhark_mc_task_236035.free_x_227012 = x_227012;
        futhark_mc_task_236035.free_defunc_0_m_fun_res_227014 =
            defunc_0_m_fun_res_227014;
        futhark_mc_task_236035.retval_defunc_2_reduce_res_227025 =
            &defunc_2_reduce_res_227025;
        futhark_mc_task_236035.retval_defunc_2_reduce_res_227026 =
            &defunc_2_reduce_res_227026;
        futhark_mc_task_236035.retval_defunc_2_reduce_res_227027 =
            &defunc_2_reduce_res_227027;
        futhark_mc_task_236035.retval_mem_227023 = mem_227023;
        futhark_mc_task_236035.retval_mem_227024 = mem_227024;
        
        struct scheduler_segop futhark_mc_task_236035_task;
        
        futhark_mc_task_236035_task.args = &futhark_mc_task_236035;
        futhark_mc_task_236035_task.top_level_fn =
            futhark_mc_segred_task_236036;
        futhark_mc_task_236035_task.name = "futhark_mc_segred_task_236036";
        futhark_mc_task_236035_task.iterations = q_s_203575;
        futhark_mc_task_236035_task.task_time =
            &ctx->futhark_mc_segred_task_236036_total_time;
        futhark_mc_task_236035_task.task_iter =
            &ctx->futhark_mc_segred_task_236036_total_iter;
        futhark_mc_task_236035_task.sched = STATIC;
        futhark_mc_task_236035_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236036_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236035_task);
        
        if (futhark_mc_segred_task_236036_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_227061 = defunc_2_reduce_res_227025 *
               defunc_2_reduce_res_227027;
        double y_227062 = defunc_2_reduce_res_227026 *
               defunc_2_reduce_res_227026;
        double y_227063 = x_227061 - y_227062;
        double det1_227064 = 1.0 / y_227063;
        double a11_227065 = defunc_2_reduce_res_227027 * det1_227064;
        double x_227066 = 0.0 - defunc_2_reduce_res_227026;
        double b11_227067 = det1_227064 * x_227066;
        double c11_227068 = defunc_2_reduce_res_227025 * det1_227064;
        double defunc_2_reduce_res_227069;
        double defunc_2_reduce_res_227070;
        int64_t flat_tid_227287 = (int64_t) 0;
        int32_t num_tasks_227332;
        
        defunc_2_reduce_res_227069 = 0.0;
        defunc_2_reduce_res_227070 = 0.0;
        
        struct futhark_mc_task_236042 futhark_mc_task_236042;
        
        futhark_mc_task_236042.ctx = ctx;
        futhark_mc_task_236042.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236042.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236042.free_gtid_210629 = gtid_210629;
        futhark_mc_task_236042.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_236042.free_gtid_226641 = gtid_226641;
        futhark_mc_task_236042.free_x_226642 = x_226642;
        futhark_mc_task_236042.free_x_227011 = x_227011;
        futhark_mc_task_236042.free_mem_227023 = mem_227023;
        futhark_mc_task_236042.free_mem_227024 = mem_227024;
        futhark_mc_task_236042.free_a11_227065 = a11_227065;
        futhark_mc_task_236042.free_b11_227067 = b11_227067;
        futhark_mc_task_236042.free_c11_227068 = c11_227068;
        futhark_mc_task_236042.retval_defunc_2_reduce_res_227069 =
            &defunc_2_reduce_res_227069;
        futhark_mc_task_236042.retval_defunc_2_reduce_res_227070 =
            &defunc_2_reduce_res_227070;
        
        struct scheduler_segop futhark_mc_task_236042_task;
        
        futhark_mc_task_236042_task.args = &futhark_mc_task_236042;
        futhark_mc_task_236042_task.top_level_fn =
            futhark_mc_segred_task_236043;
        futhark_mc_task_236042_task.name = "futhark_mc_segred_task_236043";
        futhark_mc_task_236042_task.iterations = q_s_203575;
        futhark_mc_task_236042_task.task_time =
            &ctx->futhark_mc_segred_task_236043_total_time;
        futhark_mc_task_236042_task.task_iter =
            &ctx->futhark_mc_segred_task_236043_total_iter;
        futhark_mc_task_236042_task.sched = STATIC;
        futhark_mc_task_236042_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236043_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236042_task);
        
        if (futhark_mc_segred_task_236043_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_226643.mem)[gtid_227010] = defunc_2_reduce_res_227069;
        ((double *) mem_226644.mem)[gtid_227010] = defunc_2_reduce_res_227070;
    }
    
  cleanup:
    { }
    free(mem_227023);
    free(mem_227024);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236032_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236032_end -
                 futhark_mc_segmap_parloop_236032_start;
        
        ctx->futhark_mc_segmap_parloop_236032_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236032_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236032_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236030(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227009 = tid;
    int num_tasks_227178 = info.nsubtasks;
    struct futhark_mc_task_236024 *futhark_mc_task_236024 =
                                  (struct futhark_mc_task_236024 *) args;
    struct futhark_context *ctx = futhark_mc_task_236024->ctx;
    uint64_t futhark_mc_segmap_nested_task_236030_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236030_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236024->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236024->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236024->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236024->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236024->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236024->free_s_n_m_203726;
    int64_t gtid_210629 = futhark_mc_task_236024->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236024->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236024->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236024->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236024->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236024->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 = futhark_mc_task_236024->free_bytes_218665;
    int64_t gtid_226641 = futhark_mc_task_236024->free_gtid_226641;
    int64_t x_226642 = futhark_mc_task_236024->free_x_226642;
    struct memblock mem_226643 = {.desc ="mem_226643", .mem =
                                  futhark_mc_task_236024->free_mem_226643,
                                  .size =0, .references =NULL};
    struct memblock mem_226644 = {.desc ="mem_226644", .mem =
                                  futhark_mc_task_236024->free_mem_226644,
                                  .size =0, .references =NULL};
    int64_t iter_227247;
    struct futhark_mc_segmap_parloop_struct_236031
    futhark_mc_segmap_parloop_struct_236031;
    
    futhark_mc_segmap_parloop_struct_236031.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236031.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236031.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236031.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236031.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236031.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236031.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236031.free_gtid_210629 = gtid_210629;
    futhark_mc_segmap_parloop_struct_236031.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236031.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236031.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236031.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236031.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236031.free_bytes_218665 = bytes_218665;
    futhark_mc_segmap_parloop_struct_236031.free_gtid_226641 = gtid_226641;
    futhark_mc_segmap_parloop_struct_236031.free_x_226642 = x_226642;
    futhark_mc_segmap_parloop_struct_236031.free_mem_226643 = mem_226643.mem;
    futhark_mc_segmap_parloop_struct_236031.free_mem_226644 = mem_226644.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236032_task;
    
    futhark_mc_segmap_parloop_236032_task.name =
        "futhark_mc_segmap_parloop_236032";
    futhark_mc_segmap_parloop_236032_task.fn = futhark_mc_segmap_parloop_236032;
    futhark_mc_segmap_parloop_236032_task.args =
        &futhark_mc_segmap_parloop_struct_236031;
    futhark_mc_segmap_parloop_236032_task.iterations = iterations;
    futhark_mc_segmap_parloop_236032_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236032_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236032_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236032_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236032_task);
    
    if (futhark_mc_segmap_parloop_236032_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236032_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236032_total_end -
                 futhark_mc_segmap_parloop_236032_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236032_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236032_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236032_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236030_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236030_end -
                 futhark_mc_segmap_nested_task_236030_start;
        
        ctx->futhark_mc_segmap_nested_task_236030_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236030_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236030_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236021(void *args, int64_t start,
                                            int64_t end, int flat_tid_226640,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236020
    *futhark_mc_segmap_parloop_struct_236020 =
    (struct futhark_mc_segmap_parloop_struct_236020 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236020->ctx;
    uint64_t futhark_mc_segmap_parloop_236021_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236021_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236020->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236020->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236020->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236020->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236020->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236020->free_s_n_m_203726;
    int64_t gtid_210629 =
            futhark_mc_segmap_parloop_struct_236020->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236020->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_236020->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_236020->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236020->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236020->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236020->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236020->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 =
            futhark_mc_segmap_parloop_struct_236020->free_bytes_218665;
    struct memblock mem_218769 = {.desc ="mem_218769", .mem =
                                  futhark_mc_segmap_parloop_struct_236020->free_mem_218769,
                                  .size =0, .references =NULL};
    struct memblock mem_218773 = {.desc ="mem_218773", .mem =
                                  futhark_mc_segmap_parloop_struct_236020->free_mem_218773,
                                  .size =0, .references =NULL};
    size_t mem_226643_cached_sizze_236022 = 0;
    unsigned char *mem_226643 = NULL;
    size_t mem_226644_cached_sizze_236023 = 0;
    unsigned char *mem_226644 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227008 = start;
    
    if (mem_226643_cached_sizze_236022 < (size_t) bytes_217663) {
        mem_226643 = realloc(mem_226643, bytes_217663);
        mem_226643_cached_sizze_236022 = bytes_217663;
    }
    if (mem_226644_cached_sizze_236023 < (size_t) bytes_217663) {
        mem_226644 = realloc(mem_226644, bytes_217663);
        mem_226644_cached_sizze_236023 = bytes_217663;
    }
    for (; iter_227008 < end; iter_227008++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227176 = n_p_203574;
        int64_t gtid_226641 = iter_227008;
        int64_t remnant_227177 = iter_227008 - gtid_226641;
        int64_t x_226642;
        
        x_226642 = ((int64_t *) mem_217658.mem)[gtid_210629 * n_p_203574 +
                                                gtid_226641];
        
        int64_t flat_tid_227093 = (int64_t) 0;
        int32_t num_tasks_227178;
        int64_t flat_tid_227009 = (int64_t) 0;
        struct futhark_mc_task_236024 futhark_mc_task_236024;
        
        futhark_mc_task_236024.ctx = ctx;
        futhark_mc_task_236024.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236024.free_q_s_203575 = q_s_203575;
        futhark_mc_task_236024.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_236024.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236024.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_236024.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_236024.free_gtid_210629 = gtid_210629;
        futhark_mc_task_236024.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_236024.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_236024.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_236024.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_236024.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_236024.free_bytes_218665 = bytes_218665;
        futhark_mc_task_236024.free_gtid_226641 = gtid_226641;
        futhark_mc_task_236024.free_x_226642 = x_226642;
        futhark_mc_task_236024.free_mem_226643 = mem_226643;
        futhark_mc_task_236024.free_mem_226644 = mem_226644;
        
        struct scheduler_segop futhark_mc_task_236024_task;
        
        futhark_mc_task_236024_task.args = &futhark_mc_task_236024;
        futhark_mc_task_236024_task.top_level_fn =
            futhark_mc_segmap_task_236025;
        futhark_mc_task_236024_task.name = "futhark_mc_segmap_task_236025";
        futhark_mc_task_236024_task.iterations = s_n_m_203726;
        futhark_mc_task_236024_task.task_time =
            &ctx->futhark_mc_segmap_task_236025_total_time;
        futhark_mc_task_236024_task.task_iter =
            &ctx->futhark_mc_segmap_task_236025_total_iter;
        futhark_mc_task_236024_task.sched = STATIC;
        futhark_mc_task_236024_task.nested_fn =
            futhark_mc_segmap_nested_task_236030;
        
        int futhark_mc_segmap_task_236025_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236024_task);
        
        if (futhark_mc_segmap_task_236025_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218769.mem + gtid_226641 * s_n_m_203726 * (int64_t) 8,
                    mem_226643 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218773.mem + gtid_226641 * s_n_m_203726 * (int64_t) 8,
                    mem_226644 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_226643);
    free(mem_226644);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236021_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236021_end -
                 futhark_mc_segmap_parloop_236021_start;
        
        ctx->futhark_mc_segmap_parloop_236021_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236021_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236021_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236019(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_226640 = tid;
    int num_tasks_226911 = info.nsubtasks;
    struct futhark_mc_task_236011 *futhark_mc_task_236011 =
                                  (struct futhark_mc_task_236011 *) args;
    struct futhark_context *ctx = futhark_mc_task_236011->ctx;
    uint64_t futhark_mc_segmap_nested_task_236019_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236019_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236011->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236011->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236011->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236011->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236011->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236011->free_s_n_m_203726;
    int64_t gtid_210629 = futhark_mc_task_236011->free_gtid_210629;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236011->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_236011->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_236011->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236011->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236011->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236011->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236011->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 = futhark_mc_task_236011->free_bytes_218665;
    struct memblock mem_218769 = {.desc ="mem_218769", .mem =
                                  futhark_mc_task_236011->free_mem_218769,
                                  .size =0, .references =NULL};
    struct memblock mem_218773 = {.desc ="mem_218773", .mem =
                                  futhark_mc_task_236011->free_mem_218773,
                                  .size =0, .references =NULL};
    int64_t iter_227008;
    struct futhark_mc_segmap_parloop_struct_236020
    futhark_mc_segmap_parloop_struct_236020;
    
    futhark_mc_segmap_parloop_struct_236020.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236020.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236020.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236020.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236020.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236020.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236020.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236020.free_gtid_210629 = gtid_210629;
    futhark_mc_segmap_parloop_struct_236020.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236020.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_236020.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_236020.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236020.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236020.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236020.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236020.free_bytes_218665 = bytes_218665;
    futhark_mc_segmap_parloop_struct_236020.free_mem_218769 = mem_218769.mem;
    futhark_mc_segmap_parloop_struct_236020.free_mem_218773 = mem_218773.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236021_task;
    
    futhark_mc_segmap_parloop_236021_task.name =
        "futhark_mc_segmap_parloop_236021";
    futhark_mc_segmap_parloop_236021_task.fn = futhark_mc_segmap_parloop_236021;
    futhark_mc_segmap_parloop_236021_task.args =
        &futhark_mc_segmap_parloop_struct_236020;
    futhark_mc_segmap_parloop_236021_task.iterations = iterations;
    futhark_mc_segmap_parloop_236021_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236021_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236021_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236021_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236021_task);
    
    if (futhark_mc_segmap_parloop_236021_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236021_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236021_total_end -
                 futhark_mc_segmap_parloop_236021_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236021_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236021_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236021_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236019_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236019_end -
                 futhark_mc_segmap_nested_task_236019_start;
        
        ctx->futhark_mc_segmap_nested_task_236019_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236019_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236019_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236008(void *args, int64_t start,
                                            int64_t end, int flat_tid_210628,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236007
    *futhark_mc_segmap_parloop_struct_236007 =
    (struct futhark_mc_segmap_parloop_struct_236007 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236007->ctx;
    uint64_t futhark_mc_segmap_parloop_236008_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236008_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236007->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236007->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236007->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236007->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236007->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236007->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236007->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236007->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_236007->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_236007->free_bytes_217663;
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_236007->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236007->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236007->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236007->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236007->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 =
            futhark_mc_segmap_parloop_struct_236007->free_bytes_218665;
    struct memblock mem_218896 = {.desc ="mem_218896", .mem =
                                  futhark_mc_segmap_parloop_struct_236007->free_mem_218896,
                                  .size =0, .references =NULL};
    struct memblock mem_218901 = {.desc ="mem_218901", .mem =
                                  futhark_mc_segmap_parloop_struct_236007->free_mem_218901,
                                  .size =0, .references =NULL};
    size_t mem_218769_cached_sizze_236009 = 0;
    unsigned char *mem_218769 = NULL;
    size_t mem_218773_cached_sizze_236010 = 0;
    unsigned char *mem_218773 = NULL;
    int64_t iterations = end - start;
    int64_t iter_226639 = start;
    
    if (mem_218769_cached_sizze_236009 < (size_t) bytes_217715) {
        mem_218769 = realloc(mem_218769, bytes_217715);
        mem_218769_cached_sizze_236009 = bytes_217715;
    }
    if (mem_218773_cached_sizze_236010 < (size_t) bytes_217715) {
        mem_218773 = realloc(mem_218773, bytes_217715);
        mem_218773_cached_sizze_236010 = bytes_217715;
    }
    for (; iter_226639 < end; iter_226639++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_226909 = partition_sizze_203667;
        int64_t gtid_210629 = iter_226639;
        int64_t remnant_226910 = iter_226639 - gtid_210629;
        int64_t flat_tid_226814 = (int64_t) 0;
        int32_t num_tasks_226911;
        int64_t flat_tid_226640 = (int64_t) 0;
        struct futhark_mc_task_236011 futhark_mc_task_236011;
        
        futhark_mc_task_236011.ctx = ctx;
        futhark_mc_task_236011.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236011.free_q_s_203575 = q_s_203575;
        futhark_mc_task_236011.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_236011.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236011.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_236011.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_236011.free_gtid_210629 = gtid_210629;
        futhark_mc_task_236011.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_236011.free_mem_217658 = mem_217658.mem;
        futhark_mc_task_236011.free_bytes_217663 = bytes_217663;
        futhark_mc_task_236011.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_236011.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_236011.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_236011.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_236011.free_bytes_218665 = bytes_218665;
        futhark_mc_task_236011.free_mem_218769 = mem_218769;
        futhark_mc_task_236011.free_mem_218773 = mem_218773;
        
        struct scheduler_segop futhark_mc_task_236011_task;
        
        futhark_mc_task_236011_task.args = &futhark_mc_task_236011;
        futhark_mc_task_236011_task.top_level_fn =
            futhark_mc_segmap_task_236012;
        futhark_mc_task_236011_task.name = "futhark_mc_segmap_task_236012";
        futhark_mc_task_236011_task.iterations = n_p_203574;
        futhark_mc_task_236011_task.task_time =
            &ctx->futhark_mc_segmap_task_236012_total_time;
        futhark_mc_task_236011_task.task_iter =
            &ctx->futhark_mc_segmap_task_236012_total_iter;
        futhark_mc_task_236011_task.sched = STATIC;
        futhark_mc_task_236011_task.nested_fn =
            futhark_mc_segmap_nested_task_236019;
        
        int futhark_mc_segmap_task_236012_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236011_task);
        
        if (futhark_mc_segmap_task_236012_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218896.mem + gtid_210629 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218769 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_218901.mem + gtid_210629 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_218773 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_218769);
    free(mem_218773);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236008_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236008_end -
                 futhark_mc_segmap_parloop_236008_start;
        
        ctx->futhark_mc_segmap_parloop_236008_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236008_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236008_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236006(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_210628 = tid;
    int num_tasks_226534 = info.nsubtasks;
    struct futhark_mc_task_235998 *futhark_mc_task_235998 =
                                  (struct futhark_mc_task_235998 *) args;
    struct futhark_context *ctx = futhark_mc_task_235998->ctx;
    uint64_t futhark_mc_segmap_nested_task_236006_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236006_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_235998->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_235998->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_235998->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_235998->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_235998->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_235998->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_235998->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_235998->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_235998->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_235998->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_235998->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_235998->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_235998->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_235998->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_235998->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218665 = futhark_mc_task_235998->free_bytes_218665;
    struct memblock mem_218896 = {.desc ="mem_218896", .mem =
                                  futhark_mc_task_235998->free_mem_218896,
                                  .size =0, .references =NULL};
    struct memblock mem_218901 = {.desc ="mem_218901", .mem =
                                  futhark_mc_task_235998->free_mem_218901,
                                  .size =0, .references =NULL};
    int64_t iter_226639;
    struct futhark_mc_segmap_parloop_struct_236007
    futhark_mc_segmap_parloop_struct_236007;
    
    futhark_mc_segmap_parloop_struct_236007.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236007.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236007.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236007.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236007.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236007.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236007.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236007.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236007.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236007.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_236007.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_236007.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_236007.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236007.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236007.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236007.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236007.free_bytes_218665 = bytes_218665;
    futhark_mc_segmap_parloop_struct_236007.free_mem_218896 = mem_218896.mem;
    futhark_mc_segmap_parloop_struct_236007.free_mem_218901 = mem_218901.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236008_task;
    
    futhark_mc_segmap_parloop_236008_task.name =
        "futhark_mc_segmap_parloop_236008";
    futhark_mc_segmap_parloop_236008_task.fn = futhark_mc_segmap_parloop_236008;
    futhark_mc_segmap_parloop_236008_task.args =
        &futhark_mc_segmap_parloop_struct_236007;
    futhark_mc_segmap_parloop_236008_task.iterations = iterations;
    futhark_mc_segmap_parloop_236008_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236008_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236008_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236008_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236008_task);
    
    if (futhark_mc_segmap_parloop_236008_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236008_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236008_total_end -
                 futhark_mc_segmap_parloop_236008_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236008_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236008_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236008_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236006_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236006_end -
                 futhark_mc_segmap_nested_task_236006_start;
        
        ctx->futhark_mc_segmap_nested_task_236006_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236006_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236006_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236048 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218903;
    unsigned char *free_mem_219230;
    unsigned char *free_mem_219235;
};
struct futhark_mc_segmap_parloop_struct_236050 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218903;
    unsigned char *free_mem_219230;
    unsigned char *free_mem_219235;
};
static int futhark_mc_segmap_parloop_236051(void *args, int64_t start,
                                            int64_t end, int flat_tid_210903,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236050
    *futhark_mc_segmap_parloop_struct_236050 =
    (struct futhark_mc_segmap_parloop_struct_236050 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236050->ctx;
    uint64_t futhark_mc_segmap_parloop_236051_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236051_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236050->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236050->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236050->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236050->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236050->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236050->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236050->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236050->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_236050->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_236050->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236050->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236050->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236050->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236050->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 =
            futhark_mc_segmap_parloop_struct_236050->free_bytes_218903;
    struct memblock mem_219230 = {.desc ="mem_219230", .mem =
                                  futhark_mc_segmap_parloop_struct_236050->free_mem_219230,
                                  .size =0, .references =NULL};
    struct memblock mem_219235 = {.desc ="mem_219235", .mem =
                                  futhark_mc_segmap_parloop_struct_236050->free_mem_219235,
                                  .size =0, .references =NULL};
    size_t mem_219081_cached_sizze_236052 = 0;
    unsigned char *mem_219081 = NULL;
    size_t mem_219085_cached_sizze_236053 = 0;
    unsigned char *mem_219085 = NULL;
    size_t mem_219130_cached_sizze_236054 = 0;
    unsigned char *mem_219130 = NULL;
    size_t mem_219133_cached_sizze_236055 = 0;
    unsigned char *mem_219133 = NULL;
    size_t mem_219160_cached_sizze_236056 = 0;
    unsigned char *mem_219160 = NULL;
    size_t mem_219163_cached_sizze_236057 = 0;
    unsigned char *mem_219163 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227348 = start;
    
    if (mem_219081_cached_sizze_236052 < (size_t) bytes_217715) {
        mem_219081 = realloc(mem_219081, bytes_217715);
        mem_219081_cached_sizze_236052 = bytes_217715;
    }
    if (mem_219085_cached_sizze_236053 < (size_t) bytes_217715) {
        mem_219085 = realloc(mem_219085, bytes_217715);
        mem_219085_cached_sizze_236053 = bytes_217715;
    }
    if (mem_219130_cached_sizze_236054 < (size_t) bytes_218903) {
        mem_219130 = realloc(mem_219130, bytes_218903);
        mem_219130_cached_sizze_236054 = bytes_218903;
    }
    if (mem_219133_cached_sizze_236055 < (size_t) bytes_218903) {
        mem_219133 = realloc(mem_219133, bytes_218903);
        mem_219133_cached_sizze_236055 = bytes_218903;
    }
    if (mem_219160_cached_sizze_236056 < (size_t) bytes_218903) {
        mem_219160 = realloc(mem_219160, bytes_218903);
        mem_219160_cached_sizze_236056 = bytes_218903;
    }
    if (mem_219163_cached_sizze_236057 < (size_t) bytes_218903) {
        mem_219163 = realloc(mem_219163, bytes_218903);
        mem_219163_cached_sizze_236057 = bytes_218903;
    }
    for (; iter_227348 < end; iter_227348++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227480 = partition_sizze_203667;
        int64_t gtid_210904 = iter_227348;
        int64_t remnant_227481 = iter_227348 - gtid_210904;
        
        for (int64_t i_227349 = 0; i_227349 < n_p_203574; i_227349++) {
            int64_t x_227352;
            
            x_227352 = ((int64_t *) mem_217658.mem)[gtid_210904 * n_p_203574 +
                                                    i_227349];
            for (int64_t i_227355 = 0; i_227355 < s_n_m_203726; i_227355++) {
                int64_t x_227358;
                
                x_227358 = ((int64_t *) mem_217828.mem)[gtid_210904 *
                                                        (s_n_m_203726 *
                                                         n_p_203574) +
                                                        i_227349 *
                                                        s_n_m_203726 +
                                                        i_227355];
                
                double x_227359;
                
                x_227359 = ((double *) mem_217833.mem)[gtid_210904 *
                                                       (s_n_m_203726 *
                                                        n_p_203574) + i_227349 *
                                                       s_n_m_203726 + i_227355];
                
                bool cond_227360 = i_227355 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_227361;
                
                if (cond_227360) {
                    defunc_0_m_fun_res_227361 = (int64_t) 0;
                } else {
                    int64_t y_227362 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_227363 = i_227355 == y_227362;
                    int64_t defunc_0_m_fun_res_f_res_227364;
                    
                    if (cond_227363) {
                        int64_t defunc_0_m_fun_res_f_res_t_res_227365 =
                                sub64(pad_css_len_203722, (int64_t) 1);
                        
                        defunc_0_m_fun_res_f_res_227364 =
                            defunc_0_m_fun_res_f_res_t_res_227365;
                    } else {
                        int64_t x_227366 = sub64(i_227355, (int64_t) 1);
                        int64_t x_227367 = mul64(jump_s_203581, x_227366);
                        int64_t min_arg_227368 = add64((int64_t) 1, x_227367);
                        int64_t min_res_227369 = smin64(defunc_0_f_res_203721,
                                                        min_arg_227368);
                        
                        defunc_0_m_fun_res_f_res_227364 = min_res_227369;
                    }
                    defunc_0_m_fun_res_227361 = defunc_0_m_fun_res_f_res_227364;
                }
                for (int64_t i_227374 = 0; i_227374 < q_s_203575; i_227374++) {
                    bool cond_227377 = sle64(x_227352, i_227374);
                    int64_t defunc_0_f_res_227378;
                    
                    if (cond_227377) {
                        defunc_0_f_res_227378 = (int64_t) 0;
                    } else {
                        int64_t i_227379 = add64(x_227358, i_227374);
                        int64_t defunc_0_add_arg_227380;
                        
                        defunc_0_add_arg_227380 =
                            ((int64_t *) mem_217654.mem)[gtid_210904 *
                                                         (defunc_0_f_res_203721 *
                                                          n_p_203574) +
                                                         i_227349 *
                                                         defunc_0_f_res_203721 +
                                                         i_227379];
                        
                        int64_t defunc_1_add_res_227381 = add64((int64_t) 1,
                                                                defunc_0_add_arg_227380);
                        
                        defunc_0_f_res_227378 = defunc_1_add_res_227381;
                    }
                    
                    double defunc_0_f_res_227382;
                    
                    if (cond_227377) {
                        defunc_0_f_res_227382 = 0.0;
                    } else {
                        int64_t i_227383 = add64(x_227358, i_227374);
                        double defunc_0_add_arg_227384;
                        
                        defunc_0_add_arg_227384 =
                            ((double *) mem_218175.mem)[gtid_210904 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_227349 *
                                                        defunc_0_f_res_203721 +
                                                        i_227383];
                        defunc_0_f_res_227382 = defunc_0_add_arg_227384;
                    }
                    
                    int64_t binop_p_227385 = sub64(defunc_0_f_res_227378,
                                                   defunc_0_m_fun_res_227361);
                    double defunc_0_f_res_227386 =
                           sitofp_i64_f64(binop_p_227385);
                    double abs_res_227387 = fabs(defunc_0_f_res_227386);
                    double tmp1_227388 = abs_res_227387 / x_227359;
                    double x_227389 = tmp1_227388 * tmp1_227388;
                    double y_227390 = tmp1_227388 * x_227389;
                    double tmp2_227391 = 1.0 - y_227390;
                    double x_227392 = tmp2_227391 * tmp2_227391;
                    double tmp3_227393 = tmp2_227391 * x_227392;
                    double tmp4_227394 = defunc_0_f_res_227382 * tmp3_227393;
                    
                    ((double *) mem_219130)[i_227374] = defunc_0_f_res_227386;
                    ((double *) mem_219133)[i_227374] = tmp4_227394;
                }
                
                double defunc_2_reduce_res_227399;
                double defunc_2_reduce_res_227400;
                double defunc_2_reduce_res_227401;
                double defunc_2_reduce_res_227402;
                double defunc_2_reduce_res_227403;
                double redout_227407;
                double redout_227408;
                double redout_227409;
                double redout_227410;
                double redout_227411;
                
                redout_227407 = 0.0;
                redout_227408 = 0.0;
                redout_227409 = 0.0;
                redout_227410 = 0.0;
                redout_227411 = 0.0;
                for (int64_t i_227406 = 0; i_227406 < q_s_203575; i_227406++) {
                    double x_227414;
                    
                    x_227414 = ((double *) mem_219130)[i_227406];
                    
                    double x_227415;
                    
                    x_227415 = ((double *) mem_219133)[i_227406];
                    
                    double defunc_1_f_res_227416 = x_227414 * x_227415;
                    double defunc_1_f_res_227417 = x_227414 *
                           defunc_1_f_res_227416;
                    double defunc_1_f_res_227418 = x_227414 *
                           defunc_1_f_res_227417;
                    double defunc_1_f_res_227419 = x_227414 *
                           defunc_1_f_res_227418;
                    double defunc_1_op_res_227420 = x_227415 + redout_227407;
                    double defunc_1_op_res_227421 = defunc_1_f_res_227416 +
                           redout_227408;
                    double defunc_1_op_res_227422 = defunc_1_f_res_227417 +
                           redout_227409;
                    double defunc_1_op_res_227423 = defunc_1_f_res_227418 +
                           redout_227410;
                    double defunc_1_op_res_227424 = defunc_1_f_res_227419 +
                           redout_227411;
                    
                    ((double *) mem_219160)[i_227406] = defunc_1_f_res_227417;
                    ((double *) mem_219163)[i_227406] = defunc_1_f_res_227416;
                    
                    double redout_tmp_227488 = defunc_1_op_res_227420;
                    double redout_tmp_227489 = defunc_1_op_res_227421;
                    double redout_tmp_227490 = defunc_1_op_res_227422;
                    double redout_tmp_227491 = defunc_1_op_res_227423;
                    double redout_tmp_227492 = defunc_1_op_res_227424;
                    
                    redout_227407 = redout_tmp_227488;
                    redout_227408 = redout_tmp_227489;
                    redout_227409 = redout_tmp_227490;
                    redout_227410 = redout_tmp_227491;
                    redout_227411 = redout_tmp_227492;
                }
                defunc_2_reduce_res_227399 = redout_227407;
                defunc_2_reduce_res_227400 = redout_227408;
                defunc_2_reduce_res_227401 = redout_227409;
                defunc_2_reduce_res_227402 = redout_227410;
                defunc_2_reduce_res_227403 = redout_227411;
                
                double x_227427 = defunc_2_reduce_res_227401 *
                       defunc_2_reduce_res_227403;
                double y_227428 = defunc_2_reduce_res_227402 *
                       defunc_2_reduce_res_227402;
                double a12_227429 = x_227427 - y_227428;
                double x_227430 = defunc_2_reduce_res_227401 *
                       defunc_2_reduce_res_227402;
                double y_227431 = defunc_2_reduce_res_227400 *
                       defunc_2_reduce_res_227403;
                double b12_227432 = x_227430 - y_227431;
                double x_227433 = defunc_2_reduce_res_227400 *
                       defunc_2_reduce_res_227402;
                double y_227434 = defunc_2_reduce_res_227401 *
                       defunc_2_reduce_res_227401;
                double c12_227435 = x_227433 - y_227434;
                double x_227436 = defunc_2_reduce_res_227399 *
                       defunc_2_reduce_res_227403;
                double b2_227437 = x_227436 - y_227434;
                double x_227438 = defunc_2_reduce_res_227400 *
                       defunc_2_reduce_res_227401;
                double y_227439 = defunc_2_reduce_res_227399 *
                       defunc_2_reduce_res_227402;
                double c2_227440 = x_227438 - y_227439;
                double x_227441 = defunc_2_reduce_res_227399 * a12_227429;
                double y_227442 = defunc_2_reduce_res_227400 * b12_227432;
                double x_227443 = x_227441 + y_227442;
                double y_227444 = defunc_2_reduce_res_227401 * c12_227435;
                double y_227445 = x_227443 + y_227444;
                double det_227446 = 1.0 / y_227445;
                double a12_227447 = a12_227429 * det_227446;
                double b12_227448 = b12_227432 * det_227446;
                double c12_227449 = c12_227435 * det_227446;
                double b2_227450 = b2_227437 * det_227446;
                double c2_227451 = c2_227440 * det_227446;
                double defunc_2_reduce_res_227452;
                double defunc_2_reduce_res_227453;
                double redout_227455;
                double redout_227456;
                
                redout_227455 = 0.0;
                redout_227456 = 0.0;
                for (int64_t i_227454 = 0; i_227454 < q_s_203575; i_227454++) {
                    double x_227457;
                    
                    x_227457 = ((double *) mem_219133)[i_227454];
                    
                    double x_227458;
                    
                    x_227458 = ((double *) mem_219163)[i_227454];
                    
                    double x_227459;
                    
                    x_227459 = ((double *) mem_219160)[i_227454];
                    
                    bool cond_227460 = sle64(x_227352, i_227454);
                    double defunc_0_f_res_227461;
                    
                    if (cond_227460) {
                        defunc_0_f_res_227461 = 0.0;
                    } else {
                        int64_t i_227462 = add64(x_227358, i_227454);
                        double defunc_0_add_arg_227463;
                        
                        defunc_0_add_arg_227463 =
                            ((double *) mem_218170.mem)[gtid_210904 *
                                                        (defunc_0_f_res_203721 *
                                                         n_p_203574) +
                                                        i_227349 *
                                                        defunc_0_f_res_203721 +
                                                        i_227462];
                        defunc_0_f_res_227461 = defunc_0_add_arg_227463;
                    }
                    
                    double x_227464 = a12_227447 * x_227457;
                    double y_227465 = b12_227448 * x_227458;
                    double x_227466 = x_227464 + y_227465;
                    double y_227467 = c12_227449 * x_227459;
                    double x_227468 = x_227466 + y_227467;
                    double defunc_9_fit_fun_res_227469 = defunc_0_f_res_227461 *
                           x_227468;
                    double x_227470 = b12_227448 * x_227457;
                    double y_227471 = b2_227450 * x_227458;
                    double x_227472 = x_227470 + y_227471;
                    double y_227473 = c2_227451 * x_227459;
                    double x_227474 = x_227472 + y_227473;
                    double defunc_9_slope_fun_res_227475 =
                           defunc_0_f_res_227461 * x_227474;
                    double defunc_1_op_res_227476 =
                           defunc_9_fit_fun_res_227469 + redout_227455;
                    double defunc_1_op_res_227477 =
                           defunc_9_slope_fun_res_227475 + redout_227456;
                    double redout_tmp_227495 = defunc_1_op_res_227476;
                    double redout_tmp_227496 = defunc_1_op_res_227477;
                    
                    redout_227455 = redout_tmp_227495;
                    redout_227456 = redout_tmp_227496;
                }
                defunc_2_reduce_res_227452 = redout_227455;
                defunc_2_reduce_res_227453 = redout_227456;
                ((double *) mem_219081)[i_227349 * s_n_m_203726 + i_227355] =
                    defunc_2_reduce_res_227452;
                ((double *) mem_219085)[i_227349 * s_n_m_203726 + i_227355] =
                    defunc_2_reduce_res_227453;
            }
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_219230.mem + gtid_210904 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_219081 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_219235.mem + gtid_210904 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_219085 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219081);
    free(mem_219085);
    free(mem_219130);
    free(mem_219133);
    free(mem_219160);
    free(mem_219163);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236051_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236051_end -
                 futhark_mc_segmap_parloop_236051_start;
        
        ctx->futhark_mc_segmap_parloop_236051_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236051_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236051_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236049(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_210903 = tid;
    int num_tasks_227347 = info.nsubtasks;
    struct futhark_mc_task_236048 *futhark_mc_task_236048 =
                                  (struct futhark_mc_task_236048 *) args;
    struct futhark_context *ctx = futhark_mc_task_236048->ctx;
    uint64_t futhark_mc_segmap_task_236049_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236049_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236048->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236048->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236048->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236048->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236048->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236048->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236048->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236048->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_236048->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_236048->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_236048->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236048->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236048->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236048->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236048->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 = futhark_mc_task_236048->free_bytes_218903;
    struct memblock mem_219230 = {.desc ="mem_219230", .mem =
                                  futhark_mc_task_236048->free_mem_219230,
                                  .size =0, .references =NULL};
    struct memblock mem_219235 = {.desc ="mem_219235", .mem =
                                  futhark_mc_task_236048->free_mem_219235,
                                  .size =0, .references =NULL};
    int64_t iter_227348;
    struct futhark_mc_segmap_parloop_struct_236050
    futhark_mc_segmap_parloop_struct_236050;
    
    futhark_mc_segmap_parloop_struct_236050.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236050.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236050.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236050.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236050.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236050.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236050.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236050.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236050.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236050.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_236050.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_236050.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236050.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236050.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236050.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236050.free_bytes_218903 = bytes_218903;
    futhark_mc_segmap_parloop_struct_236050.free_mem_219230 = mem_219230.mem;
    futhark_mc_segmap_parloop_struct_236050.free_mem_219235 = mem_219235.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236051_task;
    
    futhark_mc_segmap_parloop_236051_task.name =
        "futhark_mc_segmap_parloop_236051";
    futhark_mc_segmap_parloop_236051_task.fn = futhark_mc_segmap_parloop_236051;
    futhark_mc_segmap_parloop_236051_task.args =
        &futhark_mc_segmap_parloop_struct_236050;
    futhark_mc_segmap_parloop_236051_task.iterations = iterations;
    futhark_mc_segmap_parloop_236051_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236051_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236051_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236051_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236051_task);
    
    if (futhark_mc_segmap_parloop_236051_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236051_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236051_total_end -
                 futhark_mc_segmap_parloop_236051_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236051_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236051_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236051_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236049_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236049_end -
                 futhark_mc_segmap_task_236049_start;
        
        ctx->futhark_mc_segmap_task_236049_runs[tid]++;
        ctx->futhark_mc_segmap_task_236049_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236049_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236059 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    int64_t free_bytes_217715;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218903;
    unsigned char *free_mem_219230;
    unsigned char *free_mem_219235;
};
struct futhark_mc_task_236063 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211295;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218903;
    unsigned char *free_mem_219073;
    unsigned char *free_mem_219077;
};
struct futhark_mc_segmap_parloop_struct_236065 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211295;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218903;
    unsigned char *free_mem_219073;
    unsigned char *free_mem_219077;
};
static int futhark_mc_segmap_parloop_236066(void *args, int64_t start,
                                            int64_t end, int flat_tid_227755,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236065
    *futhark_mc_segmap_parloop_struct_236065 =
    (struct futhark_mc_segmap_parloop_struct_236065 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236065->ctx;
    uint64_t futhark_mc_segmap_parloop_236066_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236066_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236065->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236065->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236065->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236065->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236065->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236065->free_s_n_m_203726;
    int64_t gtid_211295 =
            futhark_mc_segmap_parloop_struct_236065->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236065->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_236065->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_236065->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236065->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236065->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236065->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236065->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 =
            futhark_mc_segmap_parloop_struct_236065->free_bytes_218903;
    struct memblock mem_219073 = {.desc ="mem_219073", .mem =
                                  futhark_mc_segmap_parloop_struct_236065->free_mem_219073,
                                  .size =0, .references =NULL};
    struct memblock mem_219077 = {.desc ="mem_219077", .mem =
                                  futhark_mc_segmap_parloop_struct_236065->free_mem_219077,
                                  .size =0, .references =NULL};
    size_t mem_227758_cached_sizze_236067 = 0;
    unsigned char *mem_227758 = NULL;
    size_t mem_227760_cached_sizze_236068 = 0;
    unsigned char *mem_227760 = NULL;
    size_t mem_227762_cached_sizze_236069 = 0;
    unsigned char *mem_227762 = NULL;
    size_t mem_227763_cached_sizze_236070 = 0;
    unsigned char *mem_227763 = NULL;
    size_t mem_227764_cached_sizze_236071 = 0;
    unsigned char *mem_227764 = NULL;
    size_t mem_227765_cached_sizze_236072 = 0;
    unsigned char *mem_227765 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227896 = start;
    
    if (mem_227758_cached_sizze_236067 < (size_t) bytes_217663) {
        mem_227758 = realloc(mem_227758, bytes_217663);
        mem_227758_cached_sizze_236067 = bytes_217663;
    }
    if (mem_227760_cached_sizze_236068 < (size_t) bytes_217663) {
        mem_227760 = realloc(mem_227760, bytes_217663);
        mem_227760_cached_sizze_236068 = bytes_217663;
    }
    if (mem_227762_cached_sizze_236069 < (size_t) bytes_218903) {
        mem_227762 = realloc(mem_227762, bytes_218903);
        mem_227762_cached_sizze_236069 = bytes_218903;
    }
    if (mem_227763_cached_sizze_236070 < (size_t) bytes_218903) {
        mem_227763 = realloc(mem_227763, bytes_218903);
        mem_227763_cached_sizze_236070 = bytes_218903;
    }
    if (mem_227764_cached_sizze_236071 < (size_t) bytes_218903) {
        mem_227764 = realloc(mem_227764, bytes_218903);
        mem_227764_cached_sizze_236071 = bytes_218903;
    }
    if (mem_227765_cached_sizze_236072 < (size_t) bytes_218903) {
        mem_227765 = realloc(mem_227765, bytes_218903);
        mem_227765_cached_sizze_236072 = bytes_218903;
    }
    for (; iter_227896 < end; iter_227896++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228022 = n_p_203574;
        int64_t gtid_227756 = iter_227896;
        int64_t remnant_228023 = iter_227896 - gtid_227756;
        int64_t x_227757;
        
        x_227757 = ((int64_t *) mem_217658.mem)[gtid_211295 * n_p_203574 +
                                                gtid_227756];
        for (int64_t i_227897 = 0; i_227897 < s_n_m_203726; i_227897++) {
            int64_t x_227900;
            
            x_227900 = ((int64_t *) mem_217828.mem)[gtid_211295 *
                                                    (s_n_m_203726 *
                                                     n_p_203574) + gtid_227756 *
                                                    s_n_m_203726 + i_227897];
            
            double x_227901;
            
            x_227901 = ((double *) mem_217833.mem)[gtid_211295 * (s_n_m_203726 *
                                                                  n_p_203574) +
                                                   gtid_227756 * s_n_m_203726 +
                                                   i_227897];
            
            bool cond_227902 = i_227897 == (int64_t) 0;
            int64_t defunc_0_m_fun_res_227903;
            
            if (cond_227902) {
                defunc_0_m_fun_res_227903 = (int64_t) 0;
            } else {
                int64_t y_227904 = sub64(s_n_m_203726, (int64_t) 1);
                bool cond_227905 = i_227897 == y_227904;
                int64_t defunc_0_m_fun_res_f_res_227906;
                
                if (cond_227905) {
                    int64_t defunc_0_m_fun_res_f_res_t_res_227907 =
                            sub64(pad_css_len_203722, (int64_t) 1);
                    
                    defunc_0_m_fun_res_f_res_227906 =
                        defunc_0_m_fun_res_f_res_t_res_227907;
                } else {
                    int64_t x_227908 = sub64(i_227897, (int64_t) 1);
                    int64_t x_227909 = mul64(jump_s_203581, x_227908);
                    int64_t min_arg_227910 = add64((int64_t) 1, x_227909);
                    int64_t min_res_227911 = smin64(defunc_0_f_res_203721,
                                                    min_arg_227910);
                    
                    defunc_0_m_fun_res_f_res_227906 = min_res_227911;
                }
                defunc_0_m_fun_res_227903 = defunc_0_m_fun_res_f_res_227906;
            }
            for (int64_t i_227916 = 0; i_227916 < q_s_203575; i_227916++) {
                bool cond_227919 = sle64(x_227757, i_227916);
                int64_t defunc_0_f_res_227920;
                
                if (cond_227919) {
                    defunc_0_f_res_227920 = (int64_t) 0;
                } else {
                    int64_t i_227921 = add64(x_227900, i_227916);
                    int64_t defunc_0_add_arg_227922;
                    
                    defunc_0_add_arg_227922 =
                        ((int64_t *) mem_217654.mem)[gtid_211295 *
                                                     (defunc_0_f_res_203721 *
                                                      n_p_203574) +
                                                     gtid_227756 *
                                                     defunc_0_f_res_203721 +
                                                     i_227921];
                    
                    int64_t defunc_1_add_res_227923 = add64((int64_t) 1,
                                                            defunc_0_add_arg_227922);
                    
                    defunc_0_f_res_227920 = defunc_1_add_res_227923;
                }
                
                double defunc_0_f_res_227924;
                
                if (cond_227919) {
                    defunc_0_f_res_227924 = 0.0;
                } else {
                    int64_t i_227925 = add64(x_227900, i_227916);
                    double defunc_0_add_arg_227926;
                    
                    defunc_0_add_arg_227926 =
                        ((double *) mem_218175.mem)[gtid_211295 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_227756 *
                                                    defunc_0_f_res_203721 +
                                                    i_227925];
                    defunc_0_f_res_227924 = defunc_0_add_arg_227926;
                }
                
                int64_t binop_p_227927 = sub64(defunc_0_f_res_227920,
                                               defunc_0_m_fun_res_227903);
                double defunc_0_f_res_227928 = sitofp_i64_f64(binop_p_227927);
                double abs_res_227929 = fabs(defunc_0_f_res_227928);
                double tmp1_227930 = abs_res_227929 / x_227901;
                double x_227931 = tmp1_227930 * tmp1_227930;
                double y_227932 = tmp1_227930 * x_227931;
                double tmp2_227933 = 1.0 - y_227932;
                double x_227934 = tmp2_227933 * tmp2_227933;
                double tmp3_227935 = tmp2_227933 * x_227934;
                double tmp4_227936 = defunc_0_f_res_227924 * tmp3_227935;
                
                ((double *) mem_227762)[i_227916] = defunc_0_f_res_227928;
                ((double *) mem_227763)[i_227916] = tmp4_227936;
            }
            
            double defunc_2_reduce_res_227941;
            double defunc_2_reduce_res_227942;
            double defunc_2_reduce_res_227943;
            double defunc_2_reduce_res_227944;
            double defunc_2_reduce_res_227945;
            double redout_227949;
            double redout_227950;
            double redout_227951;
            double redout_227952;
            double redout_227953;
            
            redout_227949 = 0.0;
            redout_227950 = 0.0;
            redout_227951 = 0.0;
            redout_227952 = 0.0;
            redout_227953 = 0.0;
            for (int64_t i_227948 = 0; i_227948 < q_s_203575; i_227948++) {
                double x_227956;
                
                x_227956 = ((double *) mem_227762)[i_227948];
                
                double x_227957;
                
                x_227957 = ((double *) mem_227763)[i_227948];
                
                double defunc_1_f_res_227958 = x_227956 * x_227957;
                double defunc_1_f_res_227959 = x_227956 * defunc_1_f_res_227958;
                double defunc_1_f_res_227960 = x_227956 * defunc_1_f_res_227959;
                double defunc_1_f_res_227961 = x_227956 * defunc_1_f_res_227960;
                double defunc_1_op_res_227962 = x_227957 + redout_227949;
                double defunc_1_op_res_227963 = defunc_1_f_res_227958 +
                       redout_227950;
                double defunc_1_op_res_227964 = defunc_1_f_res_227959 +
                       redout_227951;
                double defunc_1_op_res_227965 = defunc_1_f_res_227960 +
                       redout_227952;
                double defunc_1_op_res_227966 = defunc_1_f_res_227961 +
                       redout_227953;
                
                ((double *) mem_227764)[i_227948] = defunc_1_f_res_227959;
                ((double *) mem_227765)[i_227948] = defunc_1_f_res_227958;
                
                double redout_tmp_228028 = defunc_1_op_res_227962;
                double redout_tmp_228029 = defunc_1_op_res_227963;
                double redout_tmp_228030 = defunc_1_op_res_227964;
                double redout_tmp_228031 = defunc_1_op_res_227965;
                double redout_tmp_228032 = defunc_1_op_res_227966;
                
                redout_227949 = redout_tmp_228028;
                redout_227950 = redout_tmp_228029;
                redout_227951 = redout_tmp_228030;
                redout_227952 = redout_tmp_228031;
                redout_227953 = redout_tmp_228032;
            }
            defunc_2_reduce_res_227941 = redout_227949;
            defunc_2_reduce_res_227942 = redout_227950;
            defunc_2_reduce_res_227943 = redout_227951;
            defunc_2_reduce_res_227944 = redout_227952;
            defunc_2_reduce_res_227945 = redout_227953;
            
            double x_227969 = defunc_2_reduce_res_227943 *
                   defunc_2_reduce_res_227945;
            double y_227970 = defunc_2_reduce_res_227944 *
                   defunc_2_reduce_res_227944;
            double a12_227971 = x_227969 - y_227970;
            double x_227972 = defunc_2_reduce_res_227943 *
                   defunc_2_reduce_res_227944;
            double y_227973 = defunc_2_reduce_res_227942 *
                   defunc_2_reduce_res_227945;
            double b12_227974 = x_227972 - y_227973;
            double x_227975 = defunc_2_reduce_res_227942 *
                   defunc_2_reduce_res_227944;
            double y_227976 = defunc_2_reduce_res_227943 *
                   defunc_2_reduce_res_227943;
            double c12_227977 = x_227975 - y_227976;
            double x_227978 = defunc_2_reduce_res_227941 *
                   defunc_2_reduce_res_227945;
            double b2_227979 = x_227978 - y_227976;
            double x_227980 = defunc_2_reduce_res_227942 *
                   defunc_2_reduce_res_227943;
            double y_227981 = defunc_2_reduce_res_227941 *
                   defunc_2_reduce_res_227944;
            double c2_227982 = x_227980 - y_227981;
            double x_227983 = defunc_2_reduce_res_227941 * a12_227971;
            double y_227984 = defunc_2_reduce_res_227942 * b12_227974;
            double x_227985 = x_227983 + y_227984;
            double y_227986 = defunc_2_reduce_res_227943 * c12_227977;
            double y_227987 = x_227985 + y_227986;
            double det_227988 = 1.0 / y_227987;
            double a12_227989 = a12_227971 * det_227988;
            double b12_227990 = b12_227974 * det_227988;
            double c12_227991 = c12_227977 * det_227988;
            double b2_227992 = b2_227979 * det_227988;
            double c2_227993 = c2_227982 * det_227988;
            double defunc_2_reduce_res_227994;
            double defunc_2_reduce_res_227995;
            double redout_227997;
            double redout_227998;
            
            redout_227997 = 0.0;
            redout_227998 = 0.0;
            for (int64_t i_227996 = 0; i_227996 < q_s_203575; i_227996++) {
                double x_227999;
                
                x_227999 = ((double *) mem_227763)[i_227996];
                
                double x_228000;
                
                x_228000 = ((double *) mem_227765)[i_227996];
                
                double x_228001;
                
                x_228001 = ((double *) mem_227764)[i_227996];
                
                bool cond_228002 = sle64(x_227757, i_227996);
                double defunc_0_f_res_228003;
                
                if (cond_228002) {
                    defunc_0_f_res_228003 = 0.0;
                } else {
                    int64_t i_228004 = add64(x_227900, i_227996);
                    double defunc_0_add_arg_228005;
                    
                    defunc_0_add_arg_228005 =
                        ((double *) mem_218170.mem)[gtid_211295 *
                                                    (defunc_0_f_res_203721 *
                                                     n_p_203574) + gtid_227756 *
                                                    defunc_0_f_res_203721 +
                                                    i_228004];
                    defunc_0_f_res_228003 = defunc_0_add_arg_228005;
                }
                
                double x_228006 = a12_227989 * x_227999;
                double y_228007 = b12_227990 * x_228000;
                double x_228008 = x_228006 + y_228007;
                double y_228009 = c12_227991 * x_228001;
                double x_228010 = x_228008 + y_228009;
                double defunc_9_fit_fun_res_228011 = defunc_0_f_res_228003 *
                       x_228010;
                double x_228012 = b12_227990 * x_227999;
                double y_228013 = b2_227992 * x_228000;
                double x_228014 = x_228012 + y_228013;
                double y_228015 = c2_227993 * x_228001;
                double x_228016 = x_228014 + y_228015;
                double defunc_9_slope_fun_res_228017 = defunc_0_f_res_228003 *
                       x_228016;
                double defunc_1_op_res_228018 = defunc_9_fit_fun_res_228011 +
                       redout_227997;
                double defunc_1_op_res_228019 = defunc_9_slope_fun_res_228017 +
                       redout_227998;
                double redout_tmp_228035 = defunc_1_op_res_228018;
                double redout_tmp_228036 = defunc_1_op_res_228019;
                
                redout_227997 = redout_tmp_228035;
                redout_227998 = redout_tmp_228036;
            }
            defunc_2_reduce_res_227994 = redout_227997;
            defunc_2_reduce_res_227995 = redout_227998;
            ((double *) mem_227758)[i_227897] = defunc_2_reduce_res_227994;
            ((double *) mem_227760)[i_227897] = defunc_2_reduce_res_227995;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_219073.mem + gtid_227756 * s_n_m_203726 * (int64_t) 8,
                    mem_227758 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_219077.mem + gtid_227756 * s_n_m_203726 * (int64_t) 8,
                    mem_227760 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_227758);
    free(mem_227760);
    free(mem_227762);
    free(mem_227763);
    free(mem_227764);
    free(mem_227765);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236066_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236066_end -
                 futhark_mc_segmap_parloop_236066_start;
        
        ctx->futhark_mc_segmap_parloop_236066_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236066_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236066_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236064(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227755 = tid;
    int num_tasks_227895 = info.nsubtasks;
    struct futhark_mc_task_236063 *futhark_mc_task_236063 =
                                  (struct futhark_mc_task_236063 *) args;
    struct futhark_context *ctx = futhark_mc_task_236063->ctx;
    uint64_t futhark_mc_segmap_task_236064_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236064_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236063->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236063->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236063->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236063->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236063->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236063->free_s_n_m_203726;
    int64_t gtid_211295 = futhark_mc_task_236063->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236063->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_236063->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_236063->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236063->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236063->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236063->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236063->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 = futhark_mc_task_236063->free_bytes_218903;
    struct memblock mem_219073 = {.desc ="mem_219073", .mem =
                                  futhark_mc_task_236063->free_mem_219073,
                                  .size =0, .references =NULL};
    struct memblock mem_219077 = {.desc ="mem_219077", .mem =
                                  futhark_mc_task_236063->free_mem_219077,
                                  .size =0, .references =NULL};
    int64_t iter_227896;
    struct futhark_mc_segmap_parloop_struct_236065
    futhark_mc_segmap_parloop_struct_236065;
    
    futhark_mc_segmap_parloop_struct_236065.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236065.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236065.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236065.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236065.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236065.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236065.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236065.free_gtid_211295 = gtid_211295;
    futhark_mc_segmap_parloop_struct_236065.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236065.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_236065.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_236065.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236065.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236065.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236065.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236065.free_bytes_218903 = bytes_218903;
    futhark_mc_segmap_parloop_struct_236065.free_mem_219073 = mem_219073.mem;
    futhark_mc_segmap_parloop_struct_236065.free_mem_219077 = mem_219077.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236066_task;
    
    futhark_mc_segmap_parloop_236066_task.name =
        "futhark_mc_segmap_parloop_236066";
    futhark_mc_segmap_parloop_236066_task.fn = futhark_mc_segmap_parloop_236066;
    futhark_mc_segmap_parloop_236066_task.args =
        &futhark_mc_segmap_parloop_struct_236065;
    futhark_mc_segmap_parloop_236066_task.iterations = iterations;
    futhark_mc_segmap_parloop_236066_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236066_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236066_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236066_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236066_task);
    
    if (futhark_mc_segmap_parloop_236066_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236066_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236066_total_end -
                 futhark_mc_segmap_parloop_236066_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236066_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236066_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236066_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236064_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236064_end -
                 futhark_mc_segmap_task_236064_start;
        
        ctx->futhark_mc_segmap_task_236064_runs[tid]++;
        ctx->futhark_mc_segmap_task_236064_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236064_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236074 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211295;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217658;
    int64_t free_bytes_217663;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218903;
    unsigned char *free_mem_219073;
    unsigned char *free_mem_219077;
};
struct futhark_mc_task_236078 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211295;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218903;
    int64_t free_gtid_227499;
    int64_t free_x_227500;
    unsigned char *free_mem_227501;
    unsigned char *free_mem_227502;
};
struct futhark_mc_segmap_parloop_struct_236080 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211295;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218903;
    int64_t free_gtid_227499;
    int64_t free_x_227500;
    unsigned char *free_mem_227501;
    unsigned char *free_mem_227502;
};
static int futhark_mc_segmap_parloop_236081(void *args, int64_t start,
                                            int64_t end, int flat_tid_228162,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236080
    *futhark_mc_segmap_parloop_struct_236080 =
    (struct futhark_mc_segmap_parloop_struct_236080 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236080->ctx;
    uint64_t futhark_mc_segmap_parloop_236081_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236081_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236080->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236080->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236080->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236080->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236080->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236080->free_s_n_m_203726;
    int64_t gtid_211295 =
            futhark_mc_segmap_parloop_struct_236080->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236080->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236080->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236080->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236080->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236080->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 =
            futhark_mc_segmap_parloop_struct_236080->free_bytes_218903;
    int64_t gtid_227499 =
            futhark_mc_segmap_parloop_struct_236080->free_gtid_227499;
    int64_t x_227500 = futhark_mc_segmap_parloop_struct_236080->free_x_227500;
    struct memblock mem_227501 = {.desc ="mem_227501", .mem =
                                  futhark_mc_segmap_parloop_struct_236080->free_mem_227501,
                                  .size =0, .references =NULL};
    struct memblock mem_227502 = {.desc ="mem_227502", .mem =
                                  futhark_mc_segmap_parloop_struct_236080->free_mem_227502,
                                  .size =0, .references =NULL};
    size_t mem_228176_cached_sizze_236082 = 0;
    unsigned char *mem_228176 = NULL;
    size_t mem_228178_cached_sizze_236083 = 0;
    unsigned char *mem_228178 = NULL;
    size_t mem_228205_cached_sizze_236084 = 0;
    unsigned char *mem_228205 = NULL;
    size_t mem_228207_cached_sizze_236085 = 0;
    unsigned char *mem_228207 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228291 = start;
    
    if (mem_228176_cached_sizze_236082 < (size_t) bytes_218903) {
        mem_228176 = realloc(mem_228176, bytes_218903);
        mem_228176_cached_sizze_236082 = bytes_218903;
    }
    if (mem_228178_cached_sizze_236083 < (size_t) bytes_218903) {
        mem_228178 = realloc(mem_228178, bytes_218903);
        mem_228178_cached_sizze_236083 = bytes_218903;
    }
    if (mem_228205_cached_sizze_236084 < (size_t) bytes_218903) {
        mem_228205 = realloc(mem_228205, bytes_218903);
        mem_228205_cached_sizze_236084 = bytes_218903;
    }
    if (mem_228207_cached_sizze_236085 < (size_t) bytes_218903) {
        mem_228207 = realloc(mem_228207, bytes_218903);
        mem_228207_cached_sizze_236085 = bytes_218903;
    }
    for (; iter_228291 < end; iter_228291++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228368 = s_n_m_203726;
        int64_t gtid_228163 = iter_228291;
        int64_t remnant_228369 = iter_228291 - gtid_228163;
        int64_t x_228164;
        
        x_228164 = ((int64_t *) mem_217828.mem)[gtid_211295 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_227499 * s_n_m_203726 +
                                                gtid_228163];
        
        double x_228165;
        
        x_228165 = ((double *) mem_217833.mem)[gtid_211295 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_227499 * s_n_m_203726 +
                                               gtid_228163];
        
        bool cond_228166 = gtid_228163 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_228167;
        
        if (cond_228166) {
            defunc_0_m_fun_res_228167 = (int64_t) 0;
        } else {
            int64_t y_228292 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_228293 = gtid_228163 == y_228292;
            int64_t defunc_0_m_fun_res_f_res_228294;
            
            if (cond_228293) {
                int64_t defunc_0_m_fun_res_f_res_t_res_228295 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_228294 =
                    defunc_0_m_fun_res_f_res_t_res_228295;
            } else {
                int64_t x_228296 = sub64(gtid_228163, (int64_t) 1);
                int64_t x_228297 = mul64(jump_s_203581, x_228296);
                int64_t min_arg_228298 = add64((int64_t) 1, x_228297);
                int64_t min_res_228299 = smin64(defunc_0_f_res_203721,
                                                min_arg_228298);
                
                defunc_0_m_fun_res_f_res_228294 = min_res_228299;
            }
            defunc_0_m_fun_res_228167 = defunc_0_m_fun_res_f_res_228294;
        }
        for (int64_t i_228300 = 0; i_228300 < q_s_203575; i_228300++) {
            bool cond_228303 = sle64(x_227500, i_228300);
            int64_t defunc_0_f_res_228304;
            
            if (cond_228303) {
                defunc_0_f_res_228304 = (int64_t) 0;
            } else {
                int64_t i_228305 = add64(x_228164, i_228300);
                int64_t defunc_0_add_arg_228306;
                
                defunc_0_add_arg_228306 =
                    ((int64_t *) mem_217654.mem)[gtid_211295 *
                                                 (defunc_0_f_res_203721 *
                                                  n_p_203574) + gtid_227499 *
                                                 defunc_0_f_res_203721 +
                                                 i_228305];
                
                int64_t defunc_1_add_res_228307 = add64((int64_t) 1,
                                                        defunc_0_add_arg_228306);
                
                defunc_0_f_res_228304 = defunc_1_add_res_228307;
            }
            
            double defunc_0_f_res_228308;
            
            if (cond_228303) {
                defunc_0_f_res_228308 = 0.0;
            } else {
                int64_t i_228309 = add64(x_228164, i_228300);
                double defunc_0_add_arg_228310;
                
                defunc_0_add_arg_228310 =
                    ((double *) mem_218175.mem)[gtid_211295 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_227499 *
                                                defunc_0_f_res_203721 +
                                                i_228309];
                defunc_0_f_res_228308 = defunc_0_add_arg_228310;
            }
            
            int64_t binop_p_228311 = sub64(defunc_0_f_res_228304,
                                           defunc_0_m_fun_res_228167);
            double defunc_0_f_res_228312 = sitofp_i64_f64(binop_p_228311);
            double abs_res_228313 = fabs(defunc_0_f_res_228312);
            double tmp1_228314 = abs_res_228313 / x_228165;
            double x_228315 = tmp1_228314 * tmp1_228314;
            double y_228316 = tmp1_228314 * x_228315;
            double tmp2_228317 = 1.0 - y_228316;
            double x_228318 = tmp2_228317 * tmp2_228317;
            double tmp3_228319 = tmp2_228317 * x_228318;
            double tmp4_228320 = defunc_0_f_res_228308 * tmp3_228319;
            
            ((double *) mem_228176)[i_228300] = defunc_0_f_res_228312;
            ((double *) mem_228178)[i_228300] = tmp4_228320;
        }
        
        double defunc_2_reduce_res_228209;
        double defunc_2_reduce_res_228210;
        double defunc_2_reduce_res_228211;
        double defunc_2_reduce_res_228212;
        double defunc_2_reduce_res_228213;
        double redout_228324;
        double redout_228325;
        double redout_228326;
        double redout_228327;
        double redout_228328;
        
        redout_228324 = 0.0;
        redout_228325 = 0.0;
        redout_228326 = 0.0;
        redout_228327 = 0.0;
        redout_228328 = 0.0;
        for (int64_t i_228323 = 0; i_228323 < q_s_203575; i_228323++) {
            double x_228331;
            
            x_228331 = ((double *) mem_228176)[i_228323];
            
            double x_228332;
            
            x_228332 = ((double *) mem_228178)[i_228323];
            
            double defunc_1_f_res_228333 = x_228331 * x_228332;
            double defunc_1_f_res_228334 = x_228331 * defunc_1_f_res_228333;
            double defunc_1_f_res_228335 = x_228331 * defunc_1_f_res_228334;
            double defunc_1_f_res_228336 = x_228331 * defunc_1_f_res_228335;
            double defunc_1_op_res_228337 = x_228332 + redout_228324;
            double defunc_1_op_res_228338 = defunc_1_f_res_228333 +
                   redout_228325;
            double defunc_1_op_res_228339 = defunc_1_f_res_228334 +
                   redout_228326;
            double defunc_1_op_res_228340 = defunc_1_f_res_228335 +
                   redout_228327;
            double defunc_1_op_res_228341 = defunc_1_f_res_228336 +
                   redout_228328;
            
            ((double *) mem_228205)[i_228323] = defunc_1_f_res_228334;
            ((double *) mem_228207)[i_228323] = defunc_1_f_res_228333;
            
            double redout_tmp_228372 = defunc_1_op_res_228337;
            double redout_tmp_228373 = defunc_1_op_res_228338;
            double redout_tmp_228374 = defunc_1_op_res_228339;
            double redout_tmp_228375 = defunc_1_op_res_228340;
            double redout_tmp_228376 = defunc_1_op_res_228341;
            
            redout_228324 = redout_tmp_228372;
            redout_228325 = redout_tmp_228373;
            redout_228326 = redout_tmp_228374;
            redout_228327 = redout_tmp_228375;
            redout_228328 = redout_tmp_228376;
        }
        defunc_2_reduce_res_228209 = redout_228324;
        defunc_2_reduce_res_228210 = redout_228325;
        defunc_2_reduce_res_228211 = redout_228326;
        defunc_2_reduce_res_228212 = redout_228327;
        defunc_2_reduce_res_228213 = redout_228328;
        
        double x_228237 = defunc_2_reduce_res_228211 *
               defunc_2_reduce_res_228213;
        double y_228238 = defunc_2_reduce_res_228212 *
               defunc_2_reduce_res_228212;
        double a12_228239 = x_228237 - y_228238;
        double x_228240 = defunc_2_reduce_res_228211 *
               defunc_2_reduce_res_228212;
        double y_228241 = defunc_2_reduce_res_228210 *
               defunc_2_reduce_res_228213;
        double b12_228242 = x_228240 - y_228241;
        double x_228243 = defunc_2_reduce_res_228210 *
               defunc_2_reduce_res_228212;
        double y_228244 = defunc_2_reduce_res_228211 *
               defunc_2_reduce_res_228211;
        double c12_228245 = x_228243 - y_228244;
        double x_228246 = defunc_2_reduce_res_228209 *
               defunc_2_reduce_res_228213;
        double b2_228247 = x_228246 - y_228244;
        double x_228248 = defunc_2_reduce_res_228210 *
               defunc_2_reduce_res_228211;
        double y_228249 = defunc_2_reduce_res_228209 *
               defunc_2_reduce_res_228212;
        double c2_228250 = x_228248 - y_228249;
        double x_228251 = defunc_2_reduce_res_228209 * a12_228239;
        double y_228252 = defunc_2_reduce_res_228210 * b12_228242;
        double x_228253 = x_228251 + y_228252;
        double y_228254 = defunc_2_reduce_res_228211 * c12_228245;
        double y_228255 = x_228253 + y_228254;
        double det_228256 = 1.0 / y_228255;
        double a12_228257 = a12_228239 * det_228256;
        double b12_228258 = b12_228242 * det_228256;
        double c12_228259 = c12_228245 * det_228256;
        double b2_228260 = b2_228247 * det_228256;
        double c2_228261 = c2_228250 * det_228256;
        double defunc_2_reduce_res_228262;
        double defunc_2_reduce_res_228263;
        double redout_228345;
        double redout_228346;
        
        redout_228345 = 0.0;
        redout_228346 = 0.0;
        for (int64_t i_228344 = 0; i_228344 < q_s_203575; i_228344++) {
            double x_228347;
            
            x_228347 = ((double *) mem_228178)[i_228344];
            
            double x_228348;
            
            x_228348 = ((double *) mem_228207)[i_228344];
            
            double x_228349;
            
            x_228349 = ((double *) mem_228205)[i_228344];
            
            bool cond_228350 = sle64(x_227500, i_228344);
            double defunc_0_f_res_228351;
            
            if (cond_228350) {
                defunc_0_f_res_228351 = 0.0;
            } else {
                int64_t i_228352 = add64(x_228164, i_228344);
                double defunc_0_add_arg_228353;
                
                defunc_0_add_arg_228353 =
                    ((double *) mem_218170.mem)[gtid_211295 *
                                                (defunc_0_f_res_203721 *
                                                 n_p_203574) + gtid_227499 *
                                                defunc_0_f_res_203721 +
                                                i_228352];
                defunc_0_f_res_228351 = defunc_0_add_arg_228353;
            }
            
            double x_228354 = a12_228257 * x_228347;
            double y_228355 = b12_228258 * x_228348;
            double x_228356 = x_228354 + y_228355;
            double y_228357 = c12_228259 * x_228349;
            double x_228358 = x_228356 + y_228357;
            double defunc_9_fit_fun_res_228359 = defunc_0_f_res_228351 *
                   x_228358;
            double x_228360 = b12_228258 * x_228347;
            double y_228361 = b2_228260 * x_228348;
            double x_228362 = x_228360 + y_228361;
            double y_228363 = c2_228261 * x_228349;
            double x_228364 = x_228362 + y_228363;
            double defunc_9_slope_fun_res_228365 = defunc_0_f_res_228351 *
                   x_228364;
            double defunc_1_op_res_228366 = defunc_9_fit_fun_res_228359 +
                   redout_228345;
            double defunc_1_op_res_228367 = defunc_9_slope_fun_res_228365 +
                   redout_228346;
            double redout_tmp_228379 = defunc_1_op_res_228366;
            double redout_tmp_228380 = defunc_1_op_res_228367;
            
            redout_228345 = redout_tmp_228379;
            redout_228346 = redout_tmp_228380;
        }
        defunc_2_reduce_res_228262 = redout_228345;
        defunc_2_reduce_res_228263 = redout_228346;
        ((double *) mem_227501.mem)[gtid_228163] = defunc_2_reduce_res_228262;
        ((double *) mem_227502.mem)[gtid_228163] = defunc_2_reduce_res_228263;
    }
    
  cleanup:
    { }
    free(mem_228176);
    free(mem_228178);
    free(mem_228205);
    free(mem_228207);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236081_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236081_end -
                 futhark_mc_segmap_parloop_236081_start;
        
        ctx->futhark_mc_segmap_parloop_236081_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236081_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236081_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236079(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228162 = tid;
    int num_tasks_228290 = info.nsubtasks;
    struct futhark_mc_task_236078 *futhark_mc_task_236078 =
                                  (struct futhark_mc_task_236078 *) args;
    struct futhark_context *ctx = futhark_mc_task_236078->ctx;
    uint64_t futhark_mc_segmap_task_236079_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236079_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236078->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236078->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236078->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236078->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236078->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236078->free_s_n_m_203726;
    int64_t gtid_211295 = futhark_mc_task_236078->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236078->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236078->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236078->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236078->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236078->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 = futhark_mc_task_236078->free_bytes_218903;
    int64_t gtid_227499 = futhark_mc_task_236078->free_gtid_227499;
    int64_t x_227500 = futhark_mc_task_236078->free_x_227500;
    struct memblock mem_227501 = {.desc ="mem_227501", .mem =
                                  futhark_mc_task_236078->free_mem_227501,
                                  .size =0, .references =NULL};
    struct memblock mem_227502 = {.desc ="mem_227502", .mem =
                                  futhark_mc_task_236078->free_mem_227502,
                                  .size =0, .references =NULL};
    int64_t iter_228291;
    struct futhark_mc_segmap_parloop_struct_236080
    futhark_mc_segmap_parloop_struct_236080;
    
    futhark_mc_segmap_parloop_struct_236080.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236080.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236080.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236080.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236080.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236080.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236080.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236080.free_gtid_211295 = gtid_211295;
    futhark_mc_segmap_parloop_struct_236080.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236080.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236080.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236080.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236080.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236080.free_bytes_218903 = bytes_218903;
    futhark_mc_segmap_parloop_struct_236080.free_gtid_227499 = gtid_227499;
    futhark_mc_segmap_parloop_struct_236080.free_x_227500 = x_227500;
    futhark_mc_segmap_parloop_struct_236080.free_mem_227501 = mem_227501.mem;
    futhark_mc_segmap_parloop_struct_236080.free_mem_227502 = mem_227502.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236081_task;
    
    futhark_mc_segmap_parloop_236081_task.name =
        "futhark_mc_segmap_parloop_236081";
    futhark_mc_segmap_parloop_236081_task.fn = futhark_mc_segmap_parloop_236081;
    futhark_mc_segmap_parloop_236081_task.args =
        &futhark_mc_segmap_parloop_struct_236080;
    futhark_mc_segmap_parloop_236081_task.iterations = iterations;
    futhark_mc_segmap_parloop_236081_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236081_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236081_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236081_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236081_task);
    
    if (futhark_mc_segmap_parloop_236081_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236081_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236081_total_end -
                 futhark_mc_segmap_parloop_236081_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236081_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236081_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236081_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236079_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236079_end -
                 futhark_mc_segmap_task_236079_start;
        
        ctx->futhark_mc_segmap_task_236079_runs[tid]++;
        ctx->futhark_mc_segmap_task_236079_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236079_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236087 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211295;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_217828;
    unsigned char *free_mem_217833;
    unsigned char *free_mem_218170;
    unsigned char *free_mem_218175;
    int64_t free_bytes_218903;
    int64_t free_gtid_227499;
    int64_t free_x_227500;
    unsigned char *free_mem_227501;
    unsigned char *free_mem_227502;
};
struct futhark_mc_task_236093 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_211295;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_227499;
    int64_t free_x_227500;
    int64_t free_x_228040;
    double free_x_228041;
    int64_t free_defunc_0_m_fun_res_228043;
    unsigned char *free_mem_228052;
    unsigned char *free_mem_228053;
};
struct futhark_mc_segmap_parloop_struct_236095 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_q_s_203575;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_211295;
    unsigned char *free_mem_217654;
    unsigned char *free_mem_218175;
    int64_t free_gtid_227499;
    int64_t free_x_227500;
    int64_t free_x_228040;
    double free_x_228041;
    int64_t free_defunc_0_m_fun_res_228043;
    unsigned char *free_mem_228052;
    unsigned char *free_mem_228053;
};
static int futhark_mc_segmap_parloop_236096(void *args, int64_t start,
                                            int64_t end, int flat_tid_228390,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236095
    *futhark_mc_segmap_parloop_struct_236095 =
    (struct futhark_mc_segmap_parloop_struct_236095 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236095->ctx;
    uint64_t futhark_mc_segmap_parloop_236096_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236096_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236095->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236095->free_q_s_203575;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236095->free_defunc_0_f_res_203721;
    int64_t gtid_211295 =
            futhark_mc_segmap_parloop_struct_236095->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236095->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236095->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_227499 =
            futhark_mc_segmap_parloop_struct_236095->free_gtid_227499;
    int64_t x_227500 = futhark_mc_segmap_parloop_struct_236095->free_x_227500;
    int64_t x_228040 = futhark_mc_segmap_parloop_struct_236095->free_x_228040;
    double x_228041 = futhark_mc_segmap_parloop_struct_236095->free_x_228041;
    int64_t defunc_0_m_fun_res_228043 =
            futhark_mc_segmap_parloop_struct_236095->free_defunc_0_m_fun_res_228043;
    struct memblock mem_228052 = {.desc ="mem_228052", .mem =
                                  futhark_mc_segmap_parloop_struct_236095->free_mem_228052,
                                  .size =0, .references =NULL};
    struct memblock mem_228053 = {.desc ="mem_228053", .mem =
                                  futhark_mc_segmap_parloop_struct_236095->free_mem_228053,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228463 = start;
    
    for (; iter_228463 < end; iter_228463++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228469 = q_s_203575;
        int64_t gtid_228391 = iter_228463;
        int64_t remnant_228470 = iter_228463 - gtid_228391;
        bool cond_228392 = sle64(x_227500, gtid_228391);
        int64_t defunc_0_f_res_228393;
        
        if (cond_228392) {
            defunc_0_f_res_228393 = (int64_t) 0;
        } else {
            int64_t i_228464 = add64(x_228040, gtid_228391);
            int64_t defunc_0_add_arg_228465;
            
            defunc_0_add_arg_228465 = ((int64_t *) mem_217654.mem)[gtid_211295 *
                                                                   (defunc_0_f_res_203721 *
                                                                    n_p_203574) +
                                                                   gtid_227499 *
                                                                   defunc_0_f_res_203721 +
                                                                   i_228464];
            
            int64_t defunc_1_add_res_228466 = add64((int64_t) 1,
                                                    defunc_0_add_arg_228465);
            
            defunc_0_f_res_228393 = defunc_1_add_res_228466;
        }
        
        double defunc_0_f_res_228397;
        
        if (cond_228392) {
            defunc_0_f_res_228397 = 0.0;
        } else {
            int64_t i_228467 = add64(x_228040, gtid_228391);
            double defunc_0_add_arg_228468;
            
            defunc_0_add_arg_228468 = ((double *) mem_218175.mem)[gtid_211295 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_227499 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_228467];
            defunc_0_f_res_228397 = defunc_0_add_arg_228468;
        }
        
        int64_t binop_p_228400 = sub64(defunc_0_f_res_228393,
                                       defunc_0_m_fun_res_228043);
        double defunc_0_f_res_228401 = sitofp_i64_f64(binop_p_228400);
        double abs_res_228402 = fabs(defunc_0_f_res_228401);
        double tmp1_228403 = abs_res_228402 / x_228041;
        double x_228404 = tmp1_228403 * tmp1_228403;
        double y_228405 = tmp1_228403 * x_228404;
        double tmp2_228406 = 1.0 - y_228405;
        double x_228407 = tmp2_228406 * tmp2_228406;
        double tmp3_228408 = tmp2_228406 * x_228407;
        double tmp4_228409 = defunc_0_f_res_228397 * tmp3_228408;
        
        ((double *) mem_228052.mem)[gtid_228391] = defunc_0_f_res_228401;
        ((double *) mem_228053.mem)[gtid_228391] = tmp4_228409;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236096_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236096_end -
                 futhark_mc_segmap_parloop_236096_start;
        
        ctx->futhark_mc_segmap_parloop_236096_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236096_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236096_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236094(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228390 = tid;
    int num_tasks_228462 = info.nsubtasks;
    struct futhark_mc_task_236093 *futhark_mc_task_236093 =
                                  (struct futhark_mc_task_236093 *) args;
    struct futhark_context *ctx = futhark_mc_task_236093->ctx;
    uint64_t futhark_mc_segmap_task_236094_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236094_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236093->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236093->free_q_s_203575;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236093->free_defunc_0_f_res_203721;
    int64_t gtid_211295 = futhark_mc_task_236093->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236093->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236093->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t gtid_227499 = futhark_mc_task_236093->free_gtid_227499;
    int64_t x_227500 = futhark_mc_task_236093->free_x_227500;
    int64_t x_228040 = futhark_mc_task_236093->free_x_228040;
    double x_228041 = futhark_mc_task_236093->free_x_228041;
    int64_t defunc_0_m_fun_res_228043 =
            futhark_mc_task_236093->free_defunc_0_m_fun_res_228043;
    struct memblock mem_228052 = {.desc ="mem_228052", .mem =
                                  futhark_mc_task_236093->free_mem_228052,
                                  .size =0, .references =NULL};
    struct memblock mem_228053 = {.desc ="mem_228053", .mem =
                                  futhark_mc_task_236093->free_mem_228053,
                                  .size =0, .references =NULL};
    int64_t iter_228463;
    struct futhark_mc_segmap_parloop_struct_236095
    futhark_mc_segmap_parloop_struct_236095;
    
    futhark_mc_segmap_parloop_struct_236095.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236095.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236095.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236095.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236095.free_gtid_211295 = gtid_211295;
    futhark_mc_segmap_parloop_struct_236095.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236095.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236095.free_gtid_227499 = gtid_227499;
    futhark_mc_segmap_parloop_struct_236095.free_x_227500 = x_227500;
    futhark_mc_segmap_parloop_struct_236095.free_x_228040 = x_228040;
    futhark_mc_segmap_parloop_struct_236095.free_x_228041 = x_228041;
    futhark_mc_segmap_parloop_struct_236095.free_defunc_0_m_fun_res_228043 =
        defunc_0_m_fun_res_228043;
    futhark_mc_segmap_parloop_struct_236095.free_mem_228052 = mem_228052.mem;
    futhark_mc_segmap_parloop_struct_236095.free_mem_228053 = mem_228053.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236096_task;
    
    futhark_mc_segmap_parloop_236096_task.name =
        "futhark_mc_segmap_parloop_236096";
    futhark_mc_segmap_parloop_236096_task.fn = futhark_mc_segmap_parloop_236096;
    futhark_mc_segmap_parloop_236096_task.args =
        &futhark_mc_segmap_parloop_struct_236095;
    futhark_mc_segmap_parloop_236096_task.iterations = iterations;
    futhark_mc_segmap_parloop_236096_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236096_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236096_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236096_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236096_task);
    
    if (futhark_mc_segmap_parloop_236096_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236096_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236096_total_end -
                 futhark_mc_segmap_parloop_236096_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236096_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236096_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236096_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236094_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236094_end -
                 futhark_mc_segmap_task_236094_start;
        
        ctx->futhark_mc_segmap_task_236094_runs[tid]++;
        ctx->futhark_mc_segmap_task_236094_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236094_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236097 {
    struct futhark_context *ctx;
    unsigned char *free_mem_228052;
    unsigned char *free_mem_228053;
    double *retval_defunc_2_reduce_res_228078;
    double *retval_defunc_2_reduce_res_228079;
    double *retval_defunc_2_reduce_res_228080;
    double *retval_defunc_2_reduce_res_228081;
    double *retval_defunc_2_reduce_res_228082;
    unsigned char *retval_mem_228076;
    unsigned char *retval_mem_228077;
};
struct futhark_mc_segred_stage_1_parloop_struct_236104 {
    struct futhark_context *ctx;
    unsigned char *free_mem_228052;
    unsigned char *free_mem_228053;
    unsigned char *free_mem_228076;
    unsigned char *free_mem_228077;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228472;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228474;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228476;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228478;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228480;
};
static int futhark_mc_segred_stage_1_parloop_236105(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_228410,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236104
    *futhark_mc_segred_stage_1_parloop_struct_236104 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236104 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236104->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236105_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236105_start = get_wall_time();
    
    struct memblock mem_228052 = {.desc ="mem_228052", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236104->free_mem_228052,
                                  .size =0, .references =NULL};
    struct memblock mem_228053 = {.desc ="mem_228053", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236104->free_mem_228053,
                                  .size =0, .references =NULL};
    struct memblock mem_228076 = {.desc ="mem_228076", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236104->free_mem_228076,
                                  .size =0, .references =NULL};
    struct memblock mem_228077 = {.desc ="mem_228077", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236104->free_mem_228077,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228472 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228472",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236104->free_reduce_stage_1_tid_res_arr_mem_228472,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228474 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228474",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236104->free_reduce_stage_1_tid_res_arr_mem_228474,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228476 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228476",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236104->free_reduce_stage_1_tid_res_arr_mem_228476,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228478 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228478",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236104->free_reduce_stage_1_tid_res_arr_mem_228478,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228480 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228480",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236104->free_reduce_stage_1_tid_res_arr_mem_228480,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228482 = start;
    double x_228412;
    double x_228413;
    double x_228415;
    double x_228416;
    double x_228418;
    double x_228419;
    double x_228421;
    double x_228422;
    double x_228424;
    double x_228425;
    double local_acc_228483 = 0.0;
    double local_acc_228484 = 0.0;
    double local_acc_228485 = 0.0;
    double local_acc_228486 = 0.0;
    double local_acc_228487 = 0.0;
    
    for (; iter_228482 < end; iter_228482++) {
        int64_t gtid_228411 = iter_228482;
        double x_228427;
        
        x_228427 = ((double *) mem_228052.mem)[gtid_228411];
        
        double x_228428;
        
        x_228428 = ((double *) mem_228053.mem)[gtid_228411];
        
        double defunc_1_f_res_228429 = x_228427 * x_228428;
        double defunc_1_f_res_228430 = x_228427 * defunc_1_f_res_228429;
        double defunc_1_f_res_228431 = x_228427 * defunc_1_f_res_228430;
        double defunc_1_f_res_228432 = x_228427 * defunc_1_f_res_228431;
        
        // save map-out results
        {
            ((double *) mem_228076.mem)[gtid_228411] = defunc_1_f_res_228430;
            ((double *) mem_228077.mem)[gtid_228411] = defunc_1_f_res_228429;
        }
        // Load accum params
        {
            x_228412 = local_acc_228483;
        }
        // Load next params
        {
            x_228413 = x_228428;
        }
        // Red body
        {
            double defunc_1_op_res_228414 = x_228412 + x_228413;
            
            local_acc_228483 = defunc_1_op_res_228414;
        }
        // Load accum params
        {
            x_228415 = local_acc_228484;
        }
        // Load next params
        {
            x_228416 = defunc_1_f_res_228429;
        }
        // Red body
        {
            double defunc_1_op_res_228417 = x_228415 + x_228416;
            
            local_acc_228484 = defunc_1_op_res_228417;
        }
        // Load accum params
        {
            x_228418 = local_acc_228485;
        }
        // Load next params
        {
            x_228419 = defunc_1_f_res_228430;
        }
        // Red body
        {
            double defunc_1_op_res_228420 = x_228418 + x_228419;
            
            local_acc_228485 = defunc_1_op_res_228420;
        }
        // Load accum params
        {
            x_228421 = local_acc_228486;
        }
        // Load next params
        {
            x_228422 = defunc_1_f_res_228431;
        }
        // Red body
        {
            double defunc_1_op_res_228423 = x_228421 + x_228422;
            
            local_acc_228486 = defunc_1_op_res_228423;
        }
        // Load accum params
        {
            x_228424 = local_acc_228487;
        }
        // Load next params
        {
            x_228425 = defunc_1_f_res_228432;
        }
        // Red body
        {
            double defunc_1_op_res_228426 = x_228424 + x_228425;
            
            local_acc_228487 = defunc_1_op_res_228426;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_228472.mem)[flat_tid_228410] =
        local_acc_228483;
    ((double *) reduce_stage_1_tid_res_arr_mem_228474.mem)[flat_tid_228410] =
        local_acc_228484;
    ((double *) reduce_stage_1_tid_res_arr_mem_228476.mem)[flat_tid_228410] =
        local_acc_228485;
    ((double *) reduce_stage_1_tid_res_arr_mem_228478.mem)[flat_tid_228410] =
        local_acc_228486;
    ((double *) reduce_stage_1_tid_res_arr_mem_228480.mem)[flat_tid_228410] =
        local_acc_228487;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236105_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236105_end -
                 futhark_mc_segred_stage_1_parloop_236105_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236105_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236105_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236105_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236098(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228410 = tid;
    int num_tasks_228471 = info.nsubtasks;
    struct futhark_mc_task_236097 *futhark_mc_task_236097 =
                                  (struct futhark_mc_task_236097 *) args;
    struct futhark_context *ctx = futhark_mc_task_236097->ctx;
    uint64_t futhark_mc_segred_task_236098_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236098_start = get_wall_time();
    
    struct memblock mem_228052 = {.desc ="mem_228052", .mem =
                                  futhark_mc_task_236097->free_mem_228052,
                                  .size =0, .references =NULL};
    struct memblock mem_228053 = {.desc ="mem_228053", .mem =
                                  futhark_mc_task_236097->free_mem_228053,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_228078 =
           *futhark_mc_task_236097->retval_defunc_2_reduce_res_228078;
    double defunc_2_reduce_res_228079 =
           *futhark_mc_task_236097->retval_defunc_2_reduce_res_228079;
    double defunc_2_reduce_res_228080 =
           *futhark_mc_task_236097->retval_defunc_2_reduce_res_228080;
    double defunc_2_reduce_res_228081 =
           *futhark_mc_task_236097->retval_defunc_2_reduce_res_228081;
    double defunc_2_reduce_res_228082 =
           *futhark_mc_task_236097->retval_defunc_2_reduce_res_228082;
    struct memblock mem_228076 = {.desc ="mem_228076", .mem =
                                  futhark_mc_task_236097->retval_mem_228076,
                                  .size =0, .references =NULL};
    struct memblock mem_228077 = {.desc ="mem_228077", .mem =
                                  futhark_mc_task_236097->retval_mem_228077,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_228472_cached_sizze_236099 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228472 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228474_cached_sizze_236100 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228474 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228476_cached_sizze_236101 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228476 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228478_cached_sizze_236102 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228478 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228480_cached_sizze_236103 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228480 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_228472_cached_sizze_236099 <
        (size_t) ((int64_t) 8 * num_tasks_228471)) {
        reduce_stage_1_tid_res_arr_mem_228472 =
            realloc(reduce_stage_1_tid_res_arr_mem_228472, (int64_t) 8 *
                    num_tasks_228471);
        reduce_stage_1_tid_res_arr_mem_228472_cached_sizze_236099 =
            (int64_t) 8 * num_tasks_228471;
    }
    if (reduce_stage_1_tid_res_arr_mem_228474_cached_sizze_236100 <
        (size_t) ((int64_t) 8 * num_tasks_228471)) {
        reduce_stage_1_tid_res_arr_mem_228474 =
            realloc(reduce_stage_1_tid_res_arr_mem_228474, (int64_t) 8 *
                    num_tasks_228471);
        reduce_stage_1_tid_res_arr_mem_228474_cached_sizze_236100 =
            (int64_t) 8 * num_tasks_228471;
    }
    if (reduce_stage_1_tid_res_arr_mem_228476_cached_sizze_236101 <
        (size_t) ((int64_t) 8 * num_tasks_228471)) {
        reduce_stage_1_tid_res_arr_mem_228476 =
            realloc(reduce_stage_1_tid_res_arr_mem_228476, (int64_t) 8 *
                    num_tasks_228471);
        reduce_stage_1_tid_res_arr_mem_228476_cached_sizze_236101 =
            (int64_t) 8 * num_tasks_228471;
    }
    if (reduce_stage_1_tid_res_arr_mem_228478_cached_sizze_236102 <
        (size_t) ((int64_t) 8 * num_tasks_228471)) {
        reduce_stage_1_tid_res_arr_mem_228478 =
            realloc(reduce_stage_1_tid_res_arr_mem_228478, (int64_t) 8 *
                    num_tasks_228471);
        reduce_stage_1_tid_res_arr_mem_228478_cached_sizze_236102 =
            (int64_t) 8 * num_tasks_228471;
    }
    if (reduce_stage_1_tid_res_arr_mem_228480_cached_sizze_236103 <
        (size_t) ((int64_t) 8 * num_tasks_228471)) {
        reduce_stage_1_tid_res_arr_mem_228480 =
            realloc(reduce_stage_1_tid_res_arr_mem_228480, (int64_t) 8 *
                    num_tasks_228471);
        reduce_stage_1_tid_res_arr_mem_228480_cached_sizze_236103 =
            (int64_t) 8 * num_tasks_228471;
    }
    
    int64_t iter_228482;
    struct futhark_mc_segred_stage_1_parloop_struct_236104
    futhark_mc_segred_stage_1_parloop_struct_236104;
    
    futhark_mc_segred_stage_1_parloop_struct_236104.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236104.free_mem_228052 =
        mem_228052.mem;
    futhark_mc_segred_stage_1_parloop_struct_236104.free_mem_228053 =
        mem_228053.mem;
    futhark_mc_segred_stage_1_parloop_struct_236104.free_mem_228076 =
        mem_228076.mem;
    futhark_mc_segred_stage_1_parloop_struct_236104.free_mem_228077 =
        mem_228077.mem;
    futhark_mc_segred_stage_1_parloop_struct_236104.free_reduce_stage_1_tid_res_arr_mem_228472 =
        reduce_stage_1_tid_res_arr_mem_228472;
    futhark_mc_segred_stage_1_parloop_struct_236104.free_reduce_stage_1_tid_res_arr_mem_228474 =
        reduce_stage_1_tid_res_arr_mem_228474;
    futhark_mc_segred_stage_1_parloop_struct_236104.free_reduce_stage_1_tid_res_arr_mem_228476 =
        reduce_stage_1_tid_res_arr_mem_228476;
    futhark_mc_segred_stage_1_parloop_struct_236104.free_reduce_stage_1_tid_res_arr_mem_228478 =
        reduce_stage_1_tid_res_arr_mem_228478;
    futhark_mc_segred_stage_1_parloop_struct_236104.free_reduce_stage_1_tid_res_arr_mem_228480 =
        reduce_stage_1_tid_res_arr_mem_228480;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236105_task;
    
    futhark_mc_segred_stage_1_parloop_236105_task.name =
        "futhark_mc_segred_stage_1_parloop_236105";
    futhark_mc_segred_stage_1_parloop_236105_task.fn =
        futhark_mc_segred_stage_1_parloop_236105;
    futhark_mc_segred_stage_1_parloop_236105_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236104;
    futhark_mc_segred_stage_1_parloop_236105_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236105_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236105_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236105_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236105_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236105_task);
    
    if (futhark_mc_segred_stage_1_parloop_236105_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236105_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236105_total_end -
                 futhark_mc_segred_stage_1_parloop_236105_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236105_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236105_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236105_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_228078 = 0.0;
        defunc_2_reduce_res_228079 = 0.0;
        defunc_2_reduce_res_228080 = 0.0;
        defunc_2_reduce_res_228081 = 0.0;
        defunc_2_reduce_res_228082 = 0.0;
    }
    
    double x_228488;
    double x_228489;
    double x_228491;
    double x_228492;
    double x_228494;
    double x_228495;
    double x_228497;
    double x_228498;
    double x_228500;
    double x_228501;
    
    for (int32_t i_228503 = 0; i_228503 < num_tasks_228471; i_228503++) {
        flat_tid_228410 = i_228503;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_228488 = defunc_2_reduce_res_228078;
            }
            // load next params
            {
                x_228489 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228472)[flat_tid_228410];
            }
            // red body
            {
                double defunc_1_op_res_228490 = x_228488 + x_228489;
                
                defunc_2_reduce_res_228078 = defunc_1_op_res_228490;
            }
            // load acc params
            {
                x_228491 = defunc_2_reduce_res_228079;
            }
            // load next params
            {
                x_228492 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228474)[flat_tid_228410];
            }
            // red body
            {
                double defunc_1_op_res_228493 = x_228491 + x_228492;
                
                defunc_2_reduce_res_228079 = defunc_1_op_res_228493;
            }
            // load acc params
            {
                x_228494 = defunc_2_reduce_res_228080;
            }
            // load next params
            {
                x_228495 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228476)[flat_tid_228410];
            }
            // red body
            {
                double defunc_1_op_res_228496 = x_228494 + x_228495;
                
                defunc_2_reduce_res_228080 = defunc_1_op_res_228496;
            }
            // load acc params
            {
                x_228497 = defunc_2_reduce_res_228081;
            }
            // load next params
            {
                x_228498 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228478)[flat_tid_228410];
            }
            // red body
            {
                double defunc_1_op_res_228499 = x_228497 + x_228498;
                
                defunc_2_reduce_res_228081 = defunc_1_op_res_228499;
            }
            // load acc params
            {
                x_228500 = defunc_2_reduce_res_228082;
            }
            // load next params
            {
                x_228501 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228480)[flat_tid_228410];
            }
            // red body
            {
                double defunc_1_op_res_228502 = x_228500 + x_228501;
                
                defunc_2_reduce_res_228082 = defunc_1_op_res_228502;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_228472);
        free(reduce_stage_1_tid_res_arr_mem_228474);
        free(reduce_stage_1_tid_res_arr_mem_228476);
        free(reduce_stage_1_tid_res_arr_mem_228478);
        free(reduce_stage_1_tid_res_arr_mem_228480);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236098_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236098_end -
                 futhark_mc_segred_task_236098_start;
        
        ctx->futhark_mc_segred_task_236098_runs[tid]++;
        ctx->futhark_mc_segred_task_236098_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236098_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236097->retval_defunc_2_reduce_res_228078 =
            defunc_2_reduce_res_228078;
        *futhark_mc_task_236097->retval_defunc_2_reduce_res_228079 =
            defunc_2_reduce_res_228079;
        *futhark_mc_task_236097->retval_defunc_2_reduce_res_228080 =
            defunc_2_reduce_res_228080;
        *futhark_mc_task_236097->retval_defunc_2_reduce_res_228081 =
            defunc_2_reduce_res_228081;
        *futhark_mc_task_236097->retval_defunc_2_reduce_res_228082 =
            defunc_2_reduce_res_228082;
        futhark_mc_task_236097->retval_mem_228076 = mem_228076.mem;
        futhark_mc_task_236097->retval_mem_228077 = mem_228077.mem;
    }
    return err;
}
struct futhark_mc_task_236106 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_211295;
    unsigned char *free_mem_218170;
    int64_t free_gtid_227499;
    int64_t free_x_227500;
    int64_t free_x_228040;
    unsigned char *free_mem_228053;
    unsigned char *free_mem_228076;
    unsigned char *free_mem_228077;
    double free_a12_228128;
    double free_b12_228129;
    double free_c12_228130;
    double free_b2_228131;
    double free_c2_228132;
    double *retval_defunc_2_reduce_res_228133;
    double *retval_defunc_2_reduce_res_228134;
};
struct futhark_mc_segred_stage_1_parloop_struct_236110 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_gtid_211295;
    unsigned char *free_mem_218170;
    int64_t free_gtid_227499;
    int64_t free_x_227500;
    int64_t free_x_228040;
    unsigned char *free_mem_228053;
    unsigned char *free_mem_228076;
    unsigned char *free_mem_228077;
    double free_a12_228128;
    double free_b12_228129;
    double free_c12_228130;
    double free_b2_228131;
    double free_c2_228132;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228505;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_228507;
};
static int futhark_mc_segred_stage_1_parloop_236111(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_228433,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236110
    *futhark_mc_segred_stage_1_parloop_struct_236110 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236110 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236110->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236111_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236111_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segred_stage_1_parloop_struct_236110->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segred_stage_1_parloop_struct_236110->free_defunc_0_f_res_203721;
    int64_t gtid_211295 =
            futhark_mc_segred_stage_1_parloop_struct_236110->free_gtid_211295;
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236110->free_mem_218170,
                                  .size =0, .references =NULL};
    int64_t gtid_227499 =
            futhark_mc_segred_stage_1_parloop_struct_236110->free_gtid_227499;
    int64_t x_227500 =
            futhark_mc_segred_stage_1_parloop_struct_236110->free_x_227500;
    int64_t x_228040 =
            futhark_mc_segred_stage_1_parloop_struct_236110->free_x_228040;
    struct memblock mem_228053 = {.desc ="mem_228053", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236110->free_mem_228053,
                                  .size =0, .references =NULL};
    struct memblock mem_228076 = {.desc ="mem_228076", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236110->free_mem_228076,
                                  .size =0, .references =NULL};
    struct memblock mem_228077 = {.desc ="mem_228077", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236110->free_mem_228077,
                                  .size =0, .references =NULL};
    double a12_228128 =
           futhark_mc_segred_stage_1_parloop_struct_236110->free_a12_228128;
    double b12_228129 =
           futhark_mc_segred_stage_1_parloop_struct_236110->free_b12_228129;
    double c12_228130 =
           futhark_mc_segred_stage_1_parloop_struct_236110->free_c12_228130;
    double b2_228131 =
           futhark_mc_segred_stage_1_parloop_struct_236110->free_b2_228131;
    double c2_228132 =
           futhark_mc_segred_stage_1_parloop_struct_236110->free_c2_228132;
    struct memblock reduce_stage_1_tid_res_arr_mem_228505 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228505",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236110->free_reduce_stage_1_tid_res_arr_mem_228505,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_228507 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_228507",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236110->free_reduce_stage_1_tid_res_arr_mem_228507,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228509 = start;
    double x_228435;
    double x_228436;
    double x_228438;
    double x_228439;
    double local_acc_228510 = 0.0;
    double local_acc_228511 = 0.0;
    
    for (; iter_228509 < end; iter_228509++) {
        int64_t gtid_228434 = iter_228509;
        double x_228441;
        
        x_228441 = ((double *) mem_228053.mem)[gtid_228434];
        
        double x_228442;
        
        x_228442 = ((double *) mem_228077.mem)[gtid_228434];
        
        double x_228443;
        
        x_228443 = ((double *) mem_228076.mem)[gtid_228434];
        
        bool cond_228444 = sle64(x_227500, gtid_228434);
        double defunc_0_f_res_228445;
        
        if (cond_228444) {
            defunc_0_f_res_228445 = 0.0;
        } else {
            int64_t i_228446 = add64(x_228040, gtid_228434);
            double defunc_0_add_arg_228447;
            
            defunc_0_add_arg_228447 = ((double *) mem_218170.mem)[gtid_211295 *
                                                                  (defunc_0_f_res_203721 *
                                                                   n_p_203574) +
                                                                  gtid_227499 *
                                                                  defunc_0_f_res_203721 +
                                                                  i_228446];
            defunc_0_f_res_228445 = defunc_0_add_arg_228447;
        }
        
        double x_228448 = a12_228128 * x_228441;
        double y_228449 = b12_228129 * x_228442;
        double x_228450 = x_228448 + y_228449;
        double y_228451 = c12_228130 * x_228443;
        double x_228452 = x_228450 + y_228451;
        double defunc_9_fit_fun_res_228453 = defunc_0_f_res_228445 * x_228452;
        double x_228454 = b12_228129 * x_228441;
        double y_228455 = b2_228131 * x_228442;
        double x_228456 = x_228454 + y_228455;
        double y_228457 = c2_228132 * x_228443;
        double x_228458 = x_228456 + y_228457;
        double defunc_9_slope_fun_res_228459 = defunc_0_f_res_228445 * x_228458;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_228435 = local_acc_228510;
        }
        // Load next params
        {
            x_228436 = defunc_9_fit_fun_res_228453;
        }
        // Red body
        {
            double defunc_1_op_res_228437 = x_228435 + x_228436;
            
            local_acc_228510 = defunc_1_op_res_228437;
        }
        // Load accum params
        {
            x_228438 = local_acc_228511;
        }
        // Load next params
        {
            x_228439 = defunc_9_slope_fun_res_228459;
        }
        // Red body
        {
            double defunc_1_op_res_228440 = x_228438 + x_228439;
            
            local_acc_228511 = defunc_1_op_res_228440;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_228505.mem)[flat_tid_228433] =
        local_acc_228510;
    ((double *) reduce_stage_1_tid_res_arr_mem_228507.mem)[flat_tid_228433] =
        local_acc_228511;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236111_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236111_end -
                 futhark_mc_segred_stage_1_parloop_236111_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236111_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236111_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236111_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236107(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228433 = tid;
    int num_tasks_228504 = info.nsubtasks;
    struct futhark_mc_task_236106 *futhark_mc_task_236106 =
                                  (struct futhark_mc_task_236106 *) args;
    struct futhark_context *ctx = futhark_mc_task_236106->ctx;
    uint64_t futhark_mc_segred_task_236107_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236107_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236106->free_n_p_203574;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236106->free_defunc_0_f_res_203721;
    int64_t gtid_211295 = futhark_mc_task_236106->free_gtid_211295;
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236106->free_mem_218170,
                                  .size =0, .references =NULL};
    int64_t gtid_227499 = futhark_mc_task_236106->free_gtid_227499;
    int64_t x_227500 = futhark_mc_task_236106->free_x_227500;
    int64_t x_228040 = futhark_mc_task_236106->free_x_228040;
    struct memblock mem_228053 = {.desc ="mem_228053", .mem =
                                  futhark_mc_task_236106->free_mem_228053,
                                  .size =0, .references =NULL};
    struct memblock mem_228076 = {.desc ="mem_228076", .mem =
                                  futhark_mc_task_236106->free_mem_228076,
                                  .size =0, .references =NULL};
    struct memblock mem_228077 = {.desc ="mem_228077", .mem =
                                  futhark_mc_task_236106->free_mem_228077,
                                  .size =0, .references =NULL};
    double a12_228128 = futhark_mc_task_236106->free_a12_228128;
    double b12_228129 = futhark_mc_task_236106->free_b12_228129;
    double c12_228130 = futhark_mc_task_236106->free_c12_228130;
    double b2_228131 = futhark_mc_task_236106->free_b2_228131;
    double c2_228132 = futhark_mc_task_236106->free_c2_228132;
    double defunc_2_reduce_res_228133 =
           *futhark_mc_task_236106->retval_defunc_2_reduce_res_228133;
    double defunc_2_reduce_res_228134 =
           *futhark_mc_task_236106->retval_defunc_2_reduce_res_228134;
    size_t reduce_stage_1_tid_res_arr_mem_228505_cached_sizze_236108 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228505 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_228507_cached_sizze_236109 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_228507 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_228505_cached_sizze_236108 <
        (size_t) ((int64_t) 8 * num_tasks_228504)) {
        reduce_stage_1_tid_res_arr_mem_228505 =
            realloc(reduce_stage_1_tid_res_arr_mem_228505, (int64_t) 8 *
                    num_tasks_228504);
        reduce_stage_1_tid_res_arr_mem_228505_cached_sizze_236108 =
            (int64_t) 8 * num_tasks_228504;
    }
    if (reduce_stage_1_tid_res_arr_mem_228507_cached_sizze_236109 <
        (size_t) ((int64_t) 8 * num_tasks_228504)) {
        reduce_stage_1_tid_res_arr_mem_228507 =
            realloc(reduce_stage_1_tid_res_arr_mem_228507, (int64_t) 8 *
                    num_tasks_228504);
        reduce_stage_1_tid_res_arr_mem_228507_cached_sizze_236109 =
            (int64_t) 8 * num_tasks_228504;
    }
    
    int64_t iter_228509;
    struct futhark_mc_segred_stage_1_parloop_struct_236110
    futhark_mc_segred_stage_1_parloop_struct_236110;
    
    futhark_mc_segred_stage_1_parloop_struct_236110.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_n_p_203574 =
        n_p_203574;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_gtid_211295 =
        gtid_211295;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_mem_218170 =
        mem_218170.mem;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_gtid_227499 =
        gtid_227499;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_x_227500 = x_227500;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_x_228040 = x_228040;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_mem_228053 =
        mem_228053.mem;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_mem_228076 =
        mem_228076.mem;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_mem_228077 =
        mem_228077.mem;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_a12_228128 =
        a12_228128;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_b12_228129 =
        b12_228129;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_c12_228130 =
        c12_228130;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_b2_228131 = b2_228131;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_c2_228132 = c2_228132;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_reduce_stage_1_tid_res_arr_mem_228505 =
        reduce_stage_1_tid_res_arr_mem_228505;
    futhark_mc_segred_stage_1_parloop_struct_236110.free_reduce_stage_1_tid_res_arr_mem_228507 =
        reduce_stage_1_tid_res_arr_mem_228507;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236111_task;
    
    futhark_mc_segred_stage_1_parloop_236111_task.name =
        "futhark_mc_segred_stage_1_parloop_236111";
    futhark_mc_segred_stage_1_parloop_236111_task.fn =
        futhark_mc_segred_stage_1_parloop_236111;
    futhark_mc_segred_stage_1_parloop_236111_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236110;
    futhark_mc_segred_stage_1_parloop_236111_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236111_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236111_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236111_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236111_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236111_task);
    
    if (futhark_mc_segred_stage_1_parloop_236111_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236111_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236111_total_end -
                 futhark_mc_segred_stage_1_parloop_236111_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236111_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236111_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236111_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_228133 = 0.0;
        defunc_2_reduce_res_228134 = 0.0;
    }
    
    double x_228512;
    double x_228513;
    double x_228515;
    double x_228516;
    
    for (int32_t i_228518 = 0; i_228518 < num_tasks_228504; i_228518++) {
        flat_tid_228433 = i_228518;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_228512 = defunc_2_reduce_res_228133;
            }
            // load next params
            {
                x_228513 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228505)[flat_tid_228433];
            }
            // red body
            {
                double defunc_1_op_res_228514 = x_228512 + x_228513;
                
                defunc_2_reduce_res_228133 = defunc_1_op_res_228514;
            }
            // load acc params
            {
                x_228515 = defunc_2_reduce_res_228134;
            }
            // load next params
            {
                x_228516 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_228507)[flat_tid_228433];
            }
            // red body
            {
                double defunc_1_op_res_228517 = x_228515 + x_228516;
                
                defunc_2_reduce_res_228134 = defunc_1_op_res_228517;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_228505);
        free(reduce_stage_1_tid_res_arr_mem_228507);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236107_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236107_end -
                 futhark_mc_segred_task_236107_start;
        
        ctx->futhark_mc_segred_task_236107_runs[tid]++;
        ctx->futhark_mc_segred_task_236107_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236107_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236106->retval_defunc_2_reduce_res_228133 =
            defunc_2_reduce_res_228133;
        *futhark_mc_task_236106->retval_defunc_2_reduce_res_228134 =
            defunc_2_reduce_res_228134;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236088(void *args, int64_t start,
                                            int64_t end, int flat_tid_228038,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236087
    *futhark_mc_segmap_parloop_struct_236087 =
    (struct futhark_mc_segmap_parloop_struct_236087 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236087->ctx;
    uint64_t futhark_mc_segmap_parloop_236088_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236088_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236087->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236087->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236087->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236087->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236087->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236087->free_s_n_m_203726;
    int64_t gtid_211295 =
            futhark_mc_segmap_parloop_struct_236087->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236087->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236087->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236087->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236087->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236087->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 =
            futhark_mc_segmap_parloop_struct_236087->free_bytes_218903;
    int64_t gtid_227499 =
            futhark_mc_segmap_parloop_struct_236087->free_gtid_227499;
    int64_t x_227500 = futhark_mc_segmap_parloop_struct_236087->free_x_227500;
    struct memblock mem_227501 = {.desc ="mem_227501", .mem =
                                  futhark_mc_segmap_parloop_struct_236087->free_mem_227501,
                                  .size =0, .references =NULL};
    struct memblock mem_227502 = {.desc ="mem_227502", .mem =
                                  futhark_mc_segmap_parloop_struct_236087->free_mem_227502,
                                  .size =0, .references =NULL};
    size_t mem_228052_cached_sizze_236089 = 0;
    unsigned char *mem_228052 = NULL;
    size_t mem_228053_cached_sizze_236090 = 0;
    unsigned char *mem_228053 = NULL;
    size_t mem_228076_cached_sizze_236091 = 0;
    unsigned char *mem_228076 = NULL;
    size_t mem_228077_cached_sizze_236092 = 0;
    unsigned char *mem_228077 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228381 = start;
    
    if (mem_228052_cached_sizze_236089 < (size_t) bytes_218903) {
        mem_228052 = realloc(mem_228052, bytes_218903);
        mem_228052_cached_sizze_236089 = bytes_218903;
    }
    if (mem_228053_cached_sizze_236090 < (size_t) bytes_218903) {
        mem_228053 = realloc(mem_228053, bytes_218903);
        mem_228053_cached_sizze_236090 = bytes_218903;
    }
    if (mem_228076_cached_sizze_236091 < (size_t) bytes_218903) {
        mem_228076 = realloc(mem_228076, bytes_218903);
        mem_228076_cached_sizze_236091 = bytes_218903;
    }
    if (mem_228077_cached_sizze_236092 < (size_t) bytes_218903) {
        mem_228077 = realloc(mem_228077, bytes_218903);
        mem_228077_cached_sizze_236092 = bytes_218903;
    }
    for (; iter_228381 < end; iter_228381++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228460 = s_n_m_203726;
        int64_t gtid_228039 = iter_228381;
        int64_t remnant_228461 = iter_228381 - gtid_228039;
        int64_t x_228040;
        
        x_228040 = ((int64_t *) mem_217828.mem)[gtid_211295 * (s_n_m_203726 *
                                                               n_p_203574) +
                                                gtid_227499 * s_n_m_203726 +
                                                gtid_228039];
        
        double x_228041;
        
        x_228041 = ((double *) mem_217833.mem)[gtid_211295 * (s_n_m_203726 *
                                                              n_p_203574) +
                                               gtid_227499 * s_n_m_203726 +
                                               gtid_228039];
        
        bool cond_228042 = gtid_228039 == (int64_t) 0;
        int64_t defunc_0_m_fun_res_228043;
        
        if (cond_228042) {
            defunc_0_m_fun_res_228043 = (int64_t) 0;
        } else {
            int64_t y_228382 = sub64(s_n_m_203726, (int64_t) 1);
            bool cond_228383 = gtid_228039 == y_228382;
            int64_t defunc_0_m_fun_res_f_res_228384;
            
            if (cond_228383) {
                int64_t defunc_0_m_fun_res_f_res_t_res_228385 =
                        sub64(pad_css_len_203722, (int64_t) 1);
                
                defunc_0_m_fun_res_f_res_228384 =
                    defunc_0_m_fun_res_f_res_t_res_228385;
            } else {
                int64_t x_228386 = sub64(gtid_228039, (int64_t) 1);
                int64_t x_228387 = mul64(jump_s_203581, x_228386);
                int64_t min_arg_228388 = add64((int64_t) 1, x_228387);
                int64_t min_res_228389 = smin64(defunc_0_f_res_203721,
                                                min_arg_228388);
                
                defunc_0_m_fun_res_f_res_228384 = min_res_228389;
            }
            defunc_0_m_fun_res_228043 = defunc_0_m_fun_res_f_res_228384;
        }
        
        int64_t flat_tid_228390 = (int64_t) 0;
        int32_t num_tasks_228462;
        struct futhark_mc_task_236093 futhark_mc_task_236093;
        
        futhark_mc_task_236093.ctx = ctx;
        futhark_mc_task_236093.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236093.free_q_s_203575 = q_s_203575;
        futhark_mc_task_236093.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236093.free_gtid_211295 = gtid_211295;
        futhark_mc_task_236093.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_236093.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_236093.free_gtid_227499 = gtid_227499;
        futhark_mc_task_236093.free_x_227500 = x_227500;
        futhark_mc_task_236093.free_x_228040 = x_228040;
        futhark_mc_task_236093.free_x_228041 = x_228041;
        futhark_mc_task_236093.free_defunc_0_m_fun_res_228043 =
            defunc_0_m_fun_res_228043;
        futhark_mc_task_236093.free_mem_228052 = mem_228052;
        futhark_mc_task_236093.free_mem_228053 = mem_228053;
        
        struct scheduler_segop futhark_mc_task_236093_task;
        
        futhark_mc_task_236093_task.args = &futhark_mc_task_236093;
        futhark_mc_task_236093_task.top_level_fn =
            futhark_mc_segmap_task_236094;
        futhark_mc_task_236093_task.name = "futhark_mc_segmap_task_236094";
        futhark_mc_task_236093_task.iterations = q_s_203575;
        futhark_mc_task_236093_task.task_time =
            &ctx->futhark_mc_segmap_task_236094_total_time;
        futhark_mc_task_236093_task.task_iter =
            &ctx->futhark_mc_segmap_task_236094_total_iter;
        futhark_mc_task_236093_task.sched = STATIC;
        futhark_mc_task_236093_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236094_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236093_task);
        
        if (futhark_mc_segmap_task_236094_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double defunc_2_reduce_res_228078;
        double defunc_2_reduce_res_228079;
        double defunc_2_reduce_res_228080;
        double defunc_2_reduce_res_228081;
        double defunc_2_reduce_res_228082;
        int64_t flat_tid_228410 = (int64_t) 0;
        int32_t num_tasks_228471;
        
        defunc_2_reduce_res_228078 = 0.0;
        defunc_2_reduce_res_228079 = 0.0;
        defunc_2_reduce_res_228080 = 0.0;
        defunc_2_reduce_res_228081 = 0.0;
        defunc_2_reduce_res_228082 = 0.0;
        
        struct futhark_mc_task_236097 futhark_mc_task_236097;
        
        futhark_mc_task_236097.ctx = ctx;
        futhark_mc_task_236097.free_mem_228052 = mem_228052;
        futhark_mc_task_236097.free_mem_228053 = mem_228053;
        futhark_mc_task_236097.retval_defunc_2_reduce_res_228078 =
            &defunc_2_reduce_res_228078;
        futhark_mc_task_236097.retval_defunc_2_reduce_res_228079 =
            &defunc_2_reduce_res_228079;
        futhark_mc_task_236097.retval_defunc_2_reduce_res_228080 =
            &defunc_2_reduce_res_228080;
        futhark_mc_task_236097.retval_defunc_2_reduce_res_228081 =
            &defunc_2_reduce_res_228081;
        futhark_mc_task_236097.retval_defunc_2_reduce_res_228082 =
            &defunc_2_reduce_res_228082;
        futhark_mc_task_236097.retval_mem_228076 = mem_228076;
        futhark_mc_task_236097.retval_mem_228077 = mem_228077;
        
        struct scheduler_segop futhark_mc_task_236097_task;
        
        futhark_mc_task_236097_task.args = &futhark_mc_task_236097;
        futhark_mc_task_236097_task.top_level_fn =
            futhark_mc_segred_task_236098;
        futhark_mc_task_236097_task.name = "futhark_mc_segred_task_236098";
        futhark_mc_task_236097_task.iterations = q_s_203575;
        futhark_mc_task_236097_task.task_time =
            &ctx->futhark_mc_segred_task_236098_total_time;
        futhark_mc_task_236097_task.task_iter =
            &ctx->futhark_mc_segred_task_236098_total_iter;
        futhark_mc_task_236097_task.sched = STATIC;
        futhark_mc_task_236097_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236098_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236097_task);
        
        if (futhark_mc_segred_task_236098_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_228108 = defunc_2_reduce_res_228080 *
               defunc_2_reduce_res_228082;
        double y_228109 = defunc_2_reduce_res_228081 *
               defunc_2_reduce_res_228081;
        double a12_228110 = x_228108 - y_228109;
        double x_228111 = defunc_2_reduce_res_228080 *
               defunc_2_reduce_res_228081;
        double y_228112 = defunc_2_reduce_res_228079 *
               defunc_2_reduce_res_228082;
        double b12_228113 = x_228111 - y_228112;
        double x_228114 = defunc_2_reduce_res_228079 *
               defunc_2_reduce_res_228081;
        double y_228115 = defunc_2_reduce_res_228080 *
               defunc_2_reduce_res_228080;
        double c12_228116 = x_228114 - y_228115;
        double x_228117 = defunc_2_reduce_res_228078 *
               defunc_2_reduce_res_228082;
        double b2_228118 = x_228117 - y_228115;
        double x_228119 = defunc_2_reduce_res_228079 *
               defunc_2_reduce_res_228080;
        double y_228120 = defunc_2_reduce_res_228078 *
               defunc_2_reduce_res_228081;
        double c2_228121 = x_228119 - y_228120;
        double x_228122 = defunc_2_reduce_res_228078 * a12_228110;
        double y_228123 = defunc_2_reduce_res_228079 * b12_228113;
        double x_228124 = x_228122 + y_228123;
        double y_228125 = defunc_2_reduce_res_228080 * c12_228116;
        double y_228126 = x_228124 + y_228125;
        double det_228127 = 1.0 / y_228126;
        double a12_228128 = a12_228110 * det_228127;
        double b12_228129 = b12_228113 * det_228127;
        double c12_228130 = c12_228116 * det_228127;
        double b2_228131 = b2_228118 * det_228127;
        double c2_228132 = c2_228121 * det_228127;
        double defunc_2_reduce_res_228133;
        double defunc_2_reduce_res_228134;
        int64_t flat_tid_228433 = (int64_t) 0;
        int32_t num_tasks_228504;
        
        defunc_2_reduce_res_228133 = 0.0;
        defunc_2_reduce_res_228134 = 0.0;
        
        struct futhark_mc_task_236106 futhark_mc_task_236106;
        
        futhark_mc_task_236106.ctx = ctx;
        futhark_mc_task_236106.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236106.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236106.free_gtid_211295 = gtid_211295;
        futhark_mc_task_236106.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_236106.free_gtid_227499 = gtid_227499;
        futhark_mc_task_236106.free_x_227500 = x_227500;
        futhark_mc_task_236106.free_x_228040 = x_228040;
        futhark_mc_task_236106.free_mem_228053 = mem_228053;
        futhark_mc_task_236106.free_mem_228076 = mem_228076;
        futhark_mc_task_236106.free_mem_228077 = mem_228077;
        futhark_mc_task_236106.free_a12_228128 = a12_228128;
        futhark_mc_task_236106.free_b12_228129 = b12_228129;
        futhark_mc_task_236106.free_c12_228130 = c12_228130;
        futhark_mc_task_236106.free_b2_228131 = b2_228131;
        futhark_mc_task_236106.free_c2_228132 = c2_228132;
        futhark_mc_task_236106.retval_defunc_2_reduce_res_228133 =
            &defunc_2_reduce_res_228133;
        futhark_mc_task_236106.retval_defunc_2_reduce_res_228134 =
            &defunc_2_reduce_res_228134;
        
        struct scheduler_segop futhark_mc_task_236106_task;
        
        futhark_mc_task_236106_task.args = &futhark_mc_task_236106;
        futhark_mc_task_236106_task.top_level_fn =
            futhark_mc_segred_task_236107;
        futhark_mc_task_236106_task.name = "futhark_mc_segred_task_236107";
        futhark_mc_task_236106_task.iterations = q_s_203575;
        futhark_mc_task_236106_task.task_time =
            &ctx->futhark_mc_segred_task_236107_total_time;
        futhark_mc_task_236106_task.task_iter =
            &ctx->futhark_mc_segred_task_236107_total_iter;
        futhark_mc_task_236106_task.sched = STATIC;
        futhark_mc_task_236106_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236107_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236106_task);
        
        if (futhark_mc_segred_task_236107_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_227501.mem)[gtid_228039] = defunc_2_reduce_res_228133;
        ((double *) mem_227502.mem)[gtid_228039] = defunc_2_reduce_res_228134;
    }
    
  cleanup:
    { }
    free(mem_228052);
    free(mem_228053);
    free(mem_228076);
    free(mem_228077);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236088_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236088_end -
                 futhark_mc_segmap_parloop_236088_start;
        
        ctx->futhark_mc_segmap_parloop_236088_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236088_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236088_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236086(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228038 = tid;
    int num_tasks_228290 = info.nsubtasks;
    struct futhark_mc_task_236078 *futhark_mc_task_236078 =
                                  (struct futhark_mc_task_236078 *) args;
    struct futhark_context *ctx = futhark_mc_task_236078->ctx;
    uint64_t futhark_mc_segmap_nested_task_236086_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236086_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236078->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236078->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236078->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236078->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236078->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236078->free_s_n_m_203726;
    int64_t gtid_211295 = futhark_mc_task_236078->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236078->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236078->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236078->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236078->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236078->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 = futhark_mc_task_236078->free_bytes_218903;
    int64_t gtid_227499 = futhark_mc_task_236078->free_gtid_227499;
    int64_t x_227500 = futhark_mc_task_236078->free_x_227500;
    struct memblock mem_227501 = {.desc ="mem_227501", .mem =
                                  futhark_mc_task_236078->free_mem_227501,
                                  .size =0, .references =NULL};
    struct memblock mem_227502 = {.desc ="mem_227502", .mem =
                                  futhark_mc_task_236078->free_mem_227502,
                                  .size =0, .references =NULL};
    int64_t iter_228381;
    struct futhark_mc_segmap_parloop_struct_236087
    futhark_mc_segmap_parloop_struct_236087;
    
    futhark_mc_segmap_parloop_struct_236087.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236087.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236087.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236087.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236087.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236087.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236087.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236087.free_gtid_211295 = gtid_211295;
    futhark_mc_segmap_parloop_struct_236087.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236087.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236087.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236087.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236087.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236087.free_bytes_218903 = bytes_218903;
    futhark_mc_segmap_parloop_struct_236087.free_gtid_227499 = gtid_227499;
    futhark_mc_segmap_parloop_struct_236087.free_x_227500 = x_227500;
    futhark_mc_segmap_parloop_struct_236087.free_mem_227501 = mem_227501.mem;
    futhark_mc_segmap_parloop_struct_236087.free_mem_227502 = mem_227502.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236088_task;
    
    futhark_mc_segmap_parloop_236088_task.name =
        "futhark_mc_segmap_parloop_236088";
    futhark_mc_segmap_parloop_236088_task.fn = futhark_mc_segmap_parloop_236088;
    futhark_mc_segmap_parloop_236088_task.args =
        &futhark_mc_segmap_parloop_struct_236087;
    futhark_mc_segmap_parloop_236088_task.iterations = iterations;
    futhark_mc_segmap_parloop_236088_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236088_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236088_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236088_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236088_task);
    
    if (futhark_mc_segmap_parloop_236088_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236088_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236088_total_end -
                 futhark_mc_segmap_parloop_236088_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236088_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236088_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236088_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236086_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236086_end -
                 futhark_mc_segmap_nested_task_236086_start;
        
        ctx->futhark_mc_segmap_nested_task_236086_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236086_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236086_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236075(void *args, int64_t start,
                                            int64_t end, int flat_tid_227498,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236074
    *futhark_mc_segmap_parloop_struct_236074 =
    (struct futhark_mc_segmap_parloop_struct_236074 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236074->ctx;
    uint64_t futhark_mc_segmap_parloop_236075_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236075_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236074->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236074->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236074->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236074->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236074->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236074->free_s_n_m_203726;
    int64_t gtid_211295 =
            futhark_mc_segmap_parloop_struct_236074->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236074->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_236074->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_236074->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236074->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236074->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236074->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236074->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 =
            futhark_mc_segmap_parloop_struct_236074->free_bytes_218903;
    struct memblock mem_219073 = {.desc ="mem_219073", .mem =
                                  futhark_mc_segmap_parloop_struct_236074->free_mem_219073,
                                  .size =0, .references =NULL};
    struct memblock mem_219077 = {.desc ="mem_219077", .mem =
                                  futhark_mc_segmap_parloop_struct_236074->free_mem_219077,
                                  .size =0, .references =NULL};
    size_t mem_227501_cached_sizze_236076 = 0;
    unsigned char *mem_227501 = NULL;
    size_t mem_227502_cached_sizze_236077 = 0;
    unsigned char *mem_227502 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228037 = start;
    
    if (mem_227501_cached_sizze_236076 < (size_t) bytes_217663) {
        mem_227501 = realloc(mem_227501, bytes_217663);
        mem_227501_cached_sizze_236076 = bytes_217663;
    }
    if (mem_227502_cached_sizze_236077 < (size_t) bytes_217663) {
        mem_227502 = realloc(mem_227502, bytes_217663);
        mem_227502_cached_sizze_236077 = bytes_217663;
    }
    for (; iter_228037 < end; iter_228037++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228288 = n_p_203574;
        int64_t gtid_227499 = iter_228037;
        int64_t remnant_228289 = iter_228037 - gtid_227499;
        int64_t x_227500;
        
        x_227500 = ((int64_t *) mem_217658.mem)[gtid_211295 * n_p_203574 +
                                                gtid_227499];
        
        int64_t flat_tid_228162 = (int64_t) 0;
        int32_t num_tasks_228290;
        int64_t flat_tid_228038 = (int64_t) 0;
        struct futhark_mc_task_236078 futhark_mc_task_236078;
        
        futhark_mc_task_236078.ctx = ctx;
        futhark_mc_task_236078.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236078.free_q_s_203575 = q_s_203575;
        futhark_mc_task_236078.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_236078.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236078.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_236078.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_236078.free_gtid_211295 = gtid_211295;
        futhark_mc_task_236078.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_236078.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_236078.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_236078.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_236078.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_236078.free_bytes_218903 = bytes_218903;
        futhark_mc_task_236078.free_gtid_227499 = gtid_227499;
        futhark_mc_task_236078.free_x_227500 = x_227500;
        futhark_mc_task_236078.free_mem_227501 = mem_227501;
        futhark_mc_task_236078.free_mem_227502 = mem_227502;
        
        struct scheduler_segop futhark_mc_task_236078_task;
        
        futhark_mc_task_236078_task.args = &futhark_mc_task_236078;
        futhark_mc_task_236078_task.top_level_fn =
            futhark_mc_segmap_task_236079;
        futhark_mc_task_236078_task.name = "futhark_mc_segmap_task_236079";
        futhark_mc_task_236078_task.iterations = s_n_m_203726;
        futhark_mc_task_236078_task.task_time =
            &ctx->futhark_mc_segmap_task_236079_total_time;
        futhark_mc_task_236078_task.task_iter =
            &ctx->futhark_mc_segmap_task_236079_total_iter;
        futhark_mc_task_236078_task.sched = STATIC;
        futhark_mc_task_236078_task.nested_fn =
            futhark_mc_segmap_nested_task_236086;
        
        int futhark_mc_segmap_task_236079_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236078_task);
        
        if (futhark_mc_segmap_task_236079_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_219073.mem + gtid_227499 * s_n_m_203726 * (int64_t) 8,
                    mem_227501 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
        if (s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_219077.mem + gtid_227499 * s_n_m_203726 * (int64_t) 8,
                    mem_227502 + (int64_t) 0, s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_227501);
    free(mem_227502);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236075_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236075_end -
                 futhark_mc_segmap_parloop_236075_start;
        
        ctx->futhark_mc_segmap_parloop_236075_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236075_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236075_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236073(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_227498 = tid;
    int num_tasks_227895 = info.nsubtasks;
    struct futhark_mc_task_236063 *futhark_mc_task_236063 =
                                  (struct futhark_mc_task_236063 *) args;
    struct futhark_context *ctx = futhark_mc_task_236063->ctx;
    uint64_t futhark_mc_segmap_nested_task_236073_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236073_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236063->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236063->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236063->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236063->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236063->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236063->free_s_n_m_203726;
    int64_t gtid_211295 = futhark_mc_task_236063->free_gtid_211295;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236063->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_236063->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_236063->free_bytes_217663;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236063->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236063->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236063->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236063->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 = futhark_mc_task_236063->free_bytes_218903;
    struct memblock mem_219073 = {.desc ="mem_219073", .mem =
                                  futhark_mc_task_236063->free_mem_219073,
                                  .size =0, .references =NULL};
    struct memblock mem_219077 = {.desc ="mem_219077", .mem =
                                  futhark_mc_task_236063->free_mem_219077,
                                  .size =0, .references =NULL};
    int64_t iter_228037;
    struct futhark_mc_segmap_parloop_struct_236074
    futhark_mc_segmap_parloop_struct_236074;
    
    futhark_mc_segmap_parloop_struct_236074.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236074.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236074.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236074.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236074.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236074.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236074.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236074.free_gtid_211295 = gtid_211295;
    futhark_mc_segmap_parloop_struct_236074.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236074.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_236074.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_236074.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236074.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236074.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236074.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236074.free_bytes_218903 = bytes_218903;
    futhark_mc_segmap_parloop_struct_236074.free_mem_219073 = mem_219073.mem;
    futhark_mc_segmap_parloop_struct_236074.free_mem_219077 = mem_219077.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236075_task;
    
    futhark_mc_segmap_parloop_236075_task.name =
        "futhark_mc_segmap_parloop_236075";
    futhark_mc_segmap_parloop_236075_task.fn = futhark_mc_segmap_parloop_236075;
    futhark_mc_segmap_parloop_236075_task.args =
        &futhark_mc_segmap_parloop_struct_236074;
    futhark_mc_segmap_parloop_236075_task.iterations = iterations;
    futhark_mc_segmap_parloop_236075_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236075_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236075_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236075_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236075_task);
    
    if (futhark_mc_segmap_parloop_236075_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236075_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236075_total_end -
                 futhark_mc_segmap_parloop_236075_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236075_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236075_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236075_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236073_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236073_end -
                 futhark_mc_segmap_nested_task_236073_start;
        
        ctx->futhark_mc_segmap_nested_task_236073_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236073_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236073_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236060(void *args, int64_t start,
                                            int64_t end, int flat_tid_211294,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236059
    *futhark_mc_segmap_parloop_struct_236059 =
    (struct futhark_mc_segmap_parloop_struct_236059 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236059->ctx;
    uint64_t futhark_mc_segmap_parloop_236060_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236060_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236059->free_n_p_203574;
    int64_t q_s_203575 =
            futhark_mc_segmap_parloop_struct_236059->free_q_s_203575;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236059->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236059->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236059->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236059->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236059->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_segmap_parloop_struct_236059->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_segmap_parloop_struct_236059->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 =
            futhark_mc_segmap_parloop_struct_236059->free_bytes_217663;
    int64_t bytes_217715 =
            futhark_mc_segmap_parloop_struct_236059->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_segmap_parloop_struct_236059->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_segmap_parloop_struct_236059->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_segmap_parloop_struct_236059->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_segmap_parloop_struct_236059->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 =
            futhark_mc_segmap_parloop_struct_236059->free_bytes_218903;
    struct memblock mem_219230 = {.desc ="mem_219230", .mem =
                                  futhark_mc_segmap_parloop_struct_236059->free_mem_219230,
                                  .size =0, .references =NULL};
    struct memblock mem_219235 = {.desc ="mem_219235", .mem =
                                  futhark_mc_segmap_parloop_struct_236059->free_mem_219235,
                                  .size =0, .references =NULL};
    size_t mem_219073_cached_sizze_236061 = 0;
    unsigned char *mem_219073 = NULL;
    size_t mem_219077_cached_sizze_236062 = 0;
    unsigned char *mem_219077 = NULL;
    int64_t iterations = end - start;
    int64_t iter_227497 = start;
    
    if (mem_219073_cached_sizze_236061 < (size_t) bytes_217715) {
        mem_219073 = realloc(mem_219073, bytes_217715);
        mem_219073_cached_sizze_236061 = bytes_217715;
    }
    if (mem_219077_cached_sizze_236062 < (size_t) bytes_217715) {
        mem_219077 = realloc(mem_219077, bytes_217715);
        mem_219077_cached_sizze_236062 = bytes_217715;
    }
    for (; iter_227497 < end; iter_227497++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_227893 = partition_sizze_203667;
        int64_t gtid_211295 = iter_227497;
        int64_t remnant_227894 = iter_227497 - gtid_211295;
        int64_t flat_tid_227755 = (int64_t) 0;
        int32_t num_tasks_227895;
        int64_t flat_tid_227498 = (int64_t) 0;
        struct futhark_mc_task_236063 futhark_mc_task_236063;
        
        futhark_mc_task_236063.ctx = ctx;
        futhark_mc_task_236063.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236063.free_q_s_203575 = q_s_203575;
        futhark_mc_task_236063.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_236063.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236063.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_236063.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_236063.free_gtid_211295 = gtid_211295;
        futhark_mc_task_236063.free_mem_217654 = mem_217654.mem;
        futhark_mc_task_236063.free_mem_217658 = mem_217658.mem;
        futhark_mc_task_236063.free_bytes_217663 = bytes_217663;
        futhark_mc_task_236063.free_mem_217828 = mem_217828.mem;
        futhark_mc_task_236063.free_mem_217833 = mem_217833.mem;
        futhark_mc_task_236063.free_mem_218170 = mem_218170.mem;
        futhark_mc_task_236063.free_mem_218175 = mem_218175.mem;
        futhark_mc_task_236063.free_bytes_218903 = bytes_218903;
        futhark_mc_task_236063.free_mem_219073 = mem_219073;
        futhark_mc_task_236063.free_mem_219077 = mem_219077;
        
        struct scheduler_segop futhark_mc_task_236063_task;
        
        futhark_mc_task_236063_task.args = &futhark_mc_task_236063;
        futhark_mc_task_236063_task.top_level_fn =
            futhark_mc_segmap_task_236064;
        futhark_mc_task_236063_task.name = "futhark_mc_segmap_task_236064";
        futhark_mc_task_236063_task.iterations = n_p_203574;
        futhark_mc_task_236063_task.task_time =
            &ctx->futhark_mc_segmap_task_236064_total_time;
        futhark_mc_task_236063_task.task_iter =
            &ctx->futhark_mc_segmap_task_236064_total_iter;
        futhark_mc_task_236063_task.sched = STATIC;
        futhark_mc_task_236063_task.nested_fn =
            futhark_mc_segmap_nested_task_236073;
        
        int futhark_mc_segmap_task_236064_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236063_task);
        
        if (futhark_mc_segmap_task_236064_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_219230.mem + gtid_211295 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_219073 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
        if (n_p_203574 * s_n_m_203726 * (int64_t) 8 > 0)
            memmove(mem_219235.mem + gtid_211295 * (s_n_m_203726 * n_p_203574) *
                    (int64_t) 8, mem_219077 + (int64_t) 0, n_p_203574 *
                    s_n_m_203726 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219073);
    free(mem_219077);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236060_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236060_end -
                 futhark_mc_segmap_parloop_236060_start;
        
        ctx->futhark_mc_segmap_parloop_236060_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236060_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236060_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236058(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211294 = tid;
    int num_tasks_227347 = info.nsubtasks;
    struct futhark_mc_task_236048 *futhark_mc_task_236048 =
                                  (struct futhark_mc_task_236048 *) args;
    struct futhark_context *ctx = futhark_mc_task_236048->ctx;
    uint64_t futhark_mc_segmap_nested_task_236058_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236058_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236048->free_n_p_203574;
    int64_t q_s_203575 = futhark_mc_task_236048->free_q_s_203575;
    int64_t jump_s_203581 = futhark_mc_task_236048->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236048->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236048->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236048->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236048->free_s_n_m_203726;
    struct memblock mem_217654 = {.desc ="mem_217654", .mem =
                                  futhark_mc_task_236048->free_mem_217654,
                                  .size =0, .references =NULL};
    struct memblock mem_217658 = {.desc ="mem_217658", .mem =
                                  futhark_mc_task_236048->free_mem_217658,
                                  .size =0, .references =NULL};
    int64_t bytes_217663 = futhark_mc_task_236048->free_bytes_217663;
    int64_t bytes_217715 = futhark_mc_task_236048->free_bytes_217715;
    struct memblock mem_217828 = {.desc ="mem_217828", .mem =
                                  futhark_mc_task_236048->free_mem_217828,
                                  .size =0, .references =NULL};
    struct memblock mem_217833 = {.desc ="mem_217833", .mem =
                                  futhark_mc_task_236048->free_mem_217833,
                                  .size =0, .references =NULL};
    struct memblock mem_218170 = {.desc ="mem_218170", .mem =
                                  futhark_mc_task_236048->free_mem_218170,
                                  .size =0, .references =NULL};
    struct memblock mem_218175 = {.desc ="mem_218175", .mem =
                                  futhark_mc_task_236048->free_mem_218175,
                                  .size =0, .references =NULL};
    int64_t bytes_218903 = futhark_mc_task_236048->free_bytes_218903;
    struct memblock mem_219230 = {.desc ="mem_219230", .mem =
                                  futhark_mc_task_236048->free_mem_219230,
                                  .size =0, .references =NULL};
    struct memblock mem_219235 = {.desc ="mem_219235", .mem =
                                  futhark_mc_task_236048->free_mem_219235,
                                  .size =0, .references =NULL};
    int64_t iter_227497;
    struct futhark_mc_segmap_parloop_struct_236059
    futhark_mc_segmap_parloop_struct_236059;
    
    futhark_mc_segmap_parloop_struct_236059.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236059.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236059.free_q_s_203575 = q_s_203575;
    futhark_mc_segmap_parloop_struct_236059.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236059.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236059.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236059.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236059.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236059.free_mem_217654 = mem_217654.mem;
    futhark_mc_segmap_parloop_struct_236059.free_mem_217658 = mem_217658.mem;
    futhark_mc_segmap_parloop_struct_236059.free_bytes_217663 = bytes_217663;
    futhark_mc_segmap_parloop_struct_236059.free_bytes_217715 = bytes_217715;
    futhark_mc_segmap_parloop_struct_236059.free_mem_217828 = mem_217828.mem;
    futhark_mc_segmap_parloop_struct_236059.free_mem_217833 = mem_217833.mem;
    futhark_mc_segmap_parloop_struct_236059.free_mem_218170 = mem_218170.mem;
    futhark_mc_segmap_parloop_struct_236059.free_mem_218175 = mem_218175.mem;
    futhark_mc_segmap_parloop_struct_236059.free_bytes_218903 = bytes_218903;
    futhark_mc_segmap_parloop_struct_236059.free_mem_219230 = mem_219230.mem;
    futhark_mc_segmap_parloop_struct_236059.free_mem_219235 = mem_219235.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236060_task;
    
    futhark_mc_segmap_parloop_236060_task.name =
        "futhark_mc_segmap_parloop_236060";
    futhark_mc_segmap_parloop_236060_task.fn = futhark_mc_segmap_parloop_236060;
    futhark_mc_segmap_parloop_236060_task.args =
        &futhark_mc_segmap_parloop_struct_236059;
    futhark_mc_segmap_parloop_236060_task.iterations = iterations;
    futhark_mc_segmap_parloop_236060_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236060_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236060_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236060_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236060_task);
    
    if (futhark_mc_segmap_parloop_236060_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236060_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236060_total_end -
                 futhark_mc_segmap_parloop_236060_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236060_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236060_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236060_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236058_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236058_end -
                 futhark_mc_segmap_nested_task_236058_start;
        
        ctx->futhark_mc_segmap_nested_task_236058_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236058_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236058_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236112 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_ext_mem_219240;
    unsigned char *free_ext_mem_219241;
    int64_t free_bytes_219243;
    int64_t free_bytes_219262;
    unsigned char *free_mem_219312;
};
struct futhark_mc_segmap_parloop_struct_236114 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_ext_mem_219240;
    unsigned char *free_ext_mem_219241;
    int64_t free_bytes_219262;
    unsigned char *free_mem_219312;
};
static int futhark_mc_segmap_parloop_236115(void *args, int64_t start,
                                            int64_t end, int flat_tid_211679,
                                            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_p_203574 =
            futhark_mc_segmap_parloop_struct_236114->free_n_p_203574;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236114->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236114->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236114->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236114->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236114->free_s_n_m_203726;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_segmap_parloop_struct_236114->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_segmap_parloop_struct_236114->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t bytes_219262 =
            futhark_mc_segmap_parloop_struct_236114->free_bytes_219262;
    struct memblock mem_219312 = {.desc ="mem_219312", .mem =
                                  futhark_mc_segmap_parloop_struct_236114->free_mem_219312,
                                  .size =0, .references =NULL};
    size_t mem_219267_cached_sizze_236116 = 0;
    unsigned char *mem_219267 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228520 = start;
    
    if (mem_219267_cached_sizze_236116 < (size_t) bytes_219262) {
        mem_219267 = realloc(mem_219267, bytes_219262);
        mem_219267_cached_sizze_236116 = bytes_219262;
    }
    for (; iter_228520 < end; iter_228520++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228606 = partition_sizze_203667;
        int64_t gtid_211680 = iter_228520;
        int64_t remnant_228607 = iter_228520 - gtid_211680;
        
        for (int64_t i_228521 = 0; i_228521 < n_p_203574; i_228521++) {
            for (int64_t i_228524 = 0; i_228524 < pad_css_len_203722;
                 i_228524++) {
                bool cond_228526 = i_228524 == (int64_t) 0;
                double defunc_0_f_res_228527;
                
                if (cond_228526) {
                    bool y_228528 = slt64((int64_t) 0, s_n_m_203726);
                    bool index_certs_228529;
                    
                    if (!y_228528) {
                        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_203726, "].",
                                      "-> #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_228530;
                    
                    head_res_228530 =
                        ((double *) ext_mem_219241.mem)[gtid_211680 *
                                                        (s_n_m_203726 *
                                                         n_p_203574) +
                                                        i_228521 *
                                                        s_n_m_203726];
                    defunc_0_f_res_228527 = head_res_228530;
                } else {
                    int64_t y_228531 = sub64(pad_css_len_203722, (int64_t) 1);
                    bool cond_228532 = i_228524 == y_228531;
                    double defunc_0_f_res_f_res_228533;
                    
                    if (cond_228532) {
                        int64_t i_228534 = sub64(s_n_m_203726, (int64_t) 1);
                        bool x_228535 = sle64((int64_t) 0, i_228534);
                        bool y_228536 = slt64(i_228534, s_n_m_203726);
                        bool bounds_check_228537 = x_228535 && y_228536;
                        bool index_certs_228538;
                        
                        if (!bounds_check_228537) {
                            ctx->error =
                                msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                          "Index [", (long long) i_228534,
                                          "] out of bounds for array of shape [",
                                          (long long) s_n_m_203726, "].",
                                          "-> #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_228539;
                        
                        last_res_228539 =
                            ((double *) ext_mem_219241.mem)[gtid_211680 *
                                                            (s_n_m_203726 *
                                                             n_p_203574) +
                                                            i_228521 *
                                                            s_n_m_203726 +
                                                            i_228534];
                        defunc_0_f_res_f_res_228533 = last_res_228539;
                    } else {
                        int64_t x_228540 = sub64(i_228524, (int64_t) 1);
                        bool zzero_228541 = jump_s_203581 == (int64_t) 0;
                        bool nonzzero_228542 = !zzero_228541;
                        bool nonzzero_cert_228543;
                        
                        if (!nonzzero_228542) {
                            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_228544 = sdiv64(x_228540, jump_s_203581);
                        int64_t m_v_228545 = add64((int64_t) 1, x_228544);
                        int64_t j_228546;
                        
                        if (cond_228526) {
                            j_228546 = (int64_t) 0;
                        } else {
                            int64_t y_228547 = sub64(s_n_m_203726, (int64_t) 1);
                            bool cond_228548 = m_v_228545 == y_228547;
                            int64_t j_f_res_228549;
                            
                            if (cond_228548) {
                                j_f_res_228549 = x_228544;
                            } else {
                                j_f_res_228549 = m_v_228545;
                            }
                            j_228546 = j_f_res_228549;
                        }
                        
                        bool cond_228550 = j_228546 == (int64_t) 0;
                        int64_t defunc_0_m_fun_res_228551;
                        
                        if (cond_228550) {
                            defunc_0_m_fun_res_228551 = (int64_t) 0;
                        } else {
                            int64_t y_228552 = sub64(s_n_m_203726, (int64_t) 1);
                            bool cond_228553 = j_228546 == y_228552;
                            int64_t defunc_0_m_fun_res_f_res_228554;
                            
                            if (cond_228553) {
                                defunc_0_m_fun_res_f_res_228554 = y_228531;
                            } else {
                                int64_t x_228555 = sub64(j_228546, (int64_t) 1);
                                int64_t x_228556 = mul64(jump_s_203581,
                                                         x_228555);
                                int64_t min_arg_228557 = add64((int64_t) 1,
                                                               x_228556);
                                int64_t min_res_228558 =
                                        smin64(defunc_0_f_res_203721,
                                               min_arg_228557);
                                
                                defunc_0_m_fun_res_f_res_228554 =
                                    min_res_228558;
                            }
                            defunc_0_m_fun_res_228551 =
                                defunc_0_m_fun_res_f_res_228554;
                        }
                        
                        int64_t defunc_0_m_fun_arg_228559 = add64((int64_t) 1,
                                                                  j_228546);
                        bool cond_228560 = defunc_0_m_fun_arg_228559 ==
                             (int64_t) 0;
                        int64_t defunc_0_m_fun_res_228561;
                        
                        if (cond_228560) {
                            defunc_0_m_fun_res_228561 = (int64_t) 0;
                        } else {
                            int64_t y_228562 = sub64(s_n_m_203726, (int64_t) 1);
                            bool cond_228563 = defunc_0_m_fun_arg_228559 ==
                                 y_228562;
                            int64_t defunc_0_m_fun_res_f_res_228564;
                            
                            if (cond_228563) {
                                defunc_0_m_fun_res_f_res_228564 = y_228531;
                            } else {
                                int64_t x_228565 = mul64(jump_s_203581,
                                                         j_228546);
                                int64_t min_arg_228566 = add64((int64_t) 1,
                                                               x_228565);
                                int64_t min_res_228567 =
                                        smin64(defunc_0_f_res_203721,
                                               min_arg_228566);
                                
                                defunc_0_m_fun_res_f_res_228564 =
                                    min_res_228567;
                            }
                            defunc_0_m_fun_res_228561 =
                                defunc_0_m_fun_res_f_res_228564;
                        }
                        
                        int64_t i64_arg_228568 =
                                sub64(defunc_0_m_fun_res_228561,
                                      defunc_0_m_fun_res_228551);
                        double i64_res_228569 = sitofp_i64_f64(i64_arg_228568);
                        int64_t i64_arg_228570 = sub64(i_228524,
                                                       defunc_0_m_fun_res_228551);
                        double i64_res_228571 = sitofp_i64_f64(i64_arg_228570);
                        double u_228572 = i64_res_228571 / i64_res_228569;
                        double u2_228573 = u_228572 * u_228572;
                        double u3_228574 = u_228572 * u2_228573;
                        double x_228575 = 2.0 * u3_228574;
                        double y_228576 = 3.0 * u2_228573;
                        double x_228577 = x_228575 - y_228576;
                        double x_228578 = 1.0 + x_228577;
                        bool x_228579 = sle64((int64_t) 0, j_228546);
                        bool y_228580 = slt64(j_228546, s_n_m_203726);
                        bool bounds_check_228581 = x_228579 && y_228580;
                        bool index_certs_228582;
                        
                        if (!bounds_check_228581) {
                            ctx->error =
                                msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                          "Index [", (long long) j_228546,
                                          "] out of bounds for array of shape [",
                                          (long long) s_n_m_203726, "].",
                                          "-> #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_228583;
                        
                        y_228583 = ((double *) ext_mem_219241.mem)[gtid_211680 *
                                                                   (s_n_m_203726 *
                                                                    n_p_203574) +
                                                                   i_228521 *
                                                                   s_n_m_203726 +
                                                                   j_228546];
                        
                        double x_228584 = x_228578 * y_228583;
                        double x_228585 = y_228576 - x_228575;
                        bool x_228586 = sle64((int64_t) 0,
                                              defunc_0_m_fun_arg_228559);
                        bool y_228587 = slt64(defunc_0_m_fun_arg_228559,
                                              s_n_m_203726);
                        bool bounds_check_228588 = x_228586 && y_228587;
                        bool index_certs_228589;
                        
                        if (!bounds_check_228588) {
                            ctx->error =
                                msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                          "Index [",
                                          (long long) defunc_0_m_fun_arg_228559,
                                          "] out of bounds for array of shape [",
                                          (long long) s_n_m_203726, "].",
                                          "-> #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_228590;
                        
                        y_228590 = ((double *) ext_mem_219241.mem)[gtid_211680 *
                                                                   (s_n_m_203726 *
                                                                    n_p_203574) +
                                                                   i_228521 *
                                                                   s_n_m_203726 +
                                                                   defunc_0_m_fun_arg_228559];
                        
                        double y_228591 = x_228585 * y_228590;
                        double x_228592 = x_228584 + y_228591;
                        double y_228593 = 2.0 * u2_228573;
                        double x_228594 = u3_228574 - y_228593;
                        double x_228595 = u_228572 + x_228594;
                        double y_228596;
                        
                        y_228596 = ((double *) ext_mem_219240.mem)[gtid_211680 *
                                                                   (s_n_m_203726 *
                                                                    n_p_203574) +
                                                                   i_228521 *
                                                                   s_n_m_203726 +
                                                                   j_228546];
                        
                        double x_228597 = x_228595 * y_228596;
                        double y_228598 = i64_res_228569 * x_228597;
                        double x_228599 = x_228592 + y_228598;
                        double x_228600 = u3_228574 - u2_228573;
                        double y_228601;
                        
                        y_228601 = ((double *) ext_mem_219240.mem)[gtid_211680 *
                                                                   (s_n_m_203726 *
                                                                    n_p_203574) +
                                                                   i_228521 *
                                                                   s_n_m_203726 +
                                                                   defunc_0_m_fun_arg_228559];
                        
                        double x_228602 = x_228600 * y_228601;
                        double y_228603 = i64_res_228569 * x_228602;
                        double defunc_4_interpolate_proc_res_228604 = x_228599 +
                               y_228603;
                        
                        defunc_0_f_res_f_res_228533 =
                            defunc_4_interpolate_proc_res_228604;
                    }
                    defunc_0_f_res_228527 = defunc_0_f_res_f_res_228533;
                }
                ((double *) mem_219267)[i_228521 * pad_css_len_203722 +
                                        i_228524] = defunc_0_f_res_228527;
            }
        }
        if (n_p_203574 * pad_css_len_203722 * (int64_t) 8 > 0)
            memmove(mem_219312.mem + gtid_211680 * (pad_css_len_203722 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_219267 + (int64_t) 0, n_p_203574 * pad_css_len_203722 *
                    (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219267);
    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_task_236113(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211679 = tid;
    int num_tasks_228519 = info.nsubtasks;
    struct futhark_mc_task_236112 *futhark_mc_task_236112 =
                                  (struct futhark_mc_task_236112 *) args;
    struct futhark_context *ctx = futhark_mc_task_236112->ctx;
    uint64_t futhark_mc_segmap_task_236113_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236113_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236112->free_n_p_203574;
    int64_t jump_s_203581 = futhark_mc_task_236112->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236112->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236112->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236112->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236112->free_s_n_m_203726;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_task_236112->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_task_236112->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t bytes_219243 = futhark_mc_task_236112->free_bytes_219243;
    int64_t bytes_219262 = futhark_mc_task_236112->free_bytes_219262;
    struct memblock mem_219312 = {.desc ="mem_219312", .mem =
                                  futhark_mc_task_236112->free_mem_219312,
                                  .size =0, .references =NULL};
    int64_t iter_228520;
    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_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236114.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236114.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236114.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236114.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236114.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236114.free_ext_mem_219240 =
        ext_mem_219240.mem;
    futhark_mc_segmap_parloop_struct_236114.free_ext_mem_219241 =
        ext_mem_219241.mem;
    futhark_mc_segmap_parloop_struct_236114.free_bytes_219262 = bytes_219262;
    futhark_mc_segmap_parloop_struct_236114.free_mem_219312 = mem_219312.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_task_236113_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236113_end -
                 futhark_mc_segmap_task_236113_start;
        
        ctx->futhark_mc_segmap_task_236113_runs[tid]++;
        ctx->futhark_mc_segmap_task_236113_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236113_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236118 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_jump_s_203581;
    int64_t free_partition_sizze_203667;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    unsigned char *free_ext_mem_219240;
    unsigned char *free_ext_mem_219241;
    int64_t free_bytes_219243;
    int64_t free_bytes_219262;
    unsigned char *free_mem_219312;
};
struct futhark_mc_task_236121 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211777;
    unsigned char *free_ext_mem_219240;
    unsigned char *free_ext_mem_219241;
    int64_t free_bytes_219243;
    unsigned char *free_mem_219263;
};
struct futhark_mc_segmap_parloop_struct_236123 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211777;
    unsigned char *free_ext_mem_219240;
    unsigned char *free_ext_mem_219241;
    int64_t free_bytes_219243;
    unsigned char *free_mem_219263;
};
static int futhark_mc_segmap_parloop_236124(void *args, int64_t start,
                                            int64_t end, int flat_tid_228696,
                                            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_p_203574 =
            futhark_mc_segmap_parloop_struct_236123->free_n_p_203574;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236123->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236123->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236123->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236123->free_s_n_m_203726;
    int64_t gtid_211777 =
            futhark_mc_segmap_parloop_struct_236123->free_gtid_211777;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_segmap_parloop_struct_236123->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_segmap_parloop_struct_236123->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t bytes_219243 =
            futhark_mc_segmap_parloop_struct_236123->free_bytes_219243;
    struct memblock mem_219263 = {.desc ="mem_219263", .mem =
                                  futhark_mc_segmap_parloop_struct_236123->free_mem_219263,
                                  .size =0, .references =NULL};
    size_t mem_228698_cached_sizze_236125 = 0;
    unsigned char *mem_228698 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228786 = start;
    
    if (mem_228698_cached_sizze_236125 < (size_t) bytes_219243) {
        mem_228698 = realloc(mem_228698, bytes_219243);
        mem_228698_cached_sizze_236125 = bytes_219243;
    }
    for (; iter_228786 < end; iter_228786++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228869 = n_p_203574;
        int64_t gtid_228697 = iter_228786;
        int64_t remnant_228870 = iter_228786 - gtid_228697;
        
        for (int64_t i_228787 = 0; i_228787 < pad_css_len_203722; i_228787++) {
            bool cond_228789 = i_228787 == (int64_t) 0;
            double defunc_0_f_res_228790;
            
            if (cond_228789) {
                bool y_228791 = slt64((int64_t) 0, s_n_m_203726);
                bool index_certs_228792;
                
                if (!y_228791) {
                    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_203726, "].",
                                  "-> #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_228793;
                
                head_res_228793 = ((double *) ext_mem_219241.mem)[gtid_211777 *
                                                                  (s_n_m_203726 *
                                                                   n_p_203574) +
                                                                  gtid_228697 *
                                                                  s_n_m_203726];
                defunc_0_f_res_228790 = head_res_228793;
            } else {
                int64_t y_228794 = sub64(pad_css_len_203722, (int64_t) 1);
                bool cond_228795 = i_228787 == y_228794;
                double defunc_0_f_res_f_res_228796;
                
                if (cond_228795) {
                    int64_t i_228797 = sub64(s_n_m_203726, (int64_t) 1);
                    bool x_228798 = sle64((int64_t) 0, i_228797);
                    bool y_228799 = slt64(i_228797, s_n_m_203726);
                    bool bounds_check_228800 = x_228798 && y_228799;
                    bool index_certs_228801;
                    
                    if (!bounds_check_228800) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) i_228797,
                                      "] out of bounds for array of shape [",
                                      (long long) s_n_m_203726, "].",
                                      "-> #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_228802;
                    
                    last_res_228802 =
                        ((double *) ext_mem_219241.mem)[gtid_211777 *
                                                        (s_n_m_203726 *
                                                         n_p_203574) +
                                                        gtid_228697 *
                                                        s_n_m_203726 +
                                                        i_228797];
                    defunc_0_f_res_f_res_228796 = last_res_228802;
                } else {
                    int64_t x_228803 = sub64(i_228787, (int64_t) 1);
                    bool zzero_228804 = jump_s_203581 == (int64_t) 0;
                    bool nonzzero_228805 = !zzero_228804;
                    bool nonzzero_cert_228806;
                    
                    if (!nonzzero_228805) {
                        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_228807 = sdiv64(x_228803, jump_s_203581);
                    int64_t m_v_228808 = add64((int64_t) 1, x_228807);
                    int64_t j_228809;
                    
                    if (cond_228789) {
                        j_228809 = (int64_t) 0;
                    } else {
                        int64_t y_228810 = sub64(s_n_m_203726, (int64_t) 1);
                        bool cond_228811 = m_v_228808 == y_228810;
                        int64_t j_f_res_228812;
                        
                        if (cond_228811) {
                            j_f_res_228812 = x_228807;
                        } else {
                            j_f_res_228812 = m_v_228808;
                        }
                        j_228809 = j_f_res_228812;
                    }
                    
                    bool cond_228813 = j_228809 == (int64_t) 0;
                    int64_t defunc_0_m_fun_res_228814;
                    
                    if (cond_228813) {
                        defunc_0_m_fun_res_228814 = (int64_t) 0;
                    } else {
                        int64_t y_228815 = sub64(s_n_m_203726, (int64_t) 1);
                        bool cond_228816 = j_228809 == y_228815;
                        int64_t defunc_0_m_fun_res_f_res_228817;
                        
                        if (cond_228816) {
                            defunc_0_m_fun_res_f_res_228817 = y_228794;
                        } else {
                            int64_t x_228818 = sub64(j_228809, (int64_t) 1);
                            int64_t x_228819 = mul64(jump_s_203581, x_228818);
                            int64_t min_arg_228820 = add64((int64_t) 1,
                                                           x_228819);
                            int64_t min_res_228821 =
                                    smin64(defunc_0_f_res_203721,
                                           min_arg_228820);
                            
                            defunc_0_m_fun_res_f_res_228817 = min_res_228821;
                        }
                        defunc_0_m_fun_res_228814 =
                            defunc_0_m_fun_res_f_res_228817;
                    }
                    
                    int64_t defunc_0_m_fun_arg_228822 = add64((int64_t) 1,
                                                              j_228809);
                    bool cond_228823 = defunc_0_m_fun_arg_228822 == (int64_t) 0;
                    int64_t defunc_0_m_fun_res_228824;
                    
                    if (cond_228823) {
                        defunc_0_m_fun_res_228824 = (int64_t) 0;
                    } else {
                        int64_t y_228825 = sub64(s_n_m_203726, (int64_t) 1);
                        bool cond_228826 = defunc_0_m_fun_arg_228822 ==
                             y_228825;
                        int64_t defunc_0_m_fun_res_f_res_228827;
                        
                        if (cond_228826) {
                            defunc_0_m_fun_res_f_res_228827 = y_228794;
                        } else {
                            int64_t x_228828 = mul64(jump_s_203581, j_228809);
                            int64_t min_arg_228829 = add64((int64_t) 1,
                                                           x_228828);
                            int64_t min_res_228830 =
                                    smin64(defunc_0_f_res_203721,
                                           min_arg_228829);
                            
                            defunc_0_m_fun_res_f_res_228827 = min_res_228830;
                        }
                        defunc_0_m_fun_res_228824 =
                            defunc_0_m_fun_res_f_res_228827;
                    }
                    
                    int64_t i64_arg_228831 = sub64(defunc_0_m_fun_res_228824,
                                                   defunc_0_m_fun_res_228814);
                    double i64_res_228832 = sitofp_i64_f64(i64_arg_228831);
                    int64_t i64_arg_228833 = sub64(i_228787,
                                                   defunc_0_m_fun_res_228814);
                    double i64_res_228834 = sitofp_i64_f64(i64_arg_228833);
                    double u_228835 = i64_res_228834 / i64_res_228832;
                    double u2_228836 = u_228835 * u_228835;
                    double u3_228837 = u_228835 * u2_228836;
                    double x_228838 = 2.0 * u3_228837;
                    double y_228839 = 3.0 * u2_228836;
                    double x_228840 = x_228838 - y_228839;
                    double x_228841 = 1.0 + x_228840;
                    bool x_228842 = sle64((int64_t) 0, j_228809);
                    bool y_228843 = slt64(j_228809, s_n_m_203726);
                    bool bounds_check_228844 = x_228842 && y_228843;
                    bool index_certs_228845;
                    
                    if (!bounds_check_228844) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", (long long) j_228809,
                                      "] out of bounds for array of shape [",
                                      (long long) s_n_m_203726, "].",
                                      "-> #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_228846;
                    
                    y_228846 = ((double *) ext_mem_219241.mem)[gtid_211777 *
                                                               (s_n_m_203726 *
                                                                n_p_203574) +
                                                               gtid_228697 *
                                                               s_n_m_203726 +
                                                               j_228809];
                    
                    double x_228847 = x_228841 * y_228846;
                    double x_228848 = y_228839 - x_228838;
                    bool x_228849 = sle64((int64_t) 0,
                                          defunc_0_m_fun_arg_228822);
                    bool y_228850 = slt64(defunc_0_m_fun_arg_228822,
                                          s_n_m_203726);
                    bool bounds_check_228851 = x_228849 && y_228850;
                    bool index_certs_228852;
                    
                    if (!bounds_check_228851) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [",
                                      (long long) defunc_0_m_fun_arg_228822,
                                      "] out of bounds for array of shape [",
                                      (long long) s_n_m_203726, "].",
                                      "-> #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_228853;
                    
                    y_228853 = ((double *) ext_mem_219241.mem)[gtid_211777 *
                                                               (s_n_m_203726 *
                                                                n_p_203574) +
                                                               gtid_228697 *
                                                               s_n_m_203726 +
                                                               defunc_0_m_fun_arg_228822];
                    
                    double y_228854 = x_228848 * y_228853;
                    double x_228855 = x_228847 + y_228854;
                    double y_228856 = 2.0 * u2_228836;
                    double x_228857 = u3_228837 - y_228856;
                    double x_228858 = u_228835 + x_228857;
                    double y_228859;
                    
                    y_228859 = ((double *) ext_mem_219240.mem)[gtid_211777 *
                                                               (s_n_m_203726 *
                                                                n_p_203574) +
                                                               gtid_228697 *
                                                               s_n_m_203726 +
                                                               j_228809];
                    
                    double x_228860 = x_228858 * y_228859;
                    double y_228861 = i64_res_228832 * x_228860;
                    double x_228862 = x_228855 + y_228861;
                    double x_228863 = u3_228837 - u2_228836;
                    double y_228864;
                    
                    y_228864 = ((double *) ext_mem_219240.mem)[gtid_211777 *
                                                               (s_n_m_203726 *
                                                                n_p_203574) +
                                                               gtid_228697 *
                                                               s_n_m_203726 +
                                                               defunc_0_m_fun_arg_228822];
                    
                    double x_228865 = x_228863 * y_228864;
                    double y_228866 = i64_res_228832 * x_228865;
                    double defunc_4_interpolate_proc_res_228867 = x_228862 +
                           y_228866;
                    
                    defunc_0_f_res_f_res_228796 =
                        defunc_4_interpolate_proc_res_228867;
                }
                defunc_0_f_res_228790 = defunc_0_f_res_f_res_228796;
            }
            ((double *) mem_228698)[i_228787] = defunc_0_f_res_228790;
        }
        if (pad_css_len_203722 * (int64_t) 8 > 0)
            memmove(mem_219263.mem + gtid_228697 * pad_css_len_203722 *
                    (int64_t) 8, mem_228698 + (int64_t) 0, pad_css_len_203722 *
                    (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_228698);
    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_task_236122(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228696 = tid;
    int num_tasks_228785 = info.nsubtasks;
    struct futhark_mc_task_236121 *futhark_mc_task_236121 =
                                  (struct futhark_mc_task_236121 *) args;
    struct futhark_context *ctx = futhark_mc_task_236121->ctx;
    uint64_t futhark_mc_segmap_task_236122_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236122_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236121->free_n_p_203574;
    int64_t jump_s_203581 = futhark_mc_task_236121->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236121->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236121->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236121->free_s_n_m_203726;
    int64_t gtid_211777 = futhark_mc_task_236121->free_gtid_211777;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_task_236121->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_task_236121->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t bytes_219243 = futhark_mc_task_236121->free_bytes_219243;
    struct memblock mem_219263 = {.desc ="mem_219263", .mem =
                                  futhark_mc_task_236121->free_mem_219263,
                                  .size =0, .references =NULL};
    int64_t iter_228786;
    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_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236123.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236123.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236123.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236123.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236123.free_gtid_211777 = gtid_211777;
    futhark_mc_segmap_parloop_struct_236123.free_ext_mem_219240 =
        ext_mem_219240.mem;
    futhark_mc_segmap_parloop_struct_236123.free_ext_mem_219241 =
        ext_mem_219241.mem;
    futhark_mc_segmap_parloop_struct_236123.free_bytes_219243 = bytes_219243;
    futhark_mc_segmap_parloop_struct_236123.free_mem_219263 = mem_219263.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_task_236122_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236122_end -
                 futhark_mc_segmap_task_236122_start;
        
        ctx->futhark_mc_segmap_task_236122_runs[tid]++;
        ctx->futhark_mc_segmap_task_236122_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236122_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236127 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211777;
    unsigned char *free_ext_mem_219240;
    unsigned char *free_ext_mem_219241;
    int64_t free_bytes_219243;
    unsigned char *free_mem_219263;
};
struct futhark_mc_task_236130 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211777;
    unsigned char *free_ext_mem_219240;
    unsigned char *free_ext_mem_219241;
    int64_t free_gtid_228612;
    unsigned char *free_mem_228613;
};
struct futhark_mc_segmap_parloop_struct_236132 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_jump_s_203581;
    int64_t free_defunc_0_f_res_203721;
    int64_t free_pad_css_len_203722;
    int64_t free_s_n_m_203726;
    int64_t free_gtid_211777;
    unsigned char *free_ext_mem_219240;
    unsigned char *free_ext_mem_219241;
    int64_t free_gtid_228612;
    unsigned char *free_mem_228613;
};
static int futhark_mc_segmap_parloop_236133(void *args, int64_t start,
                                            int64_t end, int flat_tid_228873,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236132
    *futhark_mc_segmap_parloop_struct_236132 =
    (struct futhark_mc_segmap_parloop_struct_236132 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236132->ctx;
    uint64_t futhark_mc_segmap_parloop_236133_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236133_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236132->free_n_p_203574;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236132->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236132->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236132->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236132->free_s_n_m_203726;
    int64_t gtid_211777 =
            futhark_mc_segmap_parloop_struct_236132->free_gtid_211777;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_segmap_parloop_struct_236132->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_segmap_parloop_struct_236132->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t gtid_228612 =
            futhark_mc_segmap_parloop_struct_236132->free_gtid_228612;
    struct memblock mem_228613 = {.desc ="mem_228613", .mem =
                                  futhark_mc_segmap_parloop_struct_236132->free_mem_228613,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_228957 = start;
    
    for (; iter_228957 < end; iter_228957++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229035 = pad_css_len_203722;
        int64_t gtid_228874 = iter_228957;
        int64_t remnant_229036 = iter_228957 - gtid_228874;
        bool cond_228875 = gtid_228874 == (int64_t) 0;
        double defunc_0_f_res_228876;
        
        if (cond_228875) {
            bool y_228958 = slt64((int64_t) 0, s_n_m_203726);
            bool index_certs_228959;
            
            if (!y_228958) {
                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_203726, "].",
                              "-> #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_228960;
            
            head_res_228960 = ((double *) ext_mem_219241.mem)[gtid_211777 *
                                                              (s_n_m_203726 *
                                                               n_p_203574) +
                                                              gtid_228612 *
                                                              s_n_m_203726];
            defunc_0_f_res_228876 = head_res_228960;
        } else {
            int64_t y_228961 = sub64(pad_css_len_203722, (int64_t) 1);
            bool cond_228962 = gtid_228874 == y_228961;
            double defunc_0_f_res_f_res_228963;
            
            if (cond_228962) {
                int64_t i_228964 = sub64(s_n_m_203726, (int64_t) 1);
                bool x_228965 = sle64((int64_t) 0, i_228964);
                bool y_228966 = slt64(i_228964, s_n_m_203726);
                bool bounds_check_228967 = x_228965 && y_228966;
                bool index_certs_228968;
                
                if (!bounds_check_228967) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_228964,
                                  "] out of bounds for array of shape [",
                                  (long long) s_n_m_203726, "].",
                                  "-> #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_228969;
                
                last_res_228969 = ((double *) ext_mem_219241.mem)[gtid_211777 *
                                                                  (s_n_m_203726 *
                                                                   n_p_203574) +
                                                                  gtid_228612 *
                                                                  s_n_m_203726 +
                                                                  i_228964];
                defunc_0_f_res_f_res_228963 = last_res_228969;
            } else {
                int64_t x_228970 = sub64(gtid_228874, (int64_t) 1);
                bool zzero_228971 = jump_s_203581 == (int64_t) 0;
                bool nonzzero_228972 = !zzero_228971;
                bool nonzzero_cert_228973;
                
                if (!nonzzero_228972) {
                    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_228974 = sdiv64(x_228970, jump_s_203581);
                int64_t m_v_228975 = add64((int64_t) 1, x_228974);
                int64_t j_228976;
                
                if (cond_228875) {
                    j_228976 = (int64_t) 0;
                } else {
                    int64_t y_228977 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_228978 = m_v_228975 == y_228977;
                    int64_t j_f_res_228979;
                    
                    if (cond_228978) {
                        j_f_res_228979 = x_228974;
                    } else {
                        j_f_res_228979 = m_v_228975;
                    }
                    j_228976 = j_f_res_228979;
                }
                
                bool cond_228980 = j_228976 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_228981;
                
                if (cond_228980) {
                    defunc_0_m_fun_res_228981 = (int64_t) 0;
                } else {
                    int64_t y_228982 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_228983 = j_228976 == y_228982;
                    int64_t defunc_0_m_fun_res_f_res_228984;
                    
                    if (cond_228983) {
                        defunc_0_m_fun_res_f_res_228984 = y_228961;
                    } else {
                        int64_t x_228985 = sub64(j_228976, (int64_t) 1);
                        int64_t x_228986 = mul64(jump_s_203581, x_228985);
                        int64_t min_arg_228987 = add64((int64_t) 1, x_228986);
                        int64_t min_res_228988 = smin64(defunc_0_f_res_203721,
                                                        min_arg_228987);
                        
                        defunc_0_m_fun_res_f_res_228984 = min_res_228988;
                    }
                    defunc_0_m_fun_res_228981 = defunc_0_m_fun_res_f_res_228984;
                }
                
                int64_t defunc_0_m_fun_arg_228989 = add64((int64_t) 1,
                                                          j_228976);
                bool cond_228990 = defunc_0_m_fun_arg_228989 == (int64_t) 0;
                int64_t defunc_0_m_fun_res_228991;
                
                if (cond_228990) {
                    defunc_0_m_fun_res_228991 = (int64_t) 0;
                } else {
                    int64_t y_228992 = sub64(s_n_m_203726, (int64_t) 1);
                    bool cond_228993 = defunc_0_m_fun_arg_228989 == y_228992;
                    int64_t defunc_0_m_fun_res_f_res_228994;
                    
                    if (cond_228993) {
                        defunc_0_m_fun_res_f_res_228994 = y_228961;
                    } else {
                        int64_t x_228995 = mul64(jump_s_203581, j_228976);
                        int64_t min_arg_228996 = add64((int64_t) 1, x_228995);
                        int64_t min_res_228997 = smin64(defunc_0_f_res_203721,
                                                        min_arg_228996);
                        
                        defunc_0_m_fun_res_f_res_228994 = min_res_228997;
                    }
                    defunc_0_m_fun_res_228991 = defunc_0_m_fun_res_f_res_228994;
                }
                
                int64_t i64_arg_228998 = sub64(defunc_0_m_fun_res_228991,
                                               defunc_0_m_fun_res_228981);
                double i64_res_228999 = sitofp_i64_f64(i64_arg_228998);
                int64_t i64_arg_229000 = sub64(gtid_228874,
                                               defunc_0_m_fun_res_228981);
                double i64_res_229001 = sitofp_i64_f64(i64_arg_229000);
                double u_229002 = i64_res_229001 / i64_res_228999;
                double u2_229003 = u_229002 * u_229002;
                double u3_229004 = u_229002 * u2_229003;
                double x_229005 = 2.0 * u3_229004;
                double y_229006 = 3.0 * u2_229003;
                double x_229007 = x_229005 - y_229006;
                double x_229008 = 1.0 + x_229007;
                bool x_229009 = sle64((int64_t) 0, j_228976);
                bool y_229010 = slt64(j_228976, s_n_m_203726);
                bool bounds_check_229011 = x_229009 && y_229010;
                bool index_certs_229012;
                
                if (!bounds_check_229011) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) j_228976,
                                  "] out of bounds for array of shape [",
                                  (long long) s_n_m_203726, "].",
                                  "-> #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_229013;
                
                y_229013 = ((double *) ext_mem_219241.mem)[gtid_211777 *
                                                           (s_n_m_203726 *
                                                            n_p_203574) +
                                                           gtid_228612 *
                                                           s_n_m_203726 +
                                                           j_228976];
                
                double x_229014 = x_229008 * y_229013;
                double x_229015 = y_229006 - x_229005;
                bool x_229016 = sle64((int64_t) 0, defunc_0_m_fun_arg_228989);
                bool y_229017 = slt64(defunc_0_m_fun_arg_228989, s_n_m_203726);
                bool bounds_check_229018 = x_229016 && y_229017;
                bool index_certs_229019;
                
                if (!bounds_check_229018) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [",
                                  (long long) defunc_0_m_fun_arg_228989,
                                  "] out of bounds for array of shape [",
                                  (long long) s_n_m_203726, "].",
                                  "-> #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_229020;
                
                y_229020 = ((double *) ext_mem_219241.mem)[gtid_211777 *
                                                           (s_n_m_203726 *
                                                            n_p_203574) +
                                                           gtid_228612 *
                                                           s_n_m_203726 +
                                                           defunc_0_m_fun_arg_228989];
                
                double y_229021 = x_229015 * y_229020;
                double x_229022 = x_229014 + y_229021;
                double y_229023 = 2.0 * u2_229003;
                double x_229024 = u3_229004 - y_229023;
                double x_229025 = u_229002 + x_229024;
                double y_229026;
                
                y_229026 = ((double *) ext_mem_219240.mem)[gtid_211777 *
                                                           (s_n_m_203726 *
                                                            n_p_203574) +
                                                           gtid_228612 *
                                                           s_n_m_203726 +
                                                           j_228976];
                
                double x_229027 = x_229025 * y_229026;
                double y_229028 = i64_res_228999 * x_229027;
                double x_229029 = x_229022 + y_229028;
                double x_229030 = u3_229004 - u2_229003;
                double y_229031;
                
                y_229031 = ((double *) ext_mem_219240.mem)[gtid_211777 *
                                                           (s_n_m_203726 *
                                                            n_p_203574) +
                                                           gtid_228612 *
                                                           s_n_m_203726 +
                                                           defunc_0_m_fun_arg_228989];
                
                double x_229032 = x_229030 * y_229031;
                double y_229033 = i64_res_228999 * x_229032;
                double defunc_4_interpolate_proc_res_229034 = x_229029 +
                       y_229033;
                
                defunc_0_f_res_f_res_228963 =
                    defunc_4_interpolate_proc_res_229034;
            }
            defunc_0_f_res_228876 = defunc_0_f_res_f_res_228963;
        }
        ((double *) mem_228613.mem)[gtid_228874] = defunc_0_f_res_228876;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236133_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236133_end -
                 futhark_mc_segmap_parloop_236133_start;
        
        ctx->futhark_mc_segmap_parloop_236133_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236133_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236133_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236131(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228873 = tid;
    int num_tasks_228956 = info.nsubtasks;
    struct futhark_mc_task_236130 *futhark_mc_task_236130 =
                                  (struct futhark_mc_task_236130 *) args;
    struct futhark_context *ctx = futhark_mc_task_236130->ctx;
    uint64_t futhark_mc_segmap_task_236131_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236131_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236130->free_n_p_203574;
    int64_t jump_s_203581 = futhark_mc_task_236130->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236130->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236130->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236130->free_s_n_m_203726;
    int64_t gtid_211777 = futhark_mc_task_236130->free_gtid_211777;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_task_236130->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_task_236130->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t gtid_228612 = futhark_mc_task_236130->free_gtid_228612;
    struct memblock mem_228613 = {.desc ="mem_228613", .mem =
                                  futhark_mc_task_236130->free_mem_228613,
                                  .size =0, .references =NULL};
    int64_t iter_228957;
    struct futhark_mc_segmap_parloop_struct_236132
    futhark_mc_segmap_parloop_struct_236132;
    
    futhark_mc_segmap_parloop_struct_236132.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236132.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236132.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236132.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236132.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236132.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236132.free_gtid_211777 = gtid_211777;
    futhark_mc_segmap_parloop_struct_236132.free_ext_mem_219240 =
        ext_mem_219240.mem;
    futhark_mc_segmap_parloop_struct_236132.free_ext_mem_219241 =
        ext_mem_219241.mem;
    futhark_mc_segmap_parloop_struct_236132.free_gtid_228612 = gtid_228612;
    futhark_mc_segmap_parloop_struct_236132.free_mem_228613 = mem_228613.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236133_task;
    
    futhark_mc_segmap_parloop_236133_task.name =
        "futhark_mc_segmap_parloop_236133";
    futhark_mc_segmap_parloop_236133_task.fn = futhark_mc_segmap_parloop_236133;
    futhark_mc_segmap_parloop_236133_task.args =
        &futhark_mc_segmap_parloop_struct_236132;
    futhark_mc_segmap_parloop_236133_task.iterations = iterations;
    futhark_mc_segmap_parloop_236133_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236133_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236133_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236133_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236133_task);
    
    if (futhark_mc_segmap_parloop_236133_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236133_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236133_total_end -
                 futhark_mc_segmap_parloop_236133_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236133_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236133_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236133_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236131_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236131_end -
                 futhark_mc_segmap_task_236131_start;
        
        ctx->futhark_mc_segmap_task_236131_runs[tid]++;
        ctx->futhark_mc_segmap_task_236131_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236131_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236128(void *args, int64_t start,
                                            int64_t end, int flat_tid_228611,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236127
    *futhark_mc_segmap_parloop_struct_236127 =
    (struct futhark_mc_segmap_parloop_struct_236127 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236127->ctx;
    uint64_t futhark_mc_segmap_parloop_236128_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236128_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236127->free_n_p_203574;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236127->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236127->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236127->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236127->free_s_n_m_203726;
    int64_t gtid_211777 =
            futhark_mc_segmap_parloop_struct_236127->free_gtid_211777;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_segmap_parloop_struct_236127->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_segmap_parloop_struct_236127->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t bytes_219243 =
            futhark_mc_segmap_parloop_struct_236127->free_bytes_219243;
    struct memblock mem_219263 = {.desc ="mem_219263", .mem =
                                  futhark_mc_segmap_parloop_struct_236127->free_mem_219263,
                                  .size =0, .references =NULL};
    size_t mem_228613_cached_sizze_236129 = 0;
    unsigned char *mem_228613 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228872 = start;
    
    if (mem_228613_cached_sizze_236129 < (size_t) bytes_219243) {
        mem_228613 = realloc(mem_228613, bytes_219243);
        mem_228613_cached_sizze_236129 = bytes_219243;
    }
    for (; iter_228872 < end; iter_228872++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228954 = n_p_203574;
        int64_t gtid_228612 = iter_228872;
        int64_t remnant_228955 = iter_228872 - gtid_228612;
        int64_t flat_tid_228873 = (int64_t) 0;
        int32_t num_tasks_228956;
        struct futhark_mc_task_236130 futhark_mc_task_236130;
        
        futhark_mc_task_236130.ctx = ctx;
        futhark_mc_task_236130.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236130.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_236130.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236130.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_236130.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_236130.free_gtid_211777 = gtid_211777;
        futhark_mc_task_236130.free_ext_mem_219240 = ext_mem_219240.mem;
        futhark_mc_task_236130.free_ext_mem_219241 = ext_mem_219241.mem;
        futhark_mc_task_236130.free_gtid_228612 = gtid_228612;
        futhark_mc_task_236130.free_mem_228613 = mem_228613;
        
        struct scheduler_segop futhark_mc_task_236130_task;
        
        futhark_mc_task_236130_task.args = &futhark_mc_task_236130;
        futhark_mc_task_236130_task.top_level_fn =
            futhark_mc_segmap_task_236131;
        futhark_mc_task_236130_task.name = "futhark_mc_segmap_task_236131";
        futhark_mc_task_236130_task.iterations = pad_css_len_203722;
        futhark_mc_task_236130_task.task_time =
            &ctx->futhark_mc_segmap_task_236131_total_time;
        futhark_mc_task_236130_task.task_iter =
            &ctx->futhark_mc_segmap_task_236131_total_iter;
        futhark_mc_task_236130_task.sched = STATIC;
        futhark_mc_task_236130_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236131_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236130_task);
        
        if (futhark_mc_segmap_task_236131_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (pad_css_len_203722 * (int64_t) 8 > 0)
            memmove(mem_219263.mem + gtid_228612 * pad_css_len_203722 *
                    (int64_t) 8, mem_228613 + (int64_t) 0, pad_css_len_203722 *
                    (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_228613);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236128_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236128_end -
                 futhark_mc_segmap_parloop_236128_start;
        
        ctx->futhark_mc_segmap_parloop_236128_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236128_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236128_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236126(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_228611 = tid;
    int num_tasks_228785 = info.nsubtasks;
    struct futhark_mc_task_236121 *futhark_mc_task_236121 =
                                  (struct futhark_mc_task_236121 *) args;
    struct futhark_context *ctx = futhark_mc_task_236121->ctx;
    uint64_t futhark_mc_segmap_nested_task_236126_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236126_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236121->free_n_p_203574;
    int64_t jump_s_203581 = futhark_mc_task_236121->free_jump_s_203581;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236121->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236121->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236121->free_s_n_m_203726;
    int64_t gtid_211777 = futhark_mc_task_236121->free_gtid_211777;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_task_236121->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_task_236121->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t bytes_219243 = futhark_mc_task_236121->free_bytes_219243;
    struct memblock mem_219263 = {.desc ="mem_219263", .mem =
                                  futhark_mc_task_236121->free_mem_219263,
                                  .size =0, .references =NULL};
    int64_t iter_228872;
    struct futhark_mc_segmap_parloop_struct_236127
    futhark_mc_segmap_parloop_struct_236127;
    
    futhark_mc_segmap_parloop_struct_236127.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236127.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236127.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236127.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236127.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236127.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236127.free_gtid_211777 = gtid_211777;
    futhark_mc_segmap_parloop_struct_236127.free_ext_mem_219240 =
        ext_mem_219240.mem;
    futhark_mc_segmap_parloop_struct_236127.free_ext_mem_219241 =
        ext_mem_219241.mem;
    futhark_mc_segmap_parloop_struct_236127.free_bytes_219243 = bytes_219243;
    futhark_mc_segmap_parloop_struct_236127.free_mem_219263 = mem_219263.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236128_task;
    
    futhark_mc_segmap_parloop_236128_task.name =
        "futhark_mc_segmap_parloop_236128";
    futhark_mc_segmap_parloop_236128_task.fn = futhark_mc_segmap_parloop_236128;
    futhark_mc_segmap_parloop_236128_task.args =
        &futhark_mc_segmap_parloop_struct_236127;
    futhark_mc_segmap_parloop_236128_task.iterations = iterations;
    futhark_mc_segmap_parloop_236128_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236128_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236128_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236128_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236128_task);
    
    if (futhark_mc_segmap_parloop_236128_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236128_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236128_total_end -
                 futhark_mc_segmap_parloop_236128_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236128_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236128_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236128_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236126_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236126_end -
                 futhark_mc_segmap_nested_task_236126_start;
        
        ctx->futhark_mc_segmap_nested_task_236126_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236126_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236126_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236119(void *args, int64_t start,
                                            int64_t end, int flat_tid_211776,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236118
    *futhark_mc_segmap_parloop_struct_236118 =
    (struct futhark_mc_segmap_parloop_struct_236118 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236118->ctx;
    uint64_t futhark_mc_segmap_parloop_236119_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236119_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236118->free_n_p_203574;
    int64_t jump_s_203581 =
            futhark_mc_segmap_parloop_struct_236118->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236118->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_segmap_parloop_struct_236118->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_segmap_parloop_struct_236118->free_pad_css_len_203722;
    int64_t s_n_m_203726 =
            futhark_mc_segmap_parloop_struct_236118->free_s_n_m_203726;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_segmap_parloop_struct_236118->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_segmap_parloop_struct_236118->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t bytes_219243 =
            futhark_mc_segmap_parloop_struct_236118->free_bytes_219243;
    int64_t bytes_219262 =
            futhark_mc_segmap_parloop_struct_236118->free_bytes_219262;
    struct memblock mem_219312 = {.desc ="mem_219312", .mem =
                                  futhark_mc_segmap_parloop_struct_236118->free_mem_219312,
                                  .size =0, .references =NULL};
    size_t mem_219263_cached_sizze_236120 = 0;
    unsigned char *mem_219263 = NULL;
    int64_t iterations = end - start;
    int64_t iter_228610 = start;
    
    if (mem_219263_cached_sizze_236120 < (size_t) bytes_219262) {
        mem_219263 = realloc(mem_219263, bytes_219262);
        mem_219263_cached_sizze_236120 = bytes_219262;
    }
    for (; iter_228610 < end; iter_228610++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_228783 = partition_sizze_203667;
        int64_t gtid_211777 = iter_228610;
        int64_t remnant_228784 = iter_228610 - gtid_211777;
        int64_t flat_tid_228696 = (int64_t) 0;
        int32_t num_tasks_228785;
        int64_t flat_tid_228611 = (int64_t) 0;
        struct futhark_mc_task_236121 futhark_mc_task_236121;
        
        futhark_mc_task_236121.ctx = ctx;
        futhark_mc_task_236121.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236121.free_jump_s_203581 = jump_s_203581;
        futhark_mc_task_236121.free_defunc_0_f_res_203721 =
            defunc_0_f_res_203721;
        futhark_mc_task_236121.free_pad_css_len_203722 = pad_css_len_203722;
        futhark_mc_task_236121.free_s_n_m_203726 = s_n_m_203726;
        futhark_mc_task_236121.free_gtid_211777 = gtid_211777;
        futhark_mc_task_236121.free_ext_mem_219240 = ext_mem_219240.mem;
        futhark_mc_task_236121.free_ext_mem_219241 = ext_mem_219241.mem;
        futhark_mc_task_236121.free_bytes_219243 = bytes_219243;
        futhark_mc_task_236121.free_mem_219263 = mem_219263;
        
        struct scheduler_segop futhark_mc_task_236121_task;
        
        futhark_mc_task_236121_task.args = &futhark_mc_task_236121;
        futhark_mc_task_236121_task.top_level_fn =
            futhark_mc_segmap_task_236122;
        futhark_mc_task_236121_task.name = "futhark_mc_segmap_task_236122";
        futhark_mc_task_236121_task.iterations = n_p_203574;
        futhark_mc_task_236121_task.task_time =
            &ctx->futhark_mc_segmap_task_236122_total_time;
        futhark_mc_task_236121_task.task_iter =
            &ctx->futhark_mc_segmap_task_236122_total_iter;
        futhark_mc_task_236121_task.sched = STATIC;
        futhark_mc_task_236121_task.nested_fn =
            futhark_mc_segmap_nested_task_236126;
        
        int futhark_mc_segmap_task_236122_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236121_task);
        
        if (futhark_mc_segmap_task_236122_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_p_203574 * pad_css_len_203722 * (int64_t) 8 > 0)
            memmove(mem_219312.mem + gtid_211777 * (pad_css_len_203722 *
                                                    n_p_203574) * (int64_t) 8,
                    mem_219263 + (int64_t) 0, n_p_203574 * pad_css_len_203722 *
                    (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219263);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236119_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236119_end -
                 futhark_mc_segmap_parloop_236119_start;
        
        ctx->futhark_mc_segmap_parloop_236119_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236119_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236119_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236117(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211776 = tid;
    int num_tasks_228519 = info.nsubtasks;
    struct futhark_mc_task_236112 *futhark_mc_task_236112 =
                                  (struct futhark_mc_task_236112 *) args;
    struct futhark_context *ctx = futhark_mc_task_236112->ctx;
    uint64_t futhark_mc_segmap_nested_task_236117_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236117_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236112->free_n_p_203574;
    int64_t jump_s_203581 = futhark_mc_task_236112->free_jump_s_203581;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236112->free_partition_sizze_203667;
    int64_t defunc_0_f_res_203721 =
            futhark_mc_task_236112->free_defunc_0_f_res_203721;
    int64_t pad_css_len_203722 =
            futhark_mc_task_236112->free_pad_css_len_203722;
    int64_t s_n_m_203726 = futhark_mc_task_236112->free_s_n_m_203726;
    struct memblock ext_mem_219240 = {.desc ="ext_mem_219240", .mem =
                                      futhark_mc_task_236112->free_ext_mem_219240,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219241 = {.desc ="ext_mem_219241", .mem =
                                      futhark_mc_task_236112->free_ext_mem_219241,
                                      .size =0, .references =NULL};
    int64_t bytes_219243 = futhark_mc_task_236112->free_bytes_219243;
    int64_t bytes_219262 = futhark_mc_task_236112->free_bytes_219262;
    struct memblock mem_219312 = {.desc ="mem_219312", .mem =
                                  futhark_mc_task_236112->free_mem_219312,
                                  .size =0, .references =NULL};
    int64_t iter_228610;
    struct futhark_mc_segmap_parloop_struct_236118
    futhark_mc_segmap_parloop_struct_236118;
    
    futhark_mc_segmap_parloop_struct_236118.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236118.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236118.free_jump_s_203581 = jump_s_203581;
    futhark_mc_segmap_parloop_struct_236118.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236118.free_defunc_0_f_res_203721 =
        defunc_0_f_res_203721;
    futhark_mc_segmap_parloop_struct_236118.free_pad_css_len_203722 =
        pad_css_len_203722;
    futhark_mc_segmap_parloop_struct_236118.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_segmap_parloop_struct_236118.free_ext_mem_219240 =
        ext_mem_219240.mem;
    futhark_mc_segmap_parloop_struct_236118.free_ext_mem_219241 =
        ext_mem_219241.mem;
    futhark_mc_segmap_parloop_struct_236118.free_bytes_219243 = bytes_219243;
    futhark_mc_segmap_parloop_struct_236118.free_bytes_219262 = bytes_219262;
    futhark_mc_segmap_parloop_struct_236118.free_mem_219312 = mem_219312.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236119_task;
    
    futhark_mc_segmap_parloop_236119_task.name =
        "futhark_mc_segmap_parloop_236119";
    futhark_mc_segmap_parloop_236119_task.fn = futhark_mc_segmap_parloop_236119;
    futhark_mc_segmap_parloop_236119_task.args =
        &futhark_mc_segmap_parloop_struct_236118;
    futhark_mc_segmap_parloop_236119_task.iterations = iterations;
    futhark_mc_segmap_parloop_236119_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236119_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236119_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236119_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236119_task);
    
    if (futhark_mc_segmap_parloop_236119_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236119_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236119_total_end -
                 futhark_mc_segmap_parloop_236119_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236119_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236119_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236119_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236117_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236117_end -
                 futhark_mc_segmap_nested_task_236117_start;
        
        ctx->futhark_mc_segmap_nested_task_236117_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236117_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236117_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236134 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    int64_t free_css_results_l_204200;
    unsigned char *free_ext_mem_219313;
    int64_t free_bytes_219316;
    unsigned char *free_mem_219336;
};
struct futhark_mc_segmap_parloop_struct_236136 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    int64_t free_css_results_l_204200;
    unsigned char *free_ext_mem_219313;
    int64_t free_bytes_219316;
    unsigned char *free_mem_219336;
};
static int futhark_mc_segmap_parloop_236137(void *args, int64_t start,
                                            int64_t end, int flat_tid_211953,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236136
    *futhark_mc_segmap_parloop_struct_236136 =
    (struct futhark_mc_segmap_parloop_struct_236136 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236136->ctx;
    uint64_t futhark_mc_segmap_parloop_236137_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236137_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236136->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236136->free_partition_sizze_203667;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236136->free_C_len_203724;
    int64_t css_results_l_204200 =
            futhark_mc_segmap_parloop_struct_236136->free_css_results_l_204200;
    struct memblock ext_mem_219313 = {.desc ="ext_mem_219313", .mem =
                                      futhark_mc_segmap_parloop_struct_236136->free_ext_mem_219313,
                                      .size =0, .references =NULL};
    int64_t bytes_219316 =
            futhark_mc_segmap_parloop_struct_236136->free_bytes_219316;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segmap_parloop_struct_236136->free_mem_219336,
                                  .size =0, .references =NULL};
    size_t mem_219320_cached_sizze_236138 = 0;
    unsigned char *mem_219320 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229038 = start;
    
    if (mem_219320_cached_sizze_236138 < (size_t) bytes_219316) {
        mem_219320 = realloc(mem_219320, bytes_219316);
        mem_219320_cached_sizze_236138 = bytes_219316;
    }
    for (; iter_229038 < end; iter_229038++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229053 = partition_sizze_203667;
        int64_t gtid_211954 = iter_229038;
        int64_t remnant_229054 = iter_229038 - gtid_211954;
        
        for (int64_t i_229039 = 0; i_229039 < C_len_203724; i_229039++) {
            int64_t i_229041 = smod64(i_229039, n_p_203574);
            bool x_229042 = sle64((int64_t) 0, i_229041);
            bool y_229043 = slt64(i_229041, n_p_203574);
            bool bounds_check_229044 = x_229042 && y_229043;
            int64_t i_229045 = sdiv64(i_229039, n_p_203574);
            bool x_229046 = sle64((int64_t) 0, i_229045);
            bool y_229047 = slt64(i_229045, css_results_l_204200);
            bool bounds_check_229048 = x_229046 && y_229047;
            bool index_ok_229049 = bounds_check_229044 && bounds_check_229048;
            bool index_certs_229050;
            
            if (!index_ok_229049) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) i_229041, ", ",
                              (long long) i_229045,
                              "] out of bounds for array of shape [",
                              (long long) n_p_203574, "][",
                              (long long) css_results_l_204200, "].",
                              "-> #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_219320 + i_229039 * (int64_t) 8,
                        ext_mem_219313.mem + (gtid_211954 *
                                              (css_results_l_204200 *
                                               n_p_203574) + i_229041 *
                                              css_results_l_204200 + i_229045) *
                        (int64_t) 8, (int64_t) 8);
        }
        if (C_len_203724 * (int64_t) 8 > 0)
            memmove(mem_219336.mem + gtid_211954 * C_len_203724 * (int64_t) 8,
                    mem_219320 + (int64_t) 0, C_len_203724 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219320);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236137_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236137_end -
                 futhark_mc_segmap_parloop_236137_start;
        
        ctx->futhark_mc_segmap_parloop_236137_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236137_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236137_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236135(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211953 = tid;
    int num_tasks_229037 = 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_segmap_task_236135_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236135_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236134->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236134->free_partition_sizze_203667;
    int64_t C_len_203724 = futhark_mc_task_236134->free_C_len_203724;
    int64_t css_results_l_204200 =
            futhark_mc_task_236134->free_css_results_l_204200;
    struct memblock ext_mem_219313 = {.desc ="ext_mem_219313", .mem =
                                      futhark_mc_task_236134->free_ext_mem_219313,
                                      .size =0, .references =NULL};
    int64_t bytes_219316 = futhark_mc_task_236134->free_bytes_219316;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236134->free_mem_219336,
                                  .size =0, .references =NULL};
    int64_t iter_229038;
    struct futhark_mc_segmap_parloop_struct_236136
    futhark_mc_segmap_parloop_struct_236136;
    
    futhark_mc_segmap_parloop_struct_236136.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236136.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236136.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236136.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236136.free_css_results_l_204200 =
        css_results_l_204200;
    futhark_mc_segmap_parloop_struct_236136.free_ext_mem_219313 =
        ext_mem_219313.mem;
    futhark_mc_segmap_parloop_struct_236136.free_bytes_219316 = bytes_219316;
    futhark_mc_segmap_parloop_struct_236136.free_mem_219336 = mem_219336.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236137_task;
    
    futhark_mc_segmap_parloop_236137_task.name =
        "futhark_mc_segmap_parloop_236137";
    futhark_mc_segmap_parloop_236137_task.fn = futhark_mc_segmap_parloop_236137;
    futhark_mc_segmap_parloop_236137_task.args =
        &futhark_mc_segmap_parloop_struct_236136;
    futhark_mc_segmap_parloop_236137_task.iterations = iterations;
    futhark_mc_segmap_parloop_236137_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236137_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236137_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236137_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236137_task);
    
    if (futhark_mc_segmap_parloop_236137_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236137_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236137_total_end -
                 futhark_mc_segmap_parloop_236137_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236137_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236137_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236137_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236135_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236135_end -
                 futhark_mc_segmap_task_236135_start;
        
        ctx->futhark_mc_segmap_task_236135_runs[tid]++;
        ctx->futhark_mc_segmap_task_236135_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236135_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236140 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    int64_t free_css_results_l_204200;
    unsigned char *free_ext_mem_219313;
    int64_t free_bytes_219316;
    unsigned char *free_mem_219336;
};
struct futhark_mc_task_236143 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_C_len_203724;
    int64_t free_css_results_l_204200;
    int64_t free_gtid_211960;
    unsigned char *free_ext_mem_219313;
    unsigned char *free_mem_219317;
};
struct futhark_mc_segmap_parloop_struct_236145 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_C_len_203724;
    int64_t free_css_results_l_204200;
    int64_t free_gtid_211960;
    unsigned char *free_ext_mem_219313;
    unsigned char *free_mem_219317;
};
static int futhark_mc_segmap_parloop_236146(void *args, int64_t start,
                                            int64_t end, int flat_tid_229057,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236145
    *futhark_mc_segmap_parloop_struct_236145 =
    (struct futhark_mc_segmap_parloop_struct_236145 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236145->ctx;
    uint64_t futhark_mc_segmap_parloop_236146_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236146_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236145->free_n_p_203574;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236145->free_C_len_203724;
    int64_t css_results_l_204200 =
            futhark_mc_segmap_parloop_struct_236145->free_css_results_l_204200;
    int64_t gtid_211960 =
            futhark_mc_segmap_parloop_struct_236145->free_gtid_211960;
    struct memblock ext_mem_219313 = {.desc ="ext_mem_219313", .mem =
                                      futhark_mc_segmap_parloop_struct_236145->free_ext_mem_219313,
                                      .size =0, .references =NULL};
    struct memblock mem_219317 = {.desc ="mem_219317", .mem =
                                  futhark_mc_segmap_parloop_struct_236145->free_mem_219317,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229073 = start;
    
    for (; iter_229073 < end; iter_229073++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229074 = C_len_203724;
        int64_t gtid_229058 = iter_229073;
        int64_t remnant_229075 = iter_229073 - gtid_229058;
        int64_t i_229059 = smod64(gtid_229058, n_p_203574);
        bool x_229060 = sle64((int64_t) 0, i_229059);
        bool y_229061 = slt64(i_229059, n_p_203574);
        bool bounds_check_229062 = x_229060 && y_229061;
        int64_t i_229063 = sdiv64(gtid_229058, n_p_203574);
        bool x_229064 = sle64((int64_t) 0, i_229063);
        bool y_229065 = slt64(i_229063, css_results_l_204200);
        bool bounds_check_229066 = x_229064 && y_229065;
        bool index_ok_229067 = bounds_check_229062 && bounds_check_229066;
        bool index_certs_229068;
        
        if (!index_ok_229067) {
            ctx->error =
                msgprintf("Error: %s%lld%s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                          "Index [", (long long) i_229059, ", ",
                          (long long) i_229063,
                          "] out of bounds for array of shape [",
                          (long long) n_p_203574, "][",
                          (long long) css_results_l_204200, "].",
                          "-> #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_229069;
        
        defunc_0_f_res_229069 = ((double *) ext_mem_219313.mem)[gtid_211960 *
                                                                (css_results_l_204200 *
                                                                 n_p_203574) +
                                                                i_229059 *
                                                                css_results_l_204200 +
                                                                i_229063];
        ((double *) mem_219317.mem)[gtid_229058] = defunc_0_f_res_229069;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236146_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236146_end -
                 futhark_mc_segmap_parloop_236146_start;
        
        ctx->futhark_mc_segmap_parloop_236146_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236146_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236146_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236144(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229057 = tid;
    int num_tasks_229072 = info.nsubtasks;
    struct futhark_mc_task_236143 *futhark_mc_task_236143 =
                                  (struct futhark_mc_task_236143 *) args;
    struct futhark_context *ctx = futhark_mc_task_236143->ctx;
    uint64_t futhark_mc_segmap_task_236144_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236144_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236143->free_n_p_203574;
    int64_t C_len_203724 = futhark_mc_task_236143->free_C_len_203724;
    int64_t css_results_l_204200 =
            futhark_mc_task_236143->free_css_results_l_204200;
    int64_t gtid_211960 = futhark_mc_task_236143->free_gtid_211960;
    struct memblock ext_mem_219313 = {.desc ="ext_mem_219313", .mem =
                                      futhark_mc_task_236143->free_ext_mem_219313,
                                      .size =0, .references =NULL};
    struct memblock mem_219317 = {.desc ="mem_219317", .mem =
                                  futhark_mc_task_236143->free_mem_219317,
                                  .size =0, .references =NULL};
    int64_t iter_229073;
    struct futhark_mc_segmap_parloop_struct_236145
    futhark_mc_segmap_parloop_struct_236145;
    
    futhark_mc_segmap_parloop_struct_236145.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236145.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236145.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236145.free_css_results_l_204200 =
        css_results_l_204200;
    futhark_mc_segmap_parloop_struct_236145.free_gtid_211960 = gtid_211960;
    futhark_mc_segmap_parloop_struct_236145.free_ext_mem_219313 =
        ext_mem_219313.mem;
    futhark_mc_segmap_parloop_struct_236145.free_mem_219317 = mem_219317.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236146_task;
    
    futhark_mc_segmap_parloop_236146_task.name =
        "futhark_mc_segmap_parloop_236146";
    futhark_mc_segmap_parloop_236146_task.fn = futhark_mc_segmap_parloop_236146;
    futhark_mc_segmap_parloop_236146_task.args =
        &futhark_mc_segmap_parloop_struct_236145;
    futhark_mc_segmap_parloop_236146_task.iterations = iterations;
    futhark_mc_segmap_parloop_236146_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236146_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236146_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236146_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236146_task);
    
    if (futhark_mc_segmap_parloop_236146_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236146_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236146_total_end -
                 futhark_mc_segmap_parloop_236146_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236146_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236146_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236146_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236144_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236144_end -
                 futhark_mc_segmap_task_236144_start;
        
        ctx->futhark_mc_segmap_task_236144_runs[tid]++;
        ctx->futhark_mc_segmap_task_236144_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236144_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236141(void *args, int64_t start,
                                            int64_t end, int flat_tid_211959,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236140
    *futhark_mc_segmap_parloop_struct_236140 =
    (struct futhark_mc_segmap_parloop_struct_236140 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236140->ctx;
    uint64_t futhark_mc_segmap_parloop_236141_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236141_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236140->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236140->free_partition_sizze_203667;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236140->free_C_len_203724;
    int64_t css_results_l_204200 =
            futhark_mc_segmap_parloop_struct_236140->free_css_results_l_204200;
    struct memblock ext_mem_219313 = {.desc ="ext_mem_219313", .mem =
                                      futhark_mc_segmap_parloop_struct_236140->free_ext_mem_219313,
                                      .size =0, .references =NULL};
    int64_t bytes_219316 =
            futhark_mc_segmap_parloop_struct_236140->free_bytes_219316;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segmap_parloop_struct_236140->free_mem_219336,
                                  .size =0, .references =NULL};
    size_t mem_219317_cached_sizze_236142 = 0;
    unsigned char *mem_219317 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229056 = start;
    
    if (mem_219317_cached_sizze_236142 < (size_t) bytes_219316) {
        mem_219317 = realloc(mem_219317, bytes_219316);
        mem_219317_cached_sizze_236142 = bytes_219316;
    }
    for (; iter_229056 < end; iter_229056++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229070 = partition_sizze_203667;
        int64_t gtid_211960 = iter_229056;
        int64_t remnant_229071 = iter_229056 - gtid_211960;
        int64_t flat_tid_229057 = (int64_t) 0;
        int32_t num_tasks_229072;
        struct futhark_mc_task_236143 futhark_mc_task_236143;
        
        futhark_mc_task_236143.ctx = ctx;
        futhark_mc_task_236143.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236143.free_C_len_203724 = C_len_203724;
        futhark_mc_task_236143.free_css_results_l_204200 = css_results_l_204200;
        futhark_mc_task_236143.free_gtid_211960 = gtid_211960;
        futhark_mc_task_236143.free_ext_mem_219313 = ext_mem_219313.mem;
        futhark_mc_task_236143.free_mem_219317 = mem_219317;
        
        struct scheduler_segop futhark_mc_task_236143_task;
        
        futhark_mc_task_236143_task.args = &futhark_mc_task_236143;
        futhark_mc_task_236143_task.top_level_fn =
            futhark_mc_segmap_task_236144;
        futhark_mc_task_236143_task.name = "futhark_mc_segmap_task_236144";
        futhark_mc_task_236143_task.iterations = C_len_203724;
        futhark_mc_task_236143_task.task_time =
            &ctx->futhark_mc_segmap_task_236144_total_time;
        futhark_mc_task_236143_task.task_iter =
            &ctx->futhark_mc_segmap_task_236144_total_iter;
        futhark_mc_task_236143_task.sched = STATIC;
        futhark_mc_task_236143_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236144_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236143_task);
        
        if (futhark_mc_segmap_task_236144_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (C_len_203724 * (int64_t) 8 > 0)
            memmove(mem_219336.mem + gtid_211960 * C_len_203724 * (int64_t) 8,
                    mem_219317 + (int64_t) 0, C_len_203724 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219317);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236141_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236141_end -
                 futhark_mc_segmap_parloop_236141_start;
        
        ctx->futhark_mc_segmap_parloop_236141_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236141_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236141_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236139(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211959 = tid;
    int num_tasks_229037 = 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_segmap_nested_task_236139_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236139_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236134->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236134->free_partition_sizze_203667;
    int64_t C_len_203724 = futhark_mc_task_236134->free_C_len_203724;
    int64_t css_results_l_204200 =
            futhark_mc_task_236134->free_css_results_l_204200;
    struct memblock ext_mem_219313 = {.desc ="ext_mem_219313", .mem =
                                      futhark_mc_task_236134->free_ext_mem_219313,
                                      .size =0, .references =NULL};
    int64_t bytes_219316 = futhark_mc_task_236134->free_bytes_219316;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236134->free_mem_219336,
                                  .size =0, .references =NULL};
    int64_t iter_229056;
    struct futhark_mc_segmap_parloop_struct_236140
    futhark_mc_segmap_parloop_struct_236140;
    
    futhark_mc_segmap_parloop_struct_236140.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236140.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236140.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236140.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236140.free_css_results_l_204200 =
        css_results_l_204200;
    futhark_mc_segmap_parloop_struct_236140.free_ext_mem_219313 =
        ext_mem_219313.mem;
    futhark_mc_segmap_parloop_struct_236140.free_bytes_219316 = bytes_219316;
    futhark_mc_segmap_parloop_struct_236140.free_mem_219336 = mem_219336.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236141_task;
    
    futhark_mc_segmap_parloop_236141_task.name =
        "futhark_mc_segmap_parloop_236141";
    futhark_mc_segmap_parloop_236141_task.fn = futhark_mc_segmap_parloop_236141;
    futhark_mc_segmap_parloop_236141_task.args =
        &futhark_mc_segmap_parloop_struct_236140;
    futhark_mc_segmap_parloop_236141_task.iterations = iterations;
    futhark_mc_segmap_parloop_236141_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236141_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236141_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236141_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236141_task);
    
    if (futhark_mc_segmap_parloop_236141_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236141_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236141_total_end -
                 futhark_mc_segmap_parloop_236141_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236141_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236141_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236141_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236139_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236139_end -
                 futhark_mc_segmap_nested_task_236139_start;
        
        ctx->futhark_mc_segmap_nested_task_236139_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236139_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236139_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236147 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    unsigned char *free_mem_219336;
    unsigned char *free_mem_219339;
};
struct futhark_mc_segmap_parloop_struct_236149 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    unsigned char *free_mem_219336;
    unsigned char *free_mem_219339;
};
static int futhark_mc_segmap_parloop_236150(void *args, int64_t start,
                                            int64_t end, int flat_tid_211977,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236149
    *futhark_mc_segmap_parloop_struct_236149 =
    (struct futhark_mc_segmap_parloop_struct_236149 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236149->ctx;
    uint64_t futhark_mc_segmap_parloop_236150_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236150_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236149->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236149->free_partition_sizze_203667;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236149->free_C_len_203724;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segmap_parloop_struct_236149->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219339 = {.desc ="mem_219339", .mem =
                                  futhark_mc_segmap_parloop_struct_236149->free_mem_219339,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229077 = start;
    
    for (; iter_229077 < end; iter_229077++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229082 = partition_sizze_203667;
        int64_t gtid_211978 = iter_229077;
        int64_t remnant_229083 = iter_229077 - gtid_211978;
        double defunc_2_reduce_res_205173;
        double redout_229079 = 0.0;
        
        for (int64_t i_229078 = 0; i_229078 < n_p_203574; i_229078++) {
            double x_229080;
            
            x_229080 = ((double *) mem_219336.mem)[gtid_211978 * C_len_203724 +
                                                   i_229078];
            
            double defunc_1_op_res_229081 = x_229080 + redout_229079;
            double redout_tmp_229084 = defunc_1_op_res_229081;
            
            redout_229079 = redout_tmp_229084;
        }
        defunc_2_reduce_res_205173 = redout_229079;
        ((double *) mem_219339.mem)[gtid_211978] = defunc_2_reduce_res_205173;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236150_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236150_end -
                 futhark_mc_segmap_parloop_236150_start;
        
        ctx->futhark_mc_segmap_parloop_236150_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236150_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236150_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236148(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211977 = tid;
    int num_tasks_229076 = info.nsubtasks;
    struct futhark_mc_task_236147 *futhark_mc_task_236147 =
                                  (struct futhark_mc_task_236147 *) args;
    struct futhark_context *ctx = futhark_mc_task_236147->ctx;
    uint64_t futhark_mc_segmap_task_236148_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236148_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236147->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236147->free_partition_sizze_203667;
    int64_t C_len_203724 = futhark_mc_task_236147->free_C_len_203724;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236147->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219339 = {.desc ="mem_219339", .mem =
                                  futhark_mc_task_236147->free_mem_219339,
                                  .size =0, .references =NULL};
    int64_t iter_229077;
    struct futhark_mc_segmap_parloop_struct_236149
    futhark_mc_segmap_parloop_struct_236149;
    
    futhark_mc_segmap_parloop_struct_236149.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236149.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236149.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236149.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236149.free_mem_219336 = mem_219336.mem;
    futhark_mc_segmap_parloop_struct_236149.free_mem_219339 = mem_219339.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236150_task;
    
    futhark_mc_segmap_parloop_236150_task.name =
        "futhark_mc_segmap_parloop_236150";
    futhark_mc_segmap_parloop_236150_task.fn = futhark_mc_segmap_parloop_236150;
    futhark_mc_segmap_parloop_236150_task.args =
        &futhark_mc_segmap_parloop_struct_236149;
    futhark_mc_segmap_parloop_236150_task.iterations = iterations;
    futhark_mc_segmap_parloop_236150_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236150_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236150_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236150_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236150_task);
    
    if (futhark_mc_segmap_parloop_236150_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236150_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236150_total_end -
                 futhark_mc_segmap_parloop_236150_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236150_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236150_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236150_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236148_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236148_end -
                 futhark_mc_segmap_task_236148_start;
        
        ctx->futhark_mc_segmap_task_236148_runs[tid]++;
        ctx->futhark_mc_segmap_task_236148_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236148_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236152 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    unsigned char *free_mem_219336;
    unsigned char *free_mem_219339;
};
struct futhark_mc_task_236154 {
    struct futhark_context *ctx;
    int64_t free_C_len_203724;
    int64_t free_gtid_211984;
    unsigned char *free_mem_219336;
    double *retval_defunc_2_reduce_res_211986;
};
struct futhark_mc_segred_stage_1_parloop_struct_236157 {
    struct futhark_context *ctx;
    int64_t free_C_len_203724;
    int64_t free_gtid_211984;
    unsigned char *free_mem_219336;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229095;
};
static int futhark_mc_segred_stage_1_parloop_236158(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229086,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236157
    *futhark_mc_segred_stage_1_parloop_struct_236157 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236157 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236157->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236158_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236158_start = get_wall_time();
    
    int64_t C_len_203724 =
            futhark_mc_segred_stage_1_parloop_struct_236157->free_C_len_203724;
    int64_t gtid_211984 =
            futhark_mc_segred_stage_1_parloop_struct_236157->free_gtid_211984;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236157->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_229095 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229095",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236157->free_reduce_stage_1_tid_res_arr_mem_229095,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229097 = start;
    double x_229088;
    double x_229089;
    double local_acc_229098 = 0.0;
    
    for (; iter_229097 < end; iter_229097++) {
        int64_t gtid_229087 = iter_229097;
        double x_229091;
        
        x_229091 = ((double *) mem_219336.mem)[gtid_211984 * C_len_203724 +
                                               gtid_229087];
        // save map-out results
        { }
        // Load accum params
        {
            x_229088 = local_acc_229098;
        }
        // Load next params
        {
            x_229089 = x_229091;
        }
        // Red body
        {
            double defunc_1_op_res_229090 = x_229088 + x_229089;
            
            local_acc_229098 = defunc_1_op_res_229090;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229095.mem)[flat_tid_229086] =
        local_acc_229098;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236158_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236158_end -
                 futhark_mc_segred_stage_1_parloop_236158_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236158_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236158_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236158_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236155(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229086 = tid;
    int num_tasks_229094 = info.nsubtasks;
    struct futhark_mc_task_236154 *futhark_mc_task_236154 =
                                  (struct futhark_mc_task_236154 *) args;
    struct futhark_context *ctx = futhark_mc_task_236154->ctx;
    uint64_t futhark_mc_segred_task_236155_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236155_start = get_wall_time();
    
    int64_t C_len_203724 = futhark_mc_task_236154->free_C_len_203724;
    int64_t gtid_211984 = futhark_mc_task_236154->free_gtid_211984;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236154->free_mem_219336,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_211986 =
           *futhark_mc_task_236154->retval_defunc_2_reduce_res_211986;
    size_t reduce_stage_1_tid_res_arr_mem_229095_cached_sizze_236156 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229095 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229095_cached_sizze_236156 <
        (size_t) ((int64_t) 8 * num_tasks_229094)) {
        reduce_stage_1_tid_res_arr_mem_229095 =
            realloc(reduce_stage_1_tid_res_arr_mem_229095, (int64_t) 8 *
                    num_tasks_229094);
        reduce_stage_1_tid_res_arr_mem_229095_cached_sizze_236156 =
            (int64_t) 8 * num_tasks_229094;
    }
    
    int64_t iter_229097;
    struct futhark_mc_segred_stage_1_parloop_struct_236157
    futhark_mc_segred_stage_1_parloop_struct_236157;
    
    futhark_mc_segred_stage_1_parloop_struct_236157.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236157.free_C_len_203724 =
        C_len_203724;
    futhark_mc_segred_stage_1_parloop_struct_236157.free_gtid_211984 =
        gtid_211984;
    futhark_mc_segred_stage_1_parloop_struct_236157.free_mem_219336 =
        mem_219336.mem;
    futhark_mc_segred_stage_1_parloop_struct_236157.free_reduce_stage_1_tid_res_arr_mem_229095 =
        reduce_stage_1_tid_res_arr_mem_229095;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236158_task;
    
    futhark_mc_segred_stage_1_parloop_236158_task.name =
        "futhark_mc_segred_stage_1_parloop_236158";
    futhark_mc_segred_stage_1_parloop_236158_task.fn =
        futhark_mc_segred_stage_1_parloop_236158;
    futhark_mc_segred_stage_1_parloop_236158_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236157;
    futhark_mc_segred_stage_1_parloop_236158_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236158_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236158_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236158_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236158_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236158_task);
    
    if (futhark_mc_segred_stage_1_parloop_236158_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236158_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236158_total_end -
                 futhark_mc_segred_stage_1_parloop_236158_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236158_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236158_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236158_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_211986 = 0.0;
    }
    
    double x_229099;
    double x_229100;
    
    for (int32_t i_229102 = 0; i_229102 < num_tasks_229094; i_229102++) {
        flat_tid_229086 = i_229102;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229099 = defunc_2_reduce_res_211986;
            }
            // load next params
            {
                x_229100 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229095)[flat_tid_229086];
            }
            // red body
            {
                double defunc_1_op_res_229101 = x_229099 + x_229100;
                
                defunc_2_reduce_res_211986 = defunc_1_op_res_229101;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229095);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236155_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236155_end -
                 futhark_mc_segred_task_236155_start;
        
        ctx->futhark_mc_segred_task_236155_runs[tid]++;
        ctx->futhark_mc_segred_task_236155_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236155_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236154->retval_defunc_2_reduce_res_211986 =
            defunc_2_reduce_res_211986;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236153(void *args, int64_t start,
                                            int64_t end, int flat_tid_211983,
                                            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_p_203574 =
            futhark_mc_segmap_parloop_struct_236152->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236152->free_partition_sizze_203667;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236152->free_C_len_203724;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segmap_parloop_struct_236152->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219339 = {.desc ="mem_219339", .mem =
                                  futhark_mc_segmap_parloop_struct_236152->free_mem_219339,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229085 = start;
    
    for (; iter_229085 < end; iter_229085++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229092 = partition_sizze_203667;
        int64_t gtid_211984 = iter_229085;
        int64_t remnant_229093 = iter_229085 - gtid_211984;
        double defunc_2_reduce_res_211986;
        int64_t flat_tid_229086 = (int64_t) 0;
        int32_t num_tasks_229094;
        
        defunc_2_reduce_res_211986 = 0.0;
        
        struct futhark_mc_task_236154 futhark_mc_task_236154;
        
        futhark_mc_task_236154.ctx = ctx;
        futhark_mc_task_236154.free_C_len_203724 = C_len_203724;
        futhark_mc_task_236154.free_gtid_211984 = gtid_211984;
        futhark_mc_task_236154.free_mem_219336 = mem_219336.mem;
        futhark_mc_task_236154.retval_defunc_2_reduce_res_211986 =
            &defunc_2_reduce_res_211986;
        
        struct scheduler_segop futhark_mc_task_236154_task;
        
        futhark_mc_task_236154_task.args = &futhark_mc_task_236154;
        futhark_mc_task_236154_task.top_level_fn =
            futhark_mc_segred_task_236155;
        futhark_mc_task_236154_task.name = "futhark_mc_segred_task_236155";
        futhark_mc_task_236154_task.iterations = n_p_203574;
        futhark_mc_task_236154_task.task_time =
            &ctx->futhark_mc_segred_task_236155_total_time;
        futhark_mc_task_236154_task.task_iter =
            &ctx->futhark_mc_segred_task_236155_total_iter;
        futhark_mc_task_236154_task.sched = STATIC;
        futhark_mc_task_236154_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236155_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236154_task);
        
        if (futhark_mc_segred_task_236155_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219339.mem)[gtid_211984] = defunc_2_reduce_res_211986;
    }
    
  cleanup:
    { }
    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_nested_task_236151(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211983 = tid;
    int num_tasks_229076 = info.nsubtasks;
    struct futhark_mc_task_236147 *futhark_mc_task_236147 =
                                  (struct futhark_mc_task_236147 *) args;
    struct futhark_context *ctx = futhark_mc_task_236147->ctx;
    uint64_t futhark_mc_segmap_nested_task_236151_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236151_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236147->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236147->free_partition_sizze_203667;
    int64_t C_len_203724 = futhark_mc_task_236147->free_C_len_203724;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236147->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219339 = {.desc ="mem_219339", .mem =
                                  futhark_mc_task_236147->free_mem_219339,
                                  .size =0, .references =NULL};
    int64_t iter_229085;
    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_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236152.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236152.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236152.free_mem_219336 = mem_219336.mem;
    futhark_mc_segmap_parloop_struct_236152.free_mem_219339 = mem_219339.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_nested_task_236151_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236151_end -
                 futhark_mc_segmap_nested_task_236151_start;
        
        ctx->futhark_mc_segmap_nested_task_236151_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236151_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236151_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236159 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    int64_t free_lifted_single_ma_l_arg_204224;
    unsigned char *free_mem_219336;
    unsigned char *free_mem_219339;
    int64_t free_bytes_219341;
    unsigned char *free_mem_219361;
};
struct futhark_mc_segmap_parloop_struct_236161 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    int64_t free_lifted_single_ma_l_arg_204224;
    unsigned char *free_mem_219336;
    unsigned char *free_mem_219339;
    int64_t free_bytes_219341;
    unsigned char *free_mem_219361;
};
static int futhark_mc_segmap_parloop_236162(void *args, int64_t start,
                                            int64_t end, int flat_tid_211993,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236161
    *futhark_mc_segmap_parloop_struct_236161 =
    (struct futhark_mc_segmap_parloop_struct_236161 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236161->ctx;
    uint64_t futhark_mc_segmap_parloop_236162_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236162_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236161->free_n_p_203574;
    double i64_res_203589 =
           futhark_mc_segmap_parloop_struct_236161->free_i64_res_203589;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236161->free_partition_sizze_203667;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236161->free_C_len_203724;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_segmap_parloop_struct_236161->free_lifted_single_ma_l_arg_204224;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segmap_parloop_struct_236161->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219339 = {.desc ="mem_219339", .mem =
                                  futhark_mc_segmap_parloop_struct_236161->free_mem_219339,
                                  .size =0, .references =NULL};
    int64_t bytes_219341 =
            futhark_mc_segmap_parloop_struct_236161->free_bytes_219341;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_segmap_parloop_struct_236161->free_mem_219361,
                                  .size =0, .references =NULL};
    size_t mem_219345_cached_sizze_236163 = 0;
    unsigned char *mem_219345 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229104 = start;
    
    if (mem_219345_cached_sizze_236163 < (size_t) bytes_219341) {
        mem_219345 = realloc(mem_219345, bytes_219341);
        mem_219345_cached_sizze_236163 = bytes_219341;
    }
    for (; iter_229104 < end; iter_229104++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229128 = partition_sizze_203667;
        int64_t gtid_211994 = iter_229104;
        int64_t remnant_229129 = iter_229104 - gtid_211994;
        double x_205181;
        
        x_205181 = ((double *) mem_219339.mem)[gtid_211994];
        
        double discard_216575;
        double scanacc_229106 = 0.0;
        
        for (int64_t i_229105 = 0; i_229105 < lifted_single_ma_l_arg_204224;
             i_229105++) {
            bool cond_229108 = i_229105 == (int64_t) 0;
            double defunc_0_f_res_229109;
            
            if (cond_229108) {
                double defunc_0_f_res_t_res_229110 = x_205181 / i64_res_203589;
                
                defunc_0_f_res_229109 = defunc_0_f_res_t_res_229110;
            } else {
                int64_t x_229111 = add64(n_p_203574, i_229105);
                int64_t i_229112 = sub64(x_229111, (int64_t) 1);
                bool x_229113 = sle64((int64_t) 0, i_229112);
                bool y_229114 = slt64(i_229112, C_len_203724);
                bool bounds_check_229115 = x_229113 && y_229114;
                bool index_certs_229116;
                
                if (!bounds_check_229115) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229112,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203724, "].",
                                  "-> #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_229117;
                
                x_229117 = ((double *) mem_219336.mem)[gtid_211994 *
                                                       C_len_203724 + i_229112];
                
                int64_t i_229118 = sub64(i_229105, (int64_t) 1);
                bool x_229119 = sle64((int64_t) 0, i_229118);
                bool y_229120 = slt64(i_229118, C_len_203724);
                bool bounds_check_229121 = x_229119 && y_229120;
                bool index_certs_229122;
                
                if (!bounds_check_229121) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229118,
                                  "] out of bounds for array of shape [",
                                  (long long) C_len_203724, "].",
                                  "-> #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_229123;
                
                y_229123 = ((double *) mem_219336.mem)[gtid_211994 *
                                                       C_len_203724 + i_229118];
                
                double x_229124 = x_229117 - y_229123;
                double defunc_0_f_res_f_res_229125 = x_229124 / i64_res_203589;
                
                defunc_0_f_res_229109 = defunc_0_f_res_f_res_229125;
            }
            
            double defunc_1_op_res_229126 = defunc_0_f_res_229109 +
                   scanacc_229106;
            
            ((double *) mem_219345)[i_229105] = defunc_1_op_res_229126;
            
            double scanacc_tmp_229130 = defunc_1_op_res_229126;
            
            scanacc_229106 = scanacc_tmp_229130;
        }
        discard_216575 = scanacc_229106;
        if (lifted_single_ma_l_arg_204224 * (int64_t) 8 > 0)
            memmove(mem_219361.mem + gtid_211994 *
                    lifted_single_ma_l_arg_204224 * (int64_t) 8, mem_219345 +
                    (int64_t) 0, lifted_single_ma_l_arg_204224 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219345);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236162_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236162_end -
                 futhark_mc_segmap_parloop_236162_start;
        
        ctx->futhark_mc_segmap_parloop_236162_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236162_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236162_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236160(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211993 = tid;
    int num_tasks_229103 = 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_segmap_task_236160_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236160_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236159->free_n_p_203574;
    double i64_res_203589 = futhark_mc_task_236159->free_i64_res_203589;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236159->free_partition_sizze_203667;
    int64_t C_len_203724 = futhark_mc_task_236159->free_C_len_203724;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_task_236159->free_lifted_single_ma_l_arg_204224;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236159->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219339 = {.desc ="mem_219339", .mem =
                                  futhark_mc_task_236159->free_mem_219339,
                                  .size =0, .references =NULL};
    int64_t bytes_219341 = futhark_mc_task_236159->free_bytes_219341;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_task_236159->free_mem_219361,
                                  .size =0, .references =NULL};
    int64_t iter_229104;
    struct futhark_mc_segmap_parloop_struct_236161
    futhark_mc_segmap_parloop_struct_236161;
    
    futhark_mc_segmap_parloop_struct_236161.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236161.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236161.free_i64_res_203589 =
        i64_res_203589;
    futhark_mc_segmap_parloop_struct_236161.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236161.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236161.free_lifted_single_ma_l_arg_204224 =
        lifted_single_ma_l_arg_204224;
    futhark_mc_segmap_parloop_struct_236161.free_mem_219336 = mem_219336.mem;
    futhark_mc_segmap_parloop_struct_236161.free_mem_219339 = mem_219339.mem;
    futhark_mc_segmap_parloop_struct_236161.free_bytes_219341 = bytes_219341;
    futhark_mc_segmap_parloop_struct_236161.free_mem_219361 = mem_219361.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236162_task;
    
    futhark_mc_segmap_parloop_236162_task.name =
        "futhark_mc_segmap_parloop_236162";
    futhark_mc_segmap_parloop_236162_task.fn = futhark_mc_segmap_parloop_236162;
    futhark_mc_segmap_parloop_236162_task.args =
        &futhark_mc_segmap_parloop_struct_236161;
    futhark_mc_segmap_parloop_236162_task.iterations = iterations;
    futhark_mc_segmap_parloop_236162_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236162_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236162_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236162_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236162_task);
    
    if (futhark_mc_segmap_parloop_236162_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236162_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236162_total_end -
                 futhark_mc_segmap_parloop_236162_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236162_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236162_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236162_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236160_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236160_end -
                 futhark_mc_segmap_task_236160_start;
        
        ctx->futhark_mc_segmap_task_236160_runs[tid]++;
        ctx->futhark_mc_segmap_task_236160_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236160_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236165 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    int64_t free_lifted_single_ma_l_arg_204224;
    unsigned char *free_mem_219336;
    unsigned char *free_mem_219339;
    int64_t free_bytes_219341;
    unsigned char *free_mem_219361;
};
struct futhark_mc_task_236168 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_C_len_203724;
    int64_t free_lifted_single_ma_l_arg_204224;
    int64_t free_gtid_212000;
    double free_x_212002;
    unsigned char *free_mem_219336;
    unsigned char *free_mem_219342;
};
struct futhark_mc_scan_stage_1_parloop_struct_236171 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_C_len_203724;
    int64_t free_gtid_212000;
    double free_x_212002;
    unsigned char *free_mem_219336;
    unsigned char *free_mem_219342;
};
static int futhark_mc_scan_stage_1_parloop_236172(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229133, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_236171
    *futhark_mc_scan_stage_1_parloop_struct_236171 =
    (struct futhark_mc_scan_stage_1_parloop_struct_236171 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_236171->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_236172_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236172_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_scan_stage_1_parloop_struct_236171->free_n_p_203574;
    double i64_res_203589 =
           futhark_mc_scan_stage_1_parloop_struct_236171->free_i64_res_203589;
    int64_t C_len_203724 =
            futhark_mc_scan_stage_1_parloop_struct_236171->free_C_len_203724;
    int64_t gtid_212000 =
            futhark_mc_scan_stage_1_parloop_struct_236171->free_gtid_212000;
    double x_212002 =
           futhark_mc_scan_stage_1_parloop_struct_236171->free_x_212002;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236171->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219342 = {.desc ="mem_219342", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236171->free_mem_219342,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229159 = start;
    double x_229135;
    double x_229136;
    
    x_229135 = 0.0;
    for (; iter_229159 < end; iter_229159++) {
        int64_t gtid_229134 = iter_229159;
        
        // stage 1 scan body
        {
            bool cond_229138 = gtid_229134 == (int64_t) 0;
            double defunc_0_f_res_229139;
            
            if (cond_229138) {
                double defunc_0_f_res_t_res_229140 = x_212002 / i64_res_203589;
                
                defunc_0_f_res_229139 = defunc_0_f_res_t_res_229140;
            } else {
                int64_t x_229141 = add64(n_p_203574, gtid_229134);
                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, C_len_203724);
                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) C_len_203724, "].",
                                  "-> #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_229147;
                
                x_229147 = ((double *) mem_219336.mem)[gtid_212000 *
                                                       C_len_203724 + i_229142];
                
                int64_t i_229148 = sub64(gtid_229134, (int64_t) 1);
                bool x_229149 = sle64((int64_t) 0, i_229148);
                bool y_229150 = slt64(i_229148, C_len_203724);
                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) C_len_203724, "].",
                                  "-> #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_229153;
                
                y_229153 = ((double *) mem_219336.mem)[gtid_212000 *
                                                       C_len_203724 + i_229148];
                
                double x_229154 = x_229147 - y_229153;
                double defunc_0_f_res_f_res_229155 = x_229154 / i64_res_203589;
                
                defunc_0_f_res_229139 = defunc_0_f_res_f_res_229155;
            }
            // write mapped values results to memory
            { }
            x_229135 = x_229135;
            // Read next values
            {
                x_229136 = defunc_0_f_res_229139;
            }
            
            double defunc_1_op_res_229137 = x_229135 + x_229136;
            
            ((double *) mem_219342.mem)[gtid_229134] = defunc_1_op_res_229137;
            x_229135 = defunc_1_op_res_229137;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236172_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236172_end -
                 futhark_mc_scan_stage_1_parloop_236172_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_236172_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_236172_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_236172_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_236173 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_C_len_203724;
    int64_t free_gtid_212000;
    double free_x_212002;
    unsigned char *free_mem_219336;
    unsigned char *free_mem_219342;
};
static int futhark_mc_scan_stage_3_parloop_236174(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229133, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_236173
    *futhark_mc_scan_stage_3_parloop_struct_236173 =
    (struct futhark_mc_scan_stage_3_parloop_struct_236173 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_236173->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_236174_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_236174_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_scan_stage_3_parloop_struct_236173->free_n_p_203574;
    double i64_res_203589 =
           futhark_mc_scan_stage_3_parloop_struct_236173->free_i64_res_203589;
    int64_t C_len_203724 =
            futhark_mc_scan_stage_3_parloop_struct_236173->free_C_len_203724;
    int64_t gtid_212000 =
            futhark_mc_scan_stage_3_parloop_struct_236173->free_gtid_212000;
    double x_212002 =
           futhark_mc_scan_stage_3_parloop_struct_236173->free_x_212002;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236173->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219342 = {.desc ="mem_219342", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236173->free_mem_219342,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229171 = start;
    double x_229168;
    double x_229169;
    
    if (iter_229171 == (int64_t) 0) {
        x_229168 = 0.0;
    } else {
        x_229168 = ((double *) mem_219342.mem)[iter_229171 - (int64_t) 1];
    }
    for (; iter_229171 < end; iter_229171++) {
        int64_t gtid_229134 = iter_229171;
        
        // stage 3 scan body
        {
            bool cond_229138 = gtid_229134 == (int64_t) 0;
            double defunc_0_f_res_229139;
            
            if (cond_229138) {
                double defunc_0_f_res_t_res_229140 = x_212002 / i64_res_203589;
                
                defunc_0_f_res_229139 = defunc_0_f_res_t_res_229140;
            } else {
                int64_t x_229141 = add64(n_p_203574, gtid_229134);
                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, C_len_203724);
                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) C_len_203724, "].",
                                  "-> #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_229147;
                
                x_229147 = ((double *) mem_219336.mem)[gtid_212000 *
                                                       C_len_203724 + i_229142];
                
                int64_t i_229148 = sub64(gtid_229134, (int64_t) 1);
                bool x_229149 = sle64((int64_t) 0, i_229148);
                bool y_229150 = slt64(i_229148, C_len_203724);
                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) C_len_203724, "].",
                                  "-> #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_229153;
                
                y_229153 = ((double *) mem_219336.mem)[gtid_212000 *
                                                       C_len_203724 + i_229148];
                
                double x_229154 = x_229147 - y_229153;
                double defunc_0_f_res_f_res_229155 = x_229154 / i64_res_203589;
                
                defunc_0_f_res_229139 = defunc_0_f_res_f_res_229155;
            }
            x_229168 = x_229168;
            x_229169 = defunc_0_f_res_229139;
            
            double defunc_1_op_res_229170 = x_229168 + x_229169;
            
            ((double *) mem_219342.mem)[gtid_229134] = defunc_1_op_res_229170;
            x_229168 = defunc_1_op_res_229170;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_236174_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_236174_end -
                 futhark_mc_scan_stage_3_parloop_236174_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_236174_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_236174_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_236174_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_236169(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229133 = tid;
    int num_tasks_229158 = info.nsubtasks;
    struct futhark_mc_task_236168 *futhark_mc_task_236168 =
                                  (struct futhark_mc_task_236168 *) args;
    struct futhark_context *ctx = futhark_mc_task_236168->ctx;
    uint64_t futhark_mc_segscan_task_236169_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_236169_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236168->free_n_p_203574;
    double i64_res_203589 = futhark_mc_task_236168->free_i64_res_203589;
    int64_t C_len_203724 = futhark_mc_task_236168->free_C_len_203724;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_task_236168->free_lifted_single_ma_l_arg_204224;
    int64_t gtid_212000 = futhark_mc_task_236168->free_gtid_212000;
    double x_212002 = futhark_mc_task_236168->free_x_212002;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236168->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219342 = {.desc ="mem_219342", .mem =
                                  futhark_mc_task_236168->free_mem_219342,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_229165_cached_sizze_236170 = 0;
    unsigned char *scan_stage_2_accum_mem_229165 = NULL;
    int64_t iter_229159;
    struct futhark_mc_scan_stage_1_parloop_struct_236171
    futhark_mc_scan_stage_1_parloop_struct_236171;
    
    futhark_mc_scan_stage_1_parloop_struct_236171.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_236171.free_n_p_203574 = n_p_203574;
    futhark_mc_scan_stage_1_parloop_struct_236171.free_i64_res_203589 =
        i64_res_203589;
    futhark_mc_scan_stage_1_parloop_struct_236171.free_C_len_203724 =
        C_len_203724;
    futhark_mc_scan_stage_1_parloop_struct_236171.free_gtid_212000 =
        gtid_212000;
    futhark_mc_scan_stage_1_parloop_struct_236171.free_x_212002 = x_212002;
    futhark_mc_scan_stage_1_parloop_struct_236171.free_mem_219336 =
        mem_219336.mem;
    futhark_mc_scan_stage_1_parloop_struct_236171.free_mem_219342 =
        mem_219342.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_236172_task;
    
    futhark_mc_scan_stage_1_parloop_236172_task.name =
        "futhark_mc_scan_stage_1_parloop_236172";
    futhark_mc_scan_stage_1_parloop_236172_task.fn =
        futhark_mc_scan_stage_1_parloop_236172;
    futhark_mc_scan_stage_1_parloop_236172_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_236171;
    futhark_mc_scan_stage_1_parloop_236172_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_236172_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_236172_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236172_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_236172_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_236172_task);
    
    if (futhark_mc_scan_stage_1_parloop_236172_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236172_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236172_total_end -
                 futhark_mc_scan_stage_1_parloop_236172_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236172_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236172_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236172_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_229158)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        double x_229160;
        double x_229161;
        int64_t offset_229163 = (int64_t) 0;
        int64_t offset_index_229164 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_229165_cached_sizze_236170 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_229165 =
                realloc(scan_stage_2_accum_mem_229165, (int64_t) 8);
            scan_stage_2_accum_mem_229165_cached_sizze_236170 = (int64_t) 8;
        }
        ((double *) scan_stage_2_accum_mem_229165)[(int64_t) 0] = 0.0;
        for (int32_t i_229167 = 0; i_229167 < num_tasks_229158 - 1;
             i_229167++) {
            offset_229163 = squot64(lifted_single_ma_l_arg_204224,
                                    sext_i32_i64(num_tasks_229158));
            if (slt64(sext_i32_i64(i_229167),
                      srem64(lifted_single_ma_l_arg_204224,
                             sext_i32_i64(num_tasks_229158)))) {
                offset_229163 += (int64_t) 1;
            }
            offset_index_229164 += offset_229163;
            
            int64_t gtid_229134 = offset_index_229164;
            bool cond_229138 = gtid_229134 == (int64_t) 0;
            double defunc_0_f_res_229139;
            
            if (cond_229138) {
                double defunc_0_f_res_t_res_229140 = x_212002 / i64_res_203589;
                
                defunc_0_f_res_229139 = defunc_0_f_res_t_res_229140;
            } else {
                int64_t x_229141 = add64(n_p_203574, gtid_229134);
                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, C_len_203724);
                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) C_len_203724, "].",
                                  "-> #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_229147;
                
                x_229147 = ((double *) mem_219336.mem)[gtid_212000 *
                                                       C_len_203724 + i_229142];
                
                int64_t i_229148 = sub64(gtid_229134, (int64_t) 1);
                bool x_229149 = sle64((int64_t) 0, i_229148);
                bool y_229150 = slt64(i_229148, C_len_203724);
                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) C_len_203724, "].",
                                  "-> #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_229153;
                
                y_229153 = ((double *) mem_219336.mem)[gtid_212000 *
                                                       C_len_203724 + i_229148];
                
                double x_229154 = x_229147 - y_229153;
                double defunc_0_f_res_f_res_229155 = x_229154 / i64_res_203589;
                
                defunc_0_f_res_229139 = defunc_0_f_res_f_res_229155;
            }
            // Read carry in
            {
                x_229160 =
                    ((double *) scan_stage_2_accum_mem_229165)[(int64_t) 0];
            }
            // Read next values
            {
                x_229161 = ((double *) mem_219342.mem)[offset_index_229164 -
                                                       (int64_t) 1];
            }
            
            double defunc_1_op_res_229162 = x_229160 + x_229161;
            
            ((double *) mem_219342.mem)[offset_index_229164 - (int64_t) 1] =
                defunc_1_op_res_229162;
            ((double *) scan_stage_2_accum_mem_229165)[(int64_t) 0] =
                defunc_1_op_res_229162;
        }
        
        int64_t iter_229171 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_236173
        futhark_mc_scan_stage_3_parloop_struct_236173;
        
        futhark_mc_scan_stage_3_parloop_struct_236173.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_236173.free_n_p_203574 =
            n_p_203574;
        futhark_mc_scan_stage_3_parloop_struct_236173.free_i64_res_203589 =
            i64_res_203589;
        futhark_mc_scan_stage_3_parloop_struct_236173.free_C_len_203724 =
            C_len_203724;
        futhark_mc_scan_stage_3_parloop_struct_236173.free_gtid_212000 =
            gtid_212000;
        futhark_mc_scan_stage_3_parloop_struct_236173.free_x_212002 = x_212002;
        futhark_mc_scan_stage_3_parloop_struct_236173.free_mem_219336 =
            mem_219336.mem;
        futhark_mc_scan_stage_3_parloop_struct_236173.free_mem_219342 =
            mem_219342.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_236174_task;
        
        futhark_mc_scan_stage_3_parloop_236174_task.name =
            "futhark_mc_scan_stage_3_parloop_236174";
        futhark_mc_scan_stage_3_parloop_236174_task.fn =
            futhark_mc_scan_stage_3_parloop_236174;
        futhark_mc_scan_stage_3_parloop_236174_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_236173;
        futhark_mc_scan_stage_3_parloop_236174_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_236174_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_236174_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_236174_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_236174_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_236174_task);
        
        if (futhark_mc_scan_stage_3_parloop_236174_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_236174_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_236174_total_end -
                     futhark_mc_scan_stage_3_parloop_236174_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236174_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236174_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236174_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_229165);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_236169_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_236169_end -
                 futhark_mc_segscan_task_236169_start;
        
        ctx->futhark_mc_segscan_task_236169_runs[tid]++;
        ctx->futhark_mc_segscan_task_236169_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_236169_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236166(void *args, int64_t start,
                                            int64_t end, int flat_tid_211999,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236165
    *futhark_mc_segmap_parloop_struct_236165 =
    (struct futhark_mc_segmap_parloop_struct_236165 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236165->ctx;
    uint64_t futhark_mc_segmap_parloop_236166_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236166_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236165->free_n_p_203574;
    double i64_res_203589 =
           futhark_mc_segmap_parloop_struct_236165->free_i64_res_203589;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236165->free_partition_sizze_203667;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236165->free_C_len_203724;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_segmap_parloop_struct_236165->free_lifted_single_ma_l_arg_204224;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segmap_parloop_struct_236165->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219339 = {.desc ="mem_219339", .mem =
                                  futhark_mc_segmap_parloop_struct_236165->free_mem_219339,
                                  .size =0, .references =NULL};
    int64_t bytes_219341 =
            futhark_mc_segmap_parloop_struct_236165->free_bytes_219341;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_segmap_parloop_struct_236165->free_mem_219361,
                                  .size =0, .references =NULL};
    size_t mem_219342_cached_sizze_236167 = 0;
    unsigned char *mem_219342 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229132 = start;
    
    if (mem_219342_cached_sizze_236167 < (size_t) bytes_219341) {
        mem_219342 = realloc(mem_219342, bytes_219341);
        mem_219342_cached_sizze_236167 = bytes_219341;
    }
    for (; iter_229132 < end; iter_229132++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229156 = partition_sizze_203667;
        int64_t gtid_212000 = iter_229132;
        int64_t remnant_229157 = iter_229132 - gtid_212000;
        double x_212002;
        
        x_212002 = ((double *) mem_219339.mem)[gtid_212000];
        
        int64_t flat_tid_229133 = (int64_t) 0;
        int32_t num_tasks_229158;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_236168 futhark_mc_task_236168;
        
        futhark_mc_task_236168.ctx = ctx;
        futhark_mc_task_236168.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236168.free_i64_res_203589 = i64_res_203589;
        futhark_mc_task_236168.free_C_len_203724 = C_len_203724;
        futhark_mc_task_236168.free_lifted_single_ma_l_arg_204224 =
            lifted_single_ma_l_arg_204224;
        futhark_mc_task_236168.free_gtid_212000 = gtid_212000;
        futhark_mc_task_236168.free_x_212002 = x_212002;
        futhark_mc_task_236168.free_mem_219336 = mem_219336.mem;
        futhark_mc_task_236168.free_mem_219342 = mem_219342;
        
        struct scheduler_segop futhark_mc_task_236168_task;
        
        futhark_mc_task_236168_task.args = &futhark_mc_task_236168;
        futhark_mc_task_236168_task.top_level_fn =
            futhark_mc_segscan_task_236169;
        futhark_mc_task_236168_task.name = "futhark_mc_segscan_task_236169";
        futhark_mc_task_236168_task.iterations = lifted_single_ma_l_arg_204224;
        futhark_mc_task_236168_task.task_time =
            &ctx->futhark_mc_segscan_task_236169_total_time;
        futhark_mc_task_236168_task.task_iter =
            &ctx->futhark_mc_segscan_task_236169_total_iter;
        futhark_mc_task_236168_task.sched = STATIC;
        futhark_mc_task_236168_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_236169_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236168_task);
        
        if (futhark_mc_segscan_task_236169_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (lifted_single_ma_l_arg_204224 * (int64_t) 8 > 0)
            memmove(mem_219361.mem + gtid_212000 *
                    lifted_single_ma_l_arg_204224 * (int64_t) 8, mem_219342 +
                    (int64_t) 0, lifted_single_ma_l_arg_204224 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219342);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236166_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236166_end -
                 futhark_mc_segmap_parloop_236166_start;
        
        ctx->futhark_mc_segmap_parloop_236166_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236166_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236166_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236164(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_211999 = tid;
    int num_tasks_229103 = 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_segmap_nested_task_236164_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236164_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236159->free_n_p_203574;
    double i64_res_203589 = futhark_mc_task_236159->free_i64_res_203589;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236159->free_partition_sizze_203667;
    int64_t C_len_203724 = futhark_mc_task_236159->free_C_len_203724;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_task_236159->free_lifted_single_ma_l_arg_204224;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236159->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock mem_219339 = {.desc ="mem_219339", .mem =
                                  futhark_mc_task_236159->free_mem_219339,
                                  .size =0, .references =NULL};
    int64_t bytes_219341 = futhark_mc_task_236159->free_bytes_219341;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_task_236159->free_mem_219361,
                                  .size =0, .references =NULL};
    int64_t iter_229132;
    struct futhark_mc_segmap_parloop_struct_236165
    futhark_mc_segmap_parloop_struct_236165;
    
    futhark_mc_segmap_parloop_struct_236165.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236165.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236165.free_i64_res_203589 =
        i64_res_203589;
    futhark_mc_segmap_parloop_struct_236165.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236165.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236165.free_lifted_single_ma_l_arg_204224 =
        lifted_single_ma_l_arg_204224;
    futhark_mc_segmap_parloop_struct_236165.free_mem_219336 = mem_219336.mem;
    futhark_mc_segmap_parloop_struct_236165.free_mem_219339 = mem_219339.mem;
    futhark_mc_segmap_parloop_struct_236165.free_bytes_219341 = bytes_219341;
    futhark_mc_segmap_parloop_struct_236165.free_mem_219361 = mem_219361.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236166_task;
    
    futhark_mc_segmap_parloop_236166_task.name =
        "futhark_mc_segmap_parloop_236166";
    futhark_mc_segmap_parloop_236166_task.fn = futhark_mc_segmap_parloop_236166;
    futhark_mc_segmap_parloop_236166_task.args =
        &futhark_mc_segmap_parloop_struct_236165;
    futhark_mc_segmap_parloop_236166_task.iterations = iterations;
    futhark_mc_segmap_parloop_236166_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236166_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236166_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236166_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236166_task);
    
    if (futhark_mc_segmap_parloop_236166_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236166_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236166_total_end -
                 futhark_mc_segmap_parloop_236166_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236166_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236166_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236166_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236164_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236164_end -
                 futhark_mc_segmap_nested_task_236164_start;
        
        ctx->futhark_mc_segmap_nested_task_236164_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236164_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236164_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236175 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_lifted_single_ma_l_arg_204224;
    unsigned char *free_mem_219361;
    unsigned char *free_mem_219364;
};
struct futhark_mc_segmap_parloop_struct_236177 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_lifted_single_ma_l_arg_204224;
    unsigned char *free_mem_219361;
    unsigned char *free_mem_219364;
};
static int futhark_mc_segmap_parloop_236178(void *args, int64_t start,
                                            int64_t end, int flat_tid_212028,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236177
    *futhark_mc_segmap_parloop_struct_236177 =
    (struct futhark_mc_segmap_parloop_struct_236177 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236177->ctx;
    uint64_t futhark_mc_segmap_parloop_236178_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236178_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236177->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236177->free_partition_sizze_203667;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_segmap_parloop_struct_236177->free_lifted_single_ma_l_arg_204224;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_segmap_parloop_struct_236177->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219364 = {.desc ="mem_219364", .mem =
                                  futhark_mc_segmap_parloop_struct_236177->free_mem_219364,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229173 = start;
    
    for (; iter_229173 < end; iter_229173++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229178 = partition_sizze_203667;
        int64_t gtid_212029 = iter_229173;
        int64_t remnant_229179 = iter_229173 - gtid_212029;
        double defunc_2_reduce_res_205209;
        double redout_229175 = 0.0;
        
        for (int64_t i_229174 = 0; i_229174 < n_p_203574; i_229174++) {
            double x_229176;
            
            x_229176 = ((double *) mem_219361.mem)[gtid_212029 *
                                                   lifted_single_ma_l_arg_204224 +
                                                   i_229174];
            
            double defunc_1_op_res_229177 = x_229176 + redout_229175;
            double redout_tmp_229180 = defunc_1_op_res_229177;
            
            redout_229175 = redout_tmp_229180;
        }
        defunc_2_reduce_res_205209 = redout_229175;
        ((double *) mem_219364.mem)[gtid_212029] = defunc_2_reduce_res_205209;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236178_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236178_end -
                 futhark_mc_segmap_parloop_236178_start;
        
        ctx->futhark_mc_segmap_parloop_236178_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236178_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236178_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236176(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212028 = tid;
    int num_tasks_229172 = info.nsubtasks;
    struct futhark_mc_task_236175 *futhark_mc_task_236175 =
                                  (struct futhark_mc_task_236175 *) args;
    struct futhark_context *ctx = futhark_mc_task_236175->ctx;
    uint64_t futhark_mc_segmap_task_236176_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236176_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236175->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236175->free_partition_sizze_203667;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_task_236175->free_lifted_single_ma_l_arg_204224;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_task_236175->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219364 = {.desc ="mem_219364", .mem =
                                  futhark_mc_task_236175->free_mem_219364,
                                  .size =0, .references =NULL};
    int64_t iter_229173;
    struct futhark_mc_segmap_parloop_struct_236177
    futhark_mc_segmap_parloop_struct_236177;
    
    futhark_mc_segmap_parloop_struct_236177.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236177.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236177.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236177.free_lifted_single_ma_l_arg_204224 =
        lifted_single_ma_l_arg_204224;
    futhark_mc_segmap_parloop_struct_236177.free_mem_219361 = mem_219361.mem;
    futhark_mc_segmap_parloop_struct_236177.free_mem_219364 = mem_219364.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236178_task;
    
    futhark_mc_segmap_parloop_236178_task.name =
        "futhark_mc_segmap_parloop_236178";
    futhark_mc_segmap_parloop_236178_task.fn = futhark_mc_segmap_parloop_236178;
    futhark_mc_segmap_parloop_236178_task.args =
        &futhark_mc_segmap_parloop_struct_236177;
    futhark_mc_segmap_parloop_236178_task.iterations = iterations;
    futhark_mc_segmap_parloop_236178_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236178_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236178_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236178_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236178_task);
    
    if (futhark_mc_segmap_parloop_236178_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236178_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236178_total_end -
                 futhark_mc_segmap_parloop_236178_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236178_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236178_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236178_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236176_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236176_end -
                 futhark_mc_segmap_task_236176_start;
        
        ctx->futhark_mc_segmap_task_236176_runs[tid]++;
        ctx->futhark_mc_segmap_task_236176_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236176_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236180 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_lifted_single_ma_l_arg_204224;
    unsigned char *free_mem_219361;
    unsigned char *free_mem_219364;
};
struct futhark_mc_task_236182 {
    struct futhark_context *ctx;
    int64_t free_lifted_single_ma_l_arg_204224;
    int64_t free_gtid_212035;
    unsigned char *free_mem_219361;
    double *retval_defunc_2_reduce_res_212037;
};
struct futhark_mc_segred_stage_1_parloop_struct_236185 {
    struct futhark_context *ctx;
    int64_t free_lifted_single_ma_l_arg_204224;
    int64_t free_gtid_212035;
    unsigned char *free_mem_219361;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229191;
};
static int futhark_mc_segred_stage_1_parloop_236186(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229182,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236185
    *futhark_mc_segred_stage_1_parloop_struct_236185 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236185 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236185->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236186_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236186_start = get_wall_time();
    
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_segred_stage_1_parloop_struct_236185->free_lifted_single_ma_l_arg_204224;
    int64_t gtid_212035 =
            futhark_mc_segred_stage_1_parloop_struct_236185->free_gtid_212035;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236185->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_229191 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229191",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236185->free_reduce_stage_1_tid_res_arr_mem_229191,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229193 = start;
    double x_229184;
    double x_229185;
    double local_acc_229194 = 0.0;
    
    for (; iter_229193 < end; iter_229193++) {
        int64_t gtid_229183 = iter_229193;
        double x_229187;
        
        x_229187 = ((double *) mem_219361.mem)[gtid_212035 *
                                               lifted_single_ma_l_arg_204224 +
                                               gtid_229183];
        // save map-out results
        { }
        // Load accum params
        {
            x_229184 = local_acc_229194;
        }
        // Load next params
        {
            x_229185 = x_229187;
        }
        // Red body
        {
            double defunc_1_op_res_229186 = x_229184 + x_229185;
            
            local_acc_229194 = defunc_1_op_res_229186;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229191.mem)[flat_tid_229182] =
        local_acc_229194;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236186_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236186_end -
                 futhark_mc_segred_stage_1_parloop_236186_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236186_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236186_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236186_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236183(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229182 = tid;
    int num_tasks_229190 = 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_segred_task_236183_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236183_start = get_wall_time();
    
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_task_236182->free_lifted_single_ma_l_arg_204224;
    int64_t gtid_212035 = futhark_mc_task_236182->free_gtid_212035;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_task_236182->free_mem_219361,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_212037 =
           *futhark_mc_task_236182->retval_defunc_2_reduce_res_212037;
    size_t reduce_stage_1_tid_res_arr_mem_229191_cached_sizze_236184 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229191 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229191_cached_sizze_236184 <
        (size_t) ((int64_t) 8 * num_tasks_229190)) {
        reduce_stage_1_tid_res_arr_mem_229191 =
            realloc(reduce_stage_1_tid_res_arr_mem_229191, (int64_t) 8 *
                    num_tasks_229190);
        reduce_stage_1_tid_res_arr_mem_229191_cached_sizze_236184 =
            (int64_t) 8 * num_tasks_229190;
    }
    
    int64_t iter_229193;
    struct futhark_mc_segred_stage_1_parloop_struct_236185
    futhark_mc_segred_stage_1_parloop_struct_236185;
    
    futhark_mc_segred_stage_1_parloop_struct_236185.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236185.free_lifted_single_ma_l_arg_204224 =
        lifted_single_ma_l_arg_204224;
    futhark_mc_segred_stage_1_parloop_struct_236185.free_gtid_212035 =
        gtid_212035;
    futhark_mc_segred_stage_1_parloop_struct_236185.free_mem_219361 =
        mem_219361.mem;
    futhark_mc_segred_stage_1_parloop_struct_236185.free_reduce_stage_1_tid_res_arr_mem_229191 =
        reduce_stage_1_tid_res_arr_mem_229191;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236186_task;
    
    futhark_mc_segred_stage_1_parloop_236186_task.name =
        "futhark_mc_segred_stage_1_parloop_236186";
    futhark_mc_segred_stage_1_parloop_236186_task.fn =
        futhark_mc_segred_stage_1_parloop_236186;
    futhark_mc_segred_stage_1_parloop_236186_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236185;
    futhark_mc_segred_stage_1_parloop_236186_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236186_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236186_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236186_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236186_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236186_task);
    
    if (futhark_mc_segred_stage_1_parloop_236186_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236186_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236186_total_end -
                 futhark_mc_segred_stage_1_parloop_236186_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236186_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236186_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236186_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_212037 = 0.0;
    }
    
    double x_229195;
    double x_229196;
    
    for (int32_t i_229198 = 0; i_229198 < num_tasks_229190; i_229198++) {
        flat_tid_229182 = i_229198;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229195 = defunc_2_reduce_res_212037;
            }
            // load next params
            {
                x_229196 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229191)[flat_tid_229182];
            }
            // red body
            {
                double defunc_1_op_res_229197 = x_229195 + x_229196;
                
                defunc_2_reduce_res_212037 = defunc_1_op_res_229197;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229191);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236183_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236183_end -
                 futhark_mc_segred_task_236183_start;
        
        ctx->futhark_mc_segred_task_236183_runs[tid]++;
        ctx->futhark_mc_segred_task_236183_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236183_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236182->retval_defunc_2_reduce_res_212037 =
            defunc_2_reduce_res_212037;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236181(void *args, int64_t start,
                                            int64_t end, int flat_tid_212034,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236180
    *futhark_mc_segmap_parloop_struct_236180 =
    (struct futhark_mc_segmap_parloop_struct_236180 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236180->ctx;
    uint64_t futhark_mc_segmap_parloop_236181_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236181_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236180->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236180->free_partition_sizze_203667;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_segmap_parloop_struct_236180->free_lifted_single_ma_l_arg_204224;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_segmap_parloop_struct_236180->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219364 = {.desc ="mem_219364", .mem =
                                  futhark_mc_segmap_parloop_struct_236180->free_mem_219364,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229181 = start;
    
    for (; iter_229181 < end; iter_229181++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229188 = partition_sizze_203667;
        int64_t gtid_212035 = iter_229181;
        int64_t remnant_229189 = iter_229181 - gtid_212035;
        double defunc_2_reduce_res_212037;
        int64_t flat_tid_229182 = (int64_t) 0;
        int32_t num_tasks_229190;
        
        defunc_2_reduce_res_212037 = 0.0;
        
        struct futhark_mc_task_236182 futhark_mc_task_236182;
        
        futhark_mc_task_236182.ctx = ctx;
        futhark_mc_task_236182.free_lifted_single_ma_l_arg_204224 =
            lifted_single_ma_l_arg_204224;
        futhark_mc_task_236182.free_gtid_212035 = gtid_212035;
        futhark_mc_task_236182.free_mem_219361 = mem_219361.mem;
        futhark_mc_task_236182.retval_defunc_2_reduce_res_212037 =
            &defunc_2_reduce_res_212037;
        
        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_segred_task_236183;
        futhark_mc_task_236182_task.name = "futhark_mc_segred_task_236183";
        futhark_mc_task_236182_task.iterations = n_p_203574;
        futhark_mc_task_236182_task.task_time =
            &ctx->futhark_mc_segred_task_236183_total_time;
        futhark_mc_task_236182_task.task_iter =
            &ctx->futhark_mc_segred_task_236183_total_iter;
        futhark_mc_task_236182_task.sched = STATIC;
        futhark_mc_task_236182_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236183_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236182_task);
        
        if (futhark_mc_segred_task_236183_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219364.mem)[gtid_212035] = defunc_2_reduce_res_212037;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236181_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236181_end -
                 futhark_mc_segmap_parloop_236181_start;
        
        ctx->futhark_mc_segmap_parloop_236181_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236181_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236181_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236179(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212034 = tid;
    int num_tasks_229172 = info.nsubtasks;
    struct futhark_mc_task_236175 *futhark_mc_task_236175 =
                                  (struct futhark_mc_task_236175 *) args;
    struct futhark_context *ctx = futhark_mc_task_236175->ctx;
    uint64_t futhark_mc_segmap_nested_task_236179_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236179_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236175->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236175->free_partition_sizze_203667;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_task_236175->free_lifted_single_ma_l_arg_204224;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_task_236175->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219364 = {.desc ="mem_219364", .mem =
                                  futhark_mc_task_236175->free_mem_219364,
                                  .size =0, .references =NULL};
    int64_t iter_229181;
    struct futhark_mc_segmap_parloop_struct_236180
    futhark_mc_segmap_parloop_struct_236180;
    
    futhark_mc_segmap_parloop_struct_236180.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236180.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236180.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236180.free_lifted_single_ma_l_arg_204224 =
        lifted_single_ma_l_arg_204224;
    futhark_mc_segmap_parloop_struct_236180.free_mem_219361 = mem_219361.mem;
    futhark_mc_segmap_parloop_struct_236180.free_mem_219364 = mem_219364.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236181_task;
    
    futhark_mc_segmap_parloop_236181_task.name =
        "futhark_mc_segmap_parloop_236181";
    futhark_mc_segmap_parloop_236181_task.fn = futhark_mc_segmap_parloop_236181;
    futhark_mc_segmap_parloop_236181_task.args =
        &futhark_mc_segmap_parloop_struct_236180;
    futhark_mc_segmap_parloop_236181_task.iterations = iterations;
    futhark_mc_segmap_parloop_236181_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236181_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236181_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236181_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236181_task);
    
    if (futhark_mc_segmap_parloop_236181_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236181_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236181_total_end -
                 futhark_mc_segmap_parloop_236181_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236181_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236181_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236181_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236179_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236179_end -
                 futhark_mc_segmap_nested_task_236179_start;
        
        ctx->futhark_mc_segmap_nested_task_236179_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236179_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236179_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236187 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_partition_sizze_203667;
    int64_t free_lifted_single_ma_l_arg_204224;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    unsigned char *free_mem_219361;
    unsigned char *free_mem_219364;
    int64_t free_bytes_219366;
    unsigned char *free_mem_219386;
};
struct futhark_mc_segmap_parloop_struct_236189 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_partition_sizze_203667;
    int64_t free_lifted_single_ma_l_arg_204224;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    unsigned char *free_mem_219361;
    unsigned char *free_mem_219364;
    int64_t free_bytes_219366;
    unsigned char *free_mem_219386;
};
static int futhark_mc_segmap_parloop_236190(void *args, int64_t start,
                                            int64_t end, int flat_tid_212044,
                                            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_p_203574 =
            futhark_mc_segmap_parloop_struct_236189->free_n_p_203574;
    double i64_res_203589 =
           futhark_mc_segmap_parloop_struct_236189->free_i64_res_203589;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236189->free_partition_sizze_203667;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_segmap_parloop_struct_236189->free_lifted_single_ma_l_arg_204224;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_segmap_parloop_struct_236189->free_dyn_lifted_single_ma_l_arg_204234;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_segmap_parloop_struct_236189->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219364 = {.desc ="mem_219364", .mem =
                                  futhark_mc_segmap_parloop_struct_236189->free_mem_219364,
                                  .size =0, .references =NULL};
    int64_t bytes_219366 =
            futhark_mc_segmap_parloop_struct_236189->free_bytes_219366;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_segmap_parloop_struct_236189->free_mem_219386,
                                  .size =0, .references =NULL};
    size_t mem_219370_cached_sizze_236191 = 0;
    unsigned char *mem_219370 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229200 = start;
    
    if (mem_219370_cached_sizze_236191 < (size_t) bytes_219366) {
        mem_219370 = realloc(mem_219370, bytes_219366);
        mem_219370_cached_sizze_236191 = bytes_219366;
    }
    for (; iter_229200 < end; iter_229200++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229224 = partition_sizze_203667;
        int64_t gtid_212045 = iter_229200;
        int64_t remnant_229225 = iter_229200 - gtid_212045;
        double x_205217;
        
        x_205217 = ((double *) mem_219364.mem)[gtid_212045];
        
        double discard_216583;
        double scanacc_229202 = 0.0;
        
        for (int64_t i_229201 = 0; i_229201 < dyn_lifted_single_ma_l_arg_204234;
             i_229201++) {
            bool cond_229204 = i_229201 == (int64_t) 0;
            double defunc_0_f_res_229205;
            
            if (cond_229204) {
                double defunc_0_f_res_t_res_229206 = x_205217 / i64_res_203589;
                
                defunc_0_f_res_229205 = defunc_0_f_res_t_res_229206;
            } else {
                int64_t x_229207 = add64(n_p_203574, i_229201);
                int64_t i_229208 = sub64(x_229207, (int64_t) 1);
                bool x_229209 = sle64((int64_t) 0, i_229208);
                bool y_229210 = slt64(i_229208, lifted_single_ma_l_arg_204224);
                bool bounds_check_229211 = x_229209 && y_229210;
                bool index_certs_229212;
                
                if (!bounds_check_229211) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229208,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204224,
                                  "].",
                                  "-> #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_229213;
                
                x_229213 = ((double *) mem_219361.mem)[gtid_212045 *
                                                       lifted_single_ma_l_arg_204224 +
                                                       i_229208];
                
                int64_t i_229214 = sub64(i_229201, (int64_t) 1);
                bool x_229215 = sle64((int64_t) 0, i_229214);
                bool y_229216 = slt64(i_229214, lifted_single_ma_l_arg_204224);
                bool bounds_check_229217 = x_229215 && y_229216;
                bool index_certs_229218;
                
                if (!bounds_check_229217) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229214,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204224,
                                  "].",
                                  "-> #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_229219;
                
                y_229219 = ((double *) mem_219361.mem)[gtid_212045 *
                                                       lifted_single_ma_l_arg_204224 +
                                                       i_229214];
                
                double x_229220 = x_229213 - y_229219;
                double defunc_0_f_res_f_res_229221 = x_229220 / i64_res_203589;
                
                defunc_0_f_res_229205 = defunc_0_f_res_f_res_229221;
            }
            
            double defunc_1_op_res_229222 = defunc_0_f_res_229205 +
                   scanacc_229202;
            
            ((double *) mem_219370)[i_229201] = defunc_1_op_res_229222;
            
            double scanacc_tmp_229226 = defunc_1_op_res_229222;
            
            scanacc_229202 = scanacc_tmp_229226;
        }
        discard_216583 = scanacc_229202;
        if (dyn_lifted_single_ma_l_arg_204234 * (int64_t) 8 > 0)
            memmove(mem_219386.mem + gtid_212045 *
                    dyn_lifted_single_ma_l_arg_204234 * (int64_t) 8,
                    mem_219370 + (int64_t) 0,
                    dyn_lifted_single_ma_l_arg_204234 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219370);
    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_task_236188(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212044 = tid;
    int num_tasks_229199 = info.nsubtasks;
    struct futhark_mc_task_236187 *futhark_mc_task_236187 =
                                  (struct futhark_mc_task_236187 *) args;
    struct futhark_context *ctx = futhark_mc_task_236187->ctx;
    uint64_t futhark_mc_segmap_task_236188_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236188_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236187->free_n_p_203574;
    double i64_res_203589 = futhark_mc_task_236187->free_i64_res_203589;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236187->free_partition_sizze_203667;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_task_236187->free_lifted_single_ma_l_arg_204224;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_task_236187->free_dyn_lifted_single_ma_l_arg_204234;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_task_236187->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219364 = {.desc ="mem_219364", .mem =
                                  futhark_mc_task_236187->free_mem_219364,
                                  .size =0, .references =NULL};
    int64_t bytes_219366 = futhark_mc_task_236187->free_bytes_219366;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_task_236187->free_mem_219386,
                                  .size =0, .references =NULL};
    int64_t iter_229200;
    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_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236189.free_i64_res_203589 =
        i64_res_203589;
    futhark_mc_segmap_parloop_struct_236189.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236189.free_lifted_single_ma_l_arg_204224 =
        lifted_single_ma_l_arg_204224;
    futhark_mc_segmap_parloop_struct_236189.free_dyn_lifted_single_ma_l_arg_204234 =
        dyn_lifted_single_ma_l_arg_204234;
    futhark_mc_segmap_parloop_struct_236189.free_mem_219361 = mem_219361.mem;
    futhark_mc_segmap_parloop_struct_236189.free_mem_219364 = mem_219364.mem;
    futhark_mc_segmap_parloop_struct_236189.free_bytes_219366 = bytes_219366;
    futhark_mc_segmap_parloop_struct_236189.free_mem_219386 = mem_219386.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_task_236188_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236188_end -
                 futhark_mc_segmap_task_236188_start;
        
        ctx->futhark_mc_segmap_task_236188_runs[tid]++;
        ctx->futhark_mc_segmap_task_236188_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236188_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236193 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_partition_sizze_203667;
    int64_t free_lifted_single_ma_l_arg_204224;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    unsigned char *free_mem_219361;
    unsigned char *free_mem_219364;
    int64_t free_bytes_219366;
    unsigned char *free_mem_219386;
};
struct futhark_mc_task_236196 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_lifted_single_ma_l_arg_204224;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    int64_t free_gtid_212051;
    double free_x_212053;
    unsigned char *free_mem_219361;
    unsigned char *free_mem_219367;
};
struct futhark_mc_scan_stage_1_parloop_struct_236199 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_lifted_single_ma_l_arg_204224;
    int64_t free_gtid_212051;
    double free_x_212053;
    unsigned char *free_mem_219361;
    unsigned char *free_mem_219367;
};
static int futhark_mc_scan_stage_1_parloop_236200(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229229, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_236199
    *futhark_mc_scan_stage_1_parloop_struct_236199 =
    (struct futhark_mc_scan_stage_1_parloop_struct_236199 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_236199->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_236200_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236200_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_scan_stage_1_parloop_struct_236199->free_n_p_203574;
    double i64_res_203589 =
           futhark_mc_scan_stage_1_parloop_struct_236199->free_i64_res_203589;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_scan_stage_1_parloop_struct_236199->free_lifted_single_ma_l_arg_204224;
    int64_t gtid_212051 =
            futhark_mc_scan_stage_1_parloop_struct_236199->free_gtid_212051;
    double x_212053 =
           futhark_mc_scan_stage_1_parloop_struct_236199->free_x_212053;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236199->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219367 = {.desc ="mem_219367", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236199->free_mem_219367,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229255 = start;
    double x_229231;
    double x_229232;
    
    x_229231 = 0.0;
    for (; iter_229255 < end; iter_229255++) {
        int64_t gtid_229230 = iter_229255;
        
        // stage 1 scan body
        {
            bool cond_229234 = gtid_229230 == (int64_t) 0;
            double defunc_0_f_res_229235;
            
            if (cond_229234) {
                double defunc_0_f_res_t_res_229236 = x_212053 / i64_res_203589;
                
                defunc_0_f_res_229235 = defunc_0_f_res_t_res_229236;
            } else {
                int64_t x_229237 = add64(n_p_203574, gtid_229230);
                int64_t i_229238 = sub64(x_229237, (int64_t) 1);
                bool x_229239 = sle64((int64_t) 0, i_229238);
                bool y_229240 = slt64(i_229238, lifted_single_ma_l_arg_204224);
                bool bounds_check_229241 = x_229239 && y_229240;
                bool index_certs_229242;
                
                if (!bounds_check_229241) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229238,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204224,
                                  "].",
                                  "-> #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_229243;
                
                x_229243 = ((double *) mem_219361.mem)[gtid_212051 *
                                                       lifted_single_ma_l_arg_204224 +
                                                       i_229238];
                
                int64_t i_229244 = sub64(gtid_229230, (int64_t) 1);
                bool x_229245 = sle64((int64_t) 0, i_229244);
                bool y_229246 = slt64(i_229244, lifted_single_ma_l_arg_204224);
                bool bounds_check_229247 = x_229245 && y_229246;
                bool index_certs_229248;
                
                if (!bounds_check_229247) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229244,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204224,
                                  "].",
                                  "-> #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_229249;
                
                y_229249 = ((double *) mem_219361.mem)[gtid_212051 *
                                                       lifted_single_ma_l_arg_204224 +
                                                       i_229244];
                
                double x_229250 = x_229243 - y_229249;
                double defunc_0_f_res_f_res_229251 = x_229250 / i64_res_203589;
                
                defunc_0_f_res_229235 = defunc_0_f_res_f_res_229251;
            }
            // write mapped values results to memory
            { }
            x_229231 = x_229231;
            // Read next values
            {
                x_229232 = defunc_0_f_res_229235;
            }
            
            double defunc_1_op_res_229233 = x_229231 + x_229232;
            
            ((double *) mem_219367.mem)[gtid_229230] = defunc_1_op_res_229233;
            x_229231 = defunc_1_op_res_229233;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236200_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236200_end -
                 futhark_mc_scan_stage_1_parloop_236200_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_236200_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_236200_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_236200_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_236201 {
    struct futhark_context *ctx;
    int64_t free_n_p_203574;
    double free_i64_res_203589;
    int64_t free_lifted_single_ma_l_arg_204224;
    int64_t free_gtid_212051;
    double free_x_212053;
    unsigned char *free_mem_219361;
    unsigned char *free_mem_219367;
};
static int futhark_mc_scan_stage_3_parloop_236202(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229229, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_236201
    *futhark_mc_scan_stage_3_parloop_struct_236201 =
    (struct futhark_mc_scan_stage_3_parloop_struct_236201 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_236201->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_236202_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_236202_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_scan_stage_3_parloop_struct_236201->free_n_p_203574;
    double i64_res_203589 =
           futhark_mc_scan_stage_3_parloop_struct_236201->free_i64_res_203589;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_scan_stage_3_parloop_struct_236201->free_lifted_single_ma_l_arg_204224;
    int64_t gtid_212051 =
            futhark_mc_scan_stage_3_parloop_struct_236201->free_gtid_212051;
    double x_212053 =
           futhark_mc_scan_stage_3_parloop_struct_236201->free_x_212053;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236201->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219367 = {.desc ="mem_219367", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236201->free_mem_219367,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229267 = start;
    double x_229264;
    double x_229265;
    
    if (iter_229267 == (int64_t) 0) {
        x_229264 = 0.0;
    } else {
        x_229264 = ((double *) mem_219367.mem)[iter_229267 - (int64_t) 1];
    }
    for (; iter_229267 < end; iter_229267++) {
        int64_t gtid_229230 = iter_229267;
        
        // stage 3 scan body
        {
            bool cond_229234 = gtid_229230 == (int64_t) 0;
            double defunc_0_f_res_229235;
            
            if (cond_229234) {
                double defunc_0_f_res_t_res_229236 = x_212053 / i64_res_203589;
                
                defunc_0_f_res_229235 = defunc_0_f_res_t_res_229236;
            } else {
                int64_t x_229237 = add64(n_p_203574, gtid_229230);
                int64_t i_229238 = sub64(x_229237, (int64_t) 1);
                bool x_229239 = sle64((int64_t) 0, i_229238);
                bool y_229240 = slt64(i_229238, lifted_single_ma_l_arg_204224);
                bool bounds_check_229241 = x_229239 && y_229240;
                bool index_certs_229242;
                
                if (!bounds_check_229241) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229238,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204224,
                                  "].",
                                  "-> #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_229243;
                
                x_229243 = ((double *) mem_219361.mem)[gtid_212051 *
                                                       lifted_single_ma_l_arg_204224 +
                                                       i_229238];
                
                int64_t i_229244 = sub64(gtid_229230, (int64_t) 1);
                bool x_229245 = sle64((int64_t) 0, i_229244);
                bool y_229246 = slt64(i_229244, lifted_single_ma_l_arg_204224);
                bool bounds_check_229247 = x_229245 && y_229246;
                bool index_certs_229248;
                
                if (!bounds_check_229247) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229244,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204224,
                                  "].",
                                  "-> #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_229249;
                
                y_229249 = ((double *) mem_219361.mem)[gtid_212051 *
                                                       lifted_single_ma_l_arg_204224 +
                                                       i_229244];
                
                double x_229250 = x_229243 - y_229249;
                double defunc_0_f_res_f_res_229251 = x_229250 / i64_res_203589;
                
                defunc_0_f_res_229235 = defunc_0_f_res_f_res_229251;
            }
            x_229264 = x_229264;
            x_229265 = defunc_0_f_res_229235;
            
            double defunc_1_op_res_229266 = x_229264 + x_229265;
            
            ((double *) mem_219367.mem)[gtid_229230] = defunc_1_op_res_229266;
            x_229264 = defunc_1_op_res_229266;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_236202_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_236202_end -
                 futhark_mc_scan_stage_3_parloop_236202_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_236202_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_236202_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_236202_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_236197(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229229 = tid;
    int num_tasks_229254 = info.nsubtasks;
    struct futhark_mc_task_236196 *futhark_mc_task_236196 =
                                  (struct futhark_mc_task_236196 *) args;
    struct futhark_context *ctx = futhark_mc_task_236196->ctx;
    uint64_t futhark_mc_segscan_task_236197_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_236197_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236196->free_n_p_203574;
    double i64_res_203589 = futhark_mc_task_236196->free_i64_res_203589;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_task_236196->free_lifted_single_ma_l_arg_204224;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_task_236196->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t gtid_212051 = futhark_mc_task_236196->free_gtid_212051;
    double x_212053 = futhark_mc_task_236196->free_x_212053;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_task_236196->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219367 = {.desc ="mem_219367", .mem =
                                  futhark_mc_task_236196->free_mem_219367,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_229261_cached_sizze_236198 = 0;
    unsigned char *scan_stage_2_accum_mem_229261 = NULL;
    int64_t iter_229255;
    struct futhark_mc_scan_stage_1_parloop_struct_236199
    futhark_mc_scan_stage_1_parloop_struct_236199;
    
    futhark_mc_scan_stage_1_parloop_struct_236199.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_236199.free_n_p_203574 = n_p_203574;
    futhark_mc_scan_stage_1_parloop_struct_236199.free_i64_res_203589 =
        i64_res_203589;
    futhark_mc_scan_stage_1_parloop_struct_236199.free_lifted_single_ma_l_arg_204224 =
        lifted_single_ma_l_arg_204224;
    futhark_mc_scan_stage_1_parloop_struct_236199.free_gtid_212051 =
        gtid_212051;
    futhark_mc_scan_stage_1_parloop_struct_236199.free_x_212053 = x_212053;
    futhark_mc_scan_stage_1_parloop_struct_236199.free_mem_219361 =
        mem_219361.mem;
    futhark_mc_scan_stage_1_parloop_struct_236199.free_mem_219367 =
        mem_219367.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_236200_task;
    
    futhark_mc_scan_stage_1_parloop_236200_task.name =
        "futhark_mc_scan_stage_1_parloop_236200";
    futhark_mc_scan_stage_1_parloop_236200_task.fn =
        futhark_mc_scan_stage_1_parloop_236200;
    futhark_mc_scan_stage_1_parloop_236200_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_236199;
    futhark_mc_scan_stage_1_parloop_236200_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_236200_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_236200_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236200_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_236200_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_236200_task);
    
    if (futhark_mc_scan_stage_1_parloop_236200_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236200_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236200_total_end -
                 futhark_mc_scan_stage_1_parloop_236200_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236200_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236200_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236200_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_229254)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        double x_229256;
        double x_229257;
        int64_t offset_229259 = (int64_t) 0;
        int64_t offset_index_229260 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_229261_cached_sizze_236198 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_229261 =
                realloc(scan_stage_2_accum_mem_229261, (int64_t) 8);
            scan_stage_2_accum_mem_229261_cached_sizze_236198 = (int64_t) 8;
        }
        ((double *) scan_stage_2_accum_mem_229261)[(int64_t) 0] = 0.0;
        for (int32_t i_229263 = 0; i_229263 < num_tasks_229254 - 1;
             i_229263++) {
            offset_229259 = squot64(dyn_lifted_single_ma_l_arg_204234,
                                    sext_i32_i64(num_tasks_229254));
            if (slt64(sext_i32_i64(i_229263),
                      srem64(dyn_lifted_single_ma_l_arg_204234,
                             sext_i32_i64(num_tasks_229254)))) {
                offset_229259 += (int64_t) 1;
            }
            offset_index_229260 += offset_229259;
            
            int64_t gtid_229230 = offset_index_229260;
            bool cond_229234 = gtid_229230 == (int64_t) 0;
            double defunc_0_f_res_229235;
            
            if (cond_229234) {
                double defunc_0_f_res_t_res_229236 = x_212053 / i64_res_203589;
                
                defunc_0_f_res_229235 = defunc_0_f_res_t_res_229236;
            } else {
                int64_t x_229237 = add64(n_p_203574, gtid_229230);
                int64_t i_229238 = sub64(x_229237, (int64_t) 1);
                bool x_229239 = sle64((int64_t) 0, i_229238);
                bool y_229240 = slt64(i_229238, lifted_single_ma_l_arg_204224);
                bool bounds_check_229241 = x_229239 && y_229240;
                bool index_certs_229242;
                
                if (!bounds_check_229241) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229238,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204224,
                                  "].",
                                  "-> #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_229243;
                
                x_229243 = ((double *) mem_219361.mem)[gtid_212051 *
                                                       lifted_single_ma_l_arg_204224 +
                                                       i_229238];
                
                int64_t i_229244 = sub64(gtid_229230, (int64_t) 1);
                bool x_229245 = sle64((int64_t) 0, i_229244);
                bool y_229246 = slt64(i_229244, lifted_single_ma_l_arg_204224);
                bool bounds_check_229247 = x_229245 && y_229246;
                bool index_certs_229248;
                
                if (!bounds_check_229247) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229244,
                                  "] out of bounds for array of shape [",
                                  (long long) lifted_single_ma_l_arg_204224,
                                  "].",
                                  "-> #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_229249;
                
                y_229249 = ((double *) mem_219361.mem)[gtid_212051 *
                                                       lifted_single_ma_l_arg_204224 +
                                                       i_229244];
                
                double x_229250 = x_229243 - y_229249;
                double defunc_0_f_res_f_res_229251 = x_229250 / i64_res_203589;
                
                defunc_0_f_res_229235 = defunc_0_f_res_f_res_229251;
            }
            // Read carry in
            {
                x_229256 =
                    ((double *) scan_stage_2_accum_mem_229261)[(int64_t) 0];
            }
            // Read next values
            {
                x_229257 = ((double *) mem_219367.mem)[offset_index_229260 -
                                                       (int64_t) 1];
            }
            
            double defunc_1_op_res_229258 = x_229256 + x_229257;
            
            ((double *) mem_219367.mem)[offset_index_229260 - (int64_t) 1] =
                defunc_1_op_res_229258;
            ((double *) scan_stage_2_accum_mem_229261)[(int64_t) 0] =
                defunc_1_op_res_229258;
        }
        
        int64_t iter_229267 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_236201
        futhark_mc_scan_stage_3_parloop_struct_236201;
        
        futhark_mc_scan_stage_3_parloop_struct_236201.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_236201.free_n_p_203574 =
            n_p_203574;
        futhark_mc_scan_stage_3_parloop_struct_236201.free_i64_res_203589 =
            i64_res_203589;
        futhark_mc_scan_stage_3_parloop_struct_236201.free_lifted_single_ma_l_arg_204224 =
            lifted_single_ma_l_arg_204224;
        futhark_mc_scan_stage_3_parloop_struct_236201.free_gtid_212051 =
            gtid_212051;
        futhark_mc_scan_stage_3_parloop_struct_236201.free_x_212053 = x_212053;
        futhark_mc_scan_stage_3_parloop_struct_236201.free_mem_219361 =
            mem_219361.mem;
        futhark_mc_scan_stage_3_parloop_struct_236201.free_mem_219367 =
            mem_219367.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_236202_task;
        
        futhark_mc_scan_stage_3_parloop_236202_task.name =
            "futhark_mc_scan_stage_3_parloop_236202";
        futhark_mc_scan_stage_3_parloop_236202_task.fn =
            futhark_mc_scan_stage_3_parloop_236202;
        futhark_mc_scan_stage_3_parloop_236202_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_236201;
        futhark_mc_scan_stage_3_parloop_236202_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_236202_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_236202_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_236202_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_236202_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_236202_task);
        
        if (futhark_mc_scan_stage_3_parloop_236202_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_236202_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_236202_total_end -
                     futhark_mc_scan_stage_3_parloop_236202_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236202_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236202_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236202_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_229261);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_236197_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_236197_end -
                 futhark_mc_segscan_task_236197_start;
        
        ctx->futhark_mc_segscan_task_236197_runs[tid]++;
        ctx->futhark_mc_segscan_task_236197_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_236197_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236194(void *args, int64_t start,
                                            int64_t end, int flat_tid_212050,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236193
    *futhark_mc_segmap_parloop_struct_236193 =
    (struct futhark_mc_segmap_parloop_struct_236193 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236193->ctx;
    uint64_t futhark_mc_segmap_parloop_236194_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236194_start = get_wall_time();
    
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236193->free_n_p_203574;
    double i64_res_203589 =
           futhark_mc_segmap_parloop_struct_236193->free_i64_res_203589;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236193->free_partition_sizze_203667;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_segmap_parloop_struct_236193->free_lifted_single_ma_l_arg_204224;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_segmap_parloop_struct_236193->free_dyn_lifted_single_ma_l_arg_204234;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_segmap_parloop_struct_236193->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219364 = {.desc ="mem_219364", .mem =
                                  futhark_mc_segmap_parloop_struct_236193->free_mem_219364,
                                  .size =0, .references =NULL};
    int64_t bytes_219366 =
            futhark_mc_segmap_parloop_struct_236193->free_bytes_219366;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_segmap_parloop_struct_236193->free_mem_219386,
                                  .size =0, .references =NULL};
    size_t mem_219367_cached_sizze_236195 = 0;
    unsigned char *mem_219367 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229228 = start;
    
    if (mem_219367_cached_sizze_236195 < (size_t) bytes_219366) {
        mem_219367 = realloc(mem_219367, bytes_219366);
        mem_219367_cached_sizze_236195 = bytes_219366;
    }
    for (; iter_229228 < end; iter_229228++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229252 = partition_sizze_203667;
        int64_t gtid_212051 = iter_229228;
        int64_t remnant_229253 = iter_229228 - gtid_212051;
        double x_212053;
        
        x_212053 = ((double *) mem_219364.mem)[gtid_212051];
        
        int64_t flat_tid_229229 = (int64_t) 0;
        int32_t num_tasks_229254;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_236196 futhark_mc_task_236196;
        
        futhark_mc_task_236196.ctx = ctx;
        futhark_mc_task_236196.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236196.free_i64_res_203589 = i64_res_203589;
        futhark_mc_task_236196.free_lifted_single_ma_l_arg_204224 =
            lifted_single_ma_l_arg_204224;
        futhark_mc_task_236196.free_dyn_lifted_single_ma_l_arg_204234 =
            dyn_lifted_single_ma_l_arg_204234;
        futhark_mc_task_236196.free_gtid_212051 = gtid_212051;
        futhark_mc_task_236196.free_x_212053 = x_212053;
        futhark_mc_task_236196.free_mem_219361 = mem_219361.mem;
        futhark_mc_task_236196.free_mem_219367 = mem_219367;
        
        struct scheduler_segop futhark_mc_task_236196_task;
        
        futhark_mc_task_236196_task.args = &futhark_mc_task_236196;
        futhark_mc_task_236196_task.top_level_fn =
            futhark_mc_segscan_task_236197;
        futhark_mc_task_236196_task.name = "futhark_mc_segscan_task_236197";
        futhark_mc_task_236196_task.iterations =
            dyn_lifted_single_ma_l_arg_204234;
        futhark_mc_task_236196_task.task_time =
            &ctx->futhark_mc_segscan_task_236197_total_time;
        futhark_mc_task_236196_task.task_iter =
            &ctx->futhark_mc_segscan_task_236197_total_iter;
        futhark_mc_task_236196_task.sched = STATIC;
        futhark_mc_task_236196_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_236197_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236196_task);
        
        if (futhark_mc_segscan_task_236197_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (dyn_lifted_single_ma_l_arg_204234 * (int64_t) 8 > 0)
            memmove(mem_219386.mem + gtid_212051 *
                    dyn_lifted_single_ma_l_arg_204234 * (int64_t) 8,
                    mem_219367 + (int64_t) 0,
                    dyn_lifted_single_ma_l_arg_204234 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219367);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236194_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236194_end -
                 futhark_mc_segmap_parloop_236194_start;
        
        ctx->futhark_mc_segmap_parloop_236194_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236194_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236194_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236192(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212050 = tid;
    int num_tasks_229199 = info.nsubtasks;
    struct futhark_mc_task_236187 *futhark_mc_task_236187 =
                                  (struct futhark_mc_task_236187 *) args;
    struct futhark_context *ctx = futhark_mc_task_236187->ctx;
    uint64_t futhark_mc_segmap_nested_task_236192_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236192_start = get_wall_time();
    
    int64_t n_p_203574 = futhark_mc_task_236187->free_n_p_203574;
    double i64_res_203589 = futhark_mc_task_236187->free_i64_res_203589;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236187->free_partition_sizze_203667;
    int64_t lifted_single_ma_l_arg_204224 =
            futhark_mc_task_236187->free_lifted_single_ma_l_arg_204224;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_task_236187->free_dyn_lifted_single_ma_l_arg_204234;
    struct memblock mem_219361 = {.desc ="mem_219361", .mem =
                                  futhark_mc_task_236187->free_mem_219361,
                                  .size =0, .references =NULL};
    struct memblock mem_219364 = {.desc ="mem_219364", .mem =
                                  futhark_mc_task_236187->free_mem_219364,
                                  .size =0, .references =NULL};
    int64_t bytes_219366 = futhark_mc_task_236187->free_bytes_219366;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_task_236187->free_mem_219386,
                                  .size =0, .references =NULL};
    int64_t iter_229228;
    struct futhark_mc_segmap_parloop_struct_236193
    futhark_mc_segmap_parloop_struct_236193;
    
    futhark_mc_segmap_parloop_struct_236193.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236193.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236193.free_i64_res_203589 =
        i64_res_203589;
    futhark_mc_segmap_parloop_struct_236193.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236193.free_lifted_single_ma_l_arg_204224 =
        lifted_single_ma_l_arg_204224;
    futhark_mc_segmap_parloop_struct_236193.free_dyn_lifted_single_ma_l_arg_204234 =
        dyn_lifted_single_ma_l_arg_204234;
    futhark_mc_segmap_parloop_struct_236193.free_mem_219361 = mem_219361.mem;
    futhark_mc_segmap_parloop_struct_236193.free_mem_219364 = mem_219364.mem;
    futhark_mc_segmap_parloop_struct_236193.free_bytes_219366 = bytes_219366;
    futhark_mc_segmap_parloop_struct_236193.free_mem_219386 = mem_219386.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236194_task;
    
    futhark_mc_segmap_parloop_236194_task.name =
        "futhark_mc_segmap_parloop_236194";
    futhark_mc_segmap_parloop_236194_task.fn = futhark_mc_segmap_parloop_236194;
    futhark_mc_segmap_parloop_236194_task.args =
        &futhark_mc_segmap_parloop_struct_236193;
    futhark_mc_segmap_parloop_236194_task.iterations = iterations;
    futhark_mc_segmap_parloop_236194_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236194_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236194_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236194_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236194_task);
    
    if (futhark_mc_segmap_parloop_236194_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236194_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236194_total_end -
                 futhark_mc_segmap_parloop_236194_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236194_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236194_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236194_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236192_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236192_end -
                 futhark_mc_segmap_nested_task_236192_start;
        
        ctx->futhark_mc_segmap_nested_task_236192_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236192_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236192_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236203 {
    struct futhark_context *ctx;
    int64_t free_partition_sizze_203667;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    unsigned char *free_mem_219386;
    unsigned char *free_mem_219389;
};
struct futhark_mc_segmap_parloop_struct_236205 {
    struct futhark_context *ctx;
    int64_t free_partition_sizze_203667;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    unsigned char *free_mem_219386;
    unsigned char *free_mem_219389;
};
static int futhark_mc_segmap_parloop_236206(void *args, int64_t start,
                                            int64_t end, int flat_tid_212079,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236205
    *futhark_mc_segmap_parloop_struct_236205 =
    (struct futhark_mc_segmap_parloop_struct_236205 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236205->ctx;
    uint64_t futhark_mc_segmap_parloop_236206_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236206_start = get_wall_time();
    
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236205->free_partition_sizze_203667;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_segmap_parloop_struct_236205->free_dyn_lifted_single_ma_l_arg_204234;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_segmap_parloop_struct_236205->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219389 = {.desc ="mem_219389", .mem =
                                  futhark_mc_segmap_parloop_struct_236205->free_mem_219389,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229269 = start;
    
    for (; iter_229269 < end; iter_229269++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229275 = partition_sizze_203667;
        int64_t gtid_212080 = iter_229269;
        int64_t remnant_229276 = iter_229269 - gtid_212080;
        double defunc_2_reduce_res_205245;
        double redout_229271 = 0.0;
        
        for (int32_t i_229270 = 0; i_229270 < 3; i_229270++) {
            int64_t i_229272 = sext_i32_i64(i_229270);
            double x_229273;
            
            x_229273 = ((double *) mem_219386.mem)[gtid_212080 *
                                                   dyn_lifted_single_ma_l_arg_204234 +
                                                   i_229272];
            
            double defunc_1_op_res_229274 = x_229273 + redout_229271;
            double redout_tmp_229277 = defunc_1_op_res_229274;
            
            redout_229271 = redout_tmp_229277;
        }
        defunc_2_reduce_res_205245 = redout_229271;
        ((double *) mem_219389.mem)[gtid_212080] = defunc_2_reduce_res_205245;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236206_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236206_end -
                 futhark_mc_segmap_parloop_236206_start;
        
        ctx->futhark_mc_segmap_parloop_236206_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236206_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236206_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236204(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212079 = tid;
    int num_tasks_229268 = info.nsubtasks;
    struct futhark_mc_task_236203 *futhark_mc_task_236203 =
                                  (struct futhark_mc_task_236203 *) args;
    struct futhark_context *ctx = futhark_mc_task_236203->ctx;
    uint64_t futhark_mc_segmap_task_236204_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236204_start = get_wall_time();
    
    int64_t partition_sizze_203667 =
            futhark_mc_task_236203->free_partition_sizze_203667;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_task_236203->free_dyn_lifted_single_ma_l_arg_204234;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_task_236203->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219389 = {.desc ="mem_219389", .mem =
                                  futhark_mc_task_236203->free_mem_219389,
                                  .size =0, .references =NULL};
    int64_t iter_229269;
    struct futhark_mc_segmap_parloop_struct_236205
    futhark_mc_segmap_parloop_struct_236205;
    
    futhark_mc_segmap_parloop_struct_236205.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236205.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236205.free_dyn_lifted_single_ma_l_arg_204234 =
        dyn_lifted_single_ma_l_arg_204234;
    futhark_mc_segmap_parloop_struct_236205.free_mem_219386 = mem_219386.mem;
    futhark_mc_segmap_parloop_struct_236205.free_mem_219389 = mem_219389.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236206_task;
    
    futhark_mc_segmap_parloop_236206_task.name =
        "futhark_mc_segmap_parloop_236206";
    futhark_mc_segmap_parloop_236206_task.fn = futhark_mc_segmap_parloop_236206;
    futhark_mc_segmap_parloop_236206_task.args =
        &futhark_mc_segmap_parloop_struct_236205;
    futhark_mc_segmap_parloop_236206_task.iterations = iterations;
    futhark_mc_segmap_parloop_236206_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236206_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236206_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236206_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236206_task);
    
    if (futhark_mc_segmap_parloop_236206_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236206_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236206_total_end -
                 futhark_mc_segmap_parloop_236206_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236206_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236206_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236206_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236204_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236204_end -
                 futhark_mc_segmap_task_236204_start;
        
        ctx->futhark_mc_segmap_task_236204_runs[tid]++;
        ctx->futhark_mc_segmap_task_236204_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236204_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236208 {
    struct futhark_context *ctx;
    int64_t free_partition_sizze_203667;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    unsigned char *free_mem_219386;
    unsigned char *free_mem_219389;
};
struct futhark_mc_task_236210 {
    struct futhark_context *ctx;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    int64_t free_gtid_212086;
    unsigned char *free_mem_219386;
    double *retval_defunc_2_reduce_res_212088;
};
struct futhark_mc_segred_stage_1_parloop_struct_236213 {
    struct futhark_context *ctx;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    int64_t free_gtid_212086;
    unsigned char *free_mem_219386;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229288;
};
static int futhark_mc_segred_stage_1_parloop_236214(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229279,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236213
    *futhark_mc_segred_stage_1_parloop_struct_236213 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236213 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236213->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236214_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236214_start = get_wall_time();
    
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_segred_stage_1_parloop_struct_236213->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t gtid_212086 =
            futhark_mc_segred_stage_1_parloop_struct_236213->free_gtid_212086;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236213->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_229288 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229288",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236213->free_reduce_stage_1_tid_res_arr_mem_229288,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229290 = start;
    double x_229281;
    double x_229282;
    double local_acc_229291 = 0.0;
    
    for (; iter_229290 < end; iter_229290++) {
        int64_t gtid_229280 = iter_229290;
        double x_229284;
        
        x_229284 = ((double *) mem_219386.mem)[gtid_212086 *
                                               dyn_lifted_single_ma_l_arg_204234 +
                                               gtid_229280];
        // save map-out results
        { }
        // Load accum params
        {
            x_229281 = local_acc_229291;
        }
        // Load next params
        {
            x_229282 = x_229284;
        }
        // Red body
        {
            double defunc_1_op_res_229283 = x_229281 + x_229282;
            
            local_acc_229291 = defunc_1_op_res_229283;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229288.mem)[flat_tid_229279] =
        local_acc_229291;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236214_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236214_end -
                 futhark_mc_segred_stage_1_parloop_236214_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236214_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236214_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236214_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236211(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229279 = tid;
    int num_tasks_229287 = info.nsubtasks;
    struct futhark_mc_task_236210 *futhark_mc_task_236210 =
                                  (struct futhark_mc_task_236210 *) args;
    struct futhark_context *ctx = futhark_mc_task_236210->ctx;
    uint64_t futhark_mc_segred_task_236211_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236211_start = get_wall_time();
    
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_task_236210->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t gtid_212086 = futhark_mc_task_236210->free_gtid_212086;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_task_236210->free_mem_219386,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_212088 =
           *futhark_mc_task_236210->retval_defunc_2_reduce_res_212088;
    size_t reduce_stage_1_tid_res_arr_mem_229288_cached_sizze_236212 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229288 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229288_cached_sizze_236212 <
        (size_t) ((int64_t) 8 * num_tasks_229287)) {
        reduce_stage_1_tid_res_arr_mem_229288 =
            realloc(reduce_stage_1_tid_res_arr_mem_229288, (int64_t) 8 *
                    num_tasks_229287);
        reduce_stage_1_tid_res_arr_mem_229288_cached_sizze_236212 =
            (int64_t) 8 * num_tasks_229287;
    }
    
    int64_t iter_229290;
    struct futhark_mc_segred_stage_1_parloop_struct_236213
    futhark_mc_segred_stage_1_parloop_struct_236213;
    
    futhark_mc_segred_stage_1_parloop_struct_236213.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236213.free_dyn_lifted_single_ma_l_arg_204234 =
        dyn_lifted_single_ma_l_arg_204234;
    futhark_mc_segred_stage_1_parloop_struct_236213.free_gtid_212086 =
        gtid_212086;
    futhark_mc_segred_stage_1_parloop_struct_236213.free_mem_219386 =
        mem_219386.mem;
    futhark_mc_segred_stage_1_parloop_struct_236213.free_reduce_stage_1_tid_res_arr_mem_229288 =
        reduce_stage_1_tid_res_arr_mem_229288;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236214_task;
    
    futhark_mc_segred_stage_1_parloop_236214_task.name =
        "futhark_mc_segred_stage_1_parloop_236214";
    futhark_mc_segred_stage_1_parloop_236214_task.fn =
        futhark_mc_segred_stage_1_parloop_236214;
    futhark_mc_segred_stage_1_parloop_236214_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236213;
    futhark_mc_segred_stage_1_parloop_236214_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236214_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236214_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236214_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236214_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236214_task);
    
    if (futhark_mc_segred_stage_1_parloop_236214_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236214_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236214_total_end -
                 futhark_mc_segred_stage_1_parloop_236214_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236214_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236214_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236214_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_212088 = 0.0;
    }
    
    double x_229292;
    double x_229293;
    
    for (int32_t i_229295 = 0; i_229295 < num_tasks_229287; i_229295++) {
        flat_tid_229279 = i_229295;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229292 = defunc_2_reduce_res_212088;
            }
            // load next params
            {
                x_229293 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229288)[flat_tid_229279];
            }
            // red body
            {
                double defunc_1_op_res_229294 = x_229292 + x_229293;
                
                defunc_2_reduce_res_212088 = defunc_1_op_res_229294;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229288);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236211_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236211_end -
                 futhark_mc_segred_task_236211_start;
        
        ctx->futhark_mc_segred_task_236211_runs[tid]++;
        ctx->futhark_mc_segred_task_236211_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236211_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236210->retval_defunc_2_reduce_res_212088 =
            defunc_2_reduce_res_212088;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236209(void *args, int64_t start,
                                            int64_t end, int flat_tid_212085,
                                            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 partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236208->free_partition_sizze_203667;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_segmap_parloop_struct_236208->free_dyn_lifted_single_ma_l_arg_204234;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_segmap_parloop_struct_236208->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219389 = {.desc ="mem_219389", .mem =
                                  futhark_mc_segmap_parloop_struct_236208->free_mem_219389,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229278 = start;
    
    for (; iter_229278 < end; iter_229278++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229285 = partition_sizze_203667;
        int64_t gtid_212086 = iter_229278;
        int64_t remnant_229286 = iter_229278 - gtid_212086;
        double defunc_2_reduce_res_212088;
        int64_t flat_tid_229279 = (int64_t) 0;
        int32_t num_tasks_229287;
        
        defunc_2_reduce_res_212088 = 0.0;
        
        struct futhark_mc_task_236210 futhark_mc_task_236210;
        
        futhark_mc_task_236210.ctx = ctx;
        futhark_mc_task_236210.free_dyn_lifted_single_ma_l_arg_204234 =
            dyn_lifted_single_ma_l_arg_204234;
        futhark_mc_task_236210.free_gtid_212086 = gtid_212086;
        futhark_mc_task_236210.free_mem_219386 = mem_219386.mem;
        futhark_mc_task_236210.retval_defunc_2_reduce_res_212088 =
            &defunc_2_reduce_res_212088;
        
        struct scheduler_segop futhark_mc_task_236210_task;
        
        futhark_mc_task_236210_task.args = &futhark_mc_task_236210;
        futhark_mc_task_236210_task.top_level_fn =
            futhark_mc_segred_task_236211;
        futhark_mc_task_236210_task.name = "futhark_mc_segred_task_236211";
        futhark_mc_task_236210_task.iterations = (int64_t) 3;
        futhark_mc_task_236210_task.task_time =
            &ctx->futhark_mc_segred_task_236211_total_time;
        futhark_mc_task_236210_task.task_iter =
            &ctx->futhark_mc_segred_task_236211_total_iter;
        futhark_mc_task_236210_task.sched = STATIC;
        futhark_mc_task_236210_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236211_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236210_task);
        
        if (futhark_mc_segred_task_236211_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219389.mem)[gtid_212086] = defunc_2_reduce_res_212088;
    }
    
  cleanup:
    { }
    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_nested_task_236207(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212085 = tid;
    int num_tasks_229268 = info.nsubtasks;
    struct futhark_mc_task_236203 *futhark_mc_task_236203 =
                                  (struct futhark_mc_task_236203 *) args;
    struct futhark_context *ctx = futhark_mc_task_236203->ctx;
    uint64_t futhark_mc_segmap_nested_task_236207_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236207_start = get_wall_time();
    
    int64_t partition_sizze_203667 =
            futhark_mc_task_236203->free_partition_sizze_203667;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_task_236203->free_dyn_lifted_single_ma_l_arg_204234;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_task_236203->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219389 = {.desc ="mem_219389", .mem =
                                  futhark_mc_task_236203->free_mem_219389,
                                  .size =0, .references =NULL};
    int64_t iter_229278;
    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_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236208.free_dyn_lifted_single_ma_l_arg_204234 =
        dyn_lifted_single_ma_l_arg_204234;
    futhark_mc_segmap_parloop_struct_236208.free_mem_219386 = mem_219386.mem;
    futhark_mc_segmap_parloop_struct_236208.free_mem_219389 = mem_219389.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_nested_task_236207_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236207_end -
                 futhark_mc_segmap_nested_task_236207_start;
        
        ctx->futhark_mc_segmap_nested_task_236207_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236207_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236207_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236215 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    int64_t free_bytes_217420;
    unsigned char *free_mem_219386;
    unsigned char *free_mem_219389;
    unsigned char *free_mem_219411;
};
struct futhark_mc_segmap_parloop_struct_236217 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    int64_t free_bytes_217420;
    unsigned char *free_mem_219386;
    unsigned char *free_mem_219389;
    unsigned char *free_mem_219411;
};
static int futhark_mc_segmap_parloop_236218(void *args, int64_t start,
                                            int64_t end, int flat_tid_212095,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236217->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236217->free_partition_sizze_203667;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_segmap_parloop_struct_236217->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236217->free_bytes_217420;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_segmap_parloop_struct_236217->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219389 = {.desc ="mem_219389", .mem =
                                  futhark_mc_segmap_parloop_struct_236217->free_mem_219389,
                                  .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236217->free_mem_219411,
                                  .size =0, .references =NULL};
    size_t mem_219395_cached_sizze_236219 = 0;
    unsigned char *mem_219395 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229297 = start;
    
    if (mem_219395_cached_sizze_236219 < (size_t) bytes_217420) {
        mem_219395 = realloc(mem_219395, bytes_217420);
        mem_219395_cached_sizze_236219 = bytes_217420;
    }
    for (; iter_229297 < end; iter_229297++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229321 = partition_sizze_203667;
        int64_t gtid_212096 = iter_229297;
        int64_t remnant_229322 = iter_229297 - gtid_212096;
        double x_205253;
        
        x_205253 = ((double *) mem_219389.mem)[gtid_212096];
        
        double discard_216591;
        double scanacc_229299 = 0.0;
        
        for (int64_t i_229298 = 0; i_229298 < n_203572; i_229298++) {
            bool cond_229301 = i_229298 == (int64_t) 0;
            double defunc_0_f_res_229302;
            
            if (cond_229301) {
                double defunc_0_f_res_t_res_229303 = x_205253 / 3.0;
                
                defunc_0_f_res_229302 = defunc_0_f_res_t_res_229303;
            } else {
                int64_t x_229304 = add64((int64_t) 3, i_229298);
                int64_t i_229305 = sub64(x_229304, (int64_t) 1);
                bool x_229306 = sle64((int64_t) 0, i_229305);
                bool y_229307 = slt64(i_229305,
                                      dyn_lifted_single_ma_l_arg_204234);
                bool bounds_check_229308 = x_229306 && y_229307;
                bool index_certs_229309;
                
                if (!bounds_check_229308) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229305,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204234,
                                  "].",
                                  "-> #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_229310;
                
                x_229310 = ((double *) mem_219386.mem)[gtid_212096 *
                                                       dyn_lifted_single_ma_l_arg_204234 +
                                                       i_229305];
                
                int64_t i_229311 = sub64(i_229298, (int64_t) 1);
                bool x_229312 = sle64((int64_t) 0, i_229311);
                bool y_229313 = slt64(i_229311,
                                      dyn_lifted_single_ma_l_arg_204234);
                bool bounds_check_229314 = x_229312 && y_229313;
                bool index_certs_229315;
                
                if (!bounds_check_229314) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229311,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204234,
                                  "].",
                                  "-> #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_229316;
                
                y_229316 = ((double *) mem_219386.mem)[gtid_212096 *
                                                       dyn_lifted_single_ma_l_arg_204234 +
                                                       i_229311];
                
                double x_229317 = x_229310 - y_229316;
                double defunc_0_f_res_f_res_229318 = x_229317 / 3.0;
                
                defunc_0_f_res_229302 = defunc_0_f_res_f_res_229318;
            }
            
            double defunc_1_op_res_229319 = defunc_0_f_res_229302 +
                   scanacc_229299;
            
            ((double *) mem_219395)[i_229298] = defunc_1_op_res_229319;
            
            double scanacc_tmp_229323 = defunc_1_op_res_229319;
            
            scanacc_229299 = scanacc_tmp_229323;
        }
        discard_216591 = scanacc_229299;
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_219411.mem + gtid_212096 * n_203572 * (int64_t) 8,
                    mem_219395 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219395);
    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_task_236216(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212095 = tid;
    int num_tasks_229296 = info.nsubtasks;
    struct futhark_mc_task_236215 *futhark_mc_task_236215 =
                                  (struct futhark_mc_task_236215 *) args;
    struct futhark_context *ctx = futhark_mc_task_236215->ctx;
    uint64_t futhark_mc_segmap_task_236216_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236216_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236215->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236215->free_partition_sizze_203667;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_task_236215->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t bytes_217420 = futhark_mc_task_236215->free_bytes_217420;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_task_236215->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219389 = {.desc ="mem_219389", .mem =
                                  futhark_mc_task_236215->free_mem_219389,
                                  .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236215->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t iter_229297;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236217.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236217.free_dyn_lifted_single_ma_l_arg_204234 =
        dyn_lifted_single_ma_l_arg_204234;
    futhark_mc_segmap_parloop_struct_236217.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236217.free_mem_219386 = mem_219386.mem;
    futhark_mc_segmap_parloop_struct_236217.free_mem_219389 = mem_219389.mem;
    futhark_mc_segmap_parloop_struct_236217.free_mem_219411 = mem_219411.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_task_236216_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236216_end -
                 futhark_mc_segmap_task_236216_start;
        
        ctx->futhark_mc_segmap_task_236216_runs[tid]++;
        ctx->futhark_mc_segmap_task_236216_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236216_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236221 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    int64_t free_bytes_217420;
    unsigned char *free_mem_219386;
    unsigned char *free_mem_219389;
    unsigned char *free_mem_219411;
};
struct futhark_mc_task_236224 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    int64_t free_gtid_212102;
    double free_x_212104;
    unsigned char *free_mem_219386;
    unsigned char *free_mem_219392;
};
struct futhark_mc_scan_stage_1_parloop_struct_236227 {
    struct futhark_context *ctx;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    int64_t free_gtid_212102;
    double free_x_212104;
    unsigned char *free_mem_219386;
    unsigned char *free_mem_219392;
};
static int futhark_mc_scan_stage_1_parloop_236228(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229326, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_236227
    *futhark_mc_scan_stage_1_parloop_struct_236227 =
    (struct futhark_mc_scan_stage_1_parloop_struct_236227 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_236227->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_236228_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236228_start = get_wall_time();
    
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_scan_stage_1_parloop_struct_236227->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t gtid_212102 =
            futhark_mc_scan_stage_1_parloop_struct_236227->free_gtid_212102;
    double x_212104 =
           futhark_mc_scan_stage_1_parloop_struct_236227->free_x_212104;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236227->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219392 = {.desc ="mem_219392", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236227->free_mem_219392,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229352 = start;
    double x_229328;
    double x_229329;
    
    x_229328 = 0.0;
    for (; iter_229352 < end; iter_229352++) {
        int64_t gtid_229327 = iter_229352;
        
        // stage 1 scan body
        {
            bool cond_229331 = gtid_229327 == (int64_t) 0;
            double defunc_0_f_res_229332;
            
            if (cond_229331) {
                double defunc_0_f_res_t_res_229333 = x_212104 / 3.0;
                
                defunc_0_f_res_229332 = defunc_0_f_res_t_res_229333;
            } else {
                int64_t x_229334 = add64((int64_t) 3, gtid_229327);
                int64_t i_229335 = sub64(x_229334, (int64_t) 1);
                bool x_229336 = sle64((int64_t) 0, i_229335);
                bool y_229337 = slt64(i_229335,
                                      dyn_lifted_single_ma_l_arg_204234);
                bool bounds_check_229338 = x_229336 && y_229337;
                bool index_certs_229339;
                
                if (!bounds_check_229338) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229335,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204234,
                                  "].",
                                  "-> #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_229340;
                
                x_229340 = ((double *) mem_219386.mem)[gtid_212102 *
                                                       dyn_lifted_single_ma_l_arg_204234 +
                                                       i_229335];
                
                int64_t i_229341 = sub64(gtid_229327, (int64_t) 1);
                bool x_229342 = sle64((int64_t) 0, i_229341);
                bool y_229343 = slt64(i_229341,
                                      dyn_lifted_single_ma_l_arg_204234);
                bool bounds_check_229344 = x_229342 && y_229343;
                bool index_certs_229345;
                
                if (!bounds_check_229344) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229341,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204234,
                                  "].",
                                  "-> #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_229346;
                
                y_229346 = ((double *) mem_219386.mem)[gtid_212102 *
                                                       dyn_lifted_single_ma_l_arg_204234 +
                                                       i_229341];
                
                double x_229347 = x_229340 - y_229346;
                double defunc_0_f_res_f_res_229348 = x_229347 / 3.0;
                
                defunc_0_f_res_229332 = defunc_0_f_res_f_res_229348;
            }
            // write mapped values results to memory
            { }
            x_229328 = x_229328;
            // Read next values
            {
                x_229329 = defunc_0_f_res_229332;
            }
            
            double defunc_1_op_res_229330 = x_229328 + x_229329;
            
            ((double *) mem_219392.mem)[gtid_229327] = defunc_1_op_res_229330;
            x_229328 = defunc_1_op_res_229330;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236228_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236228_end -
                 futhark_mc_scan_stage_1_parloop_236228_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_236228_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_236228_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_236228_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_236229 {
    struct futhark_context *ctx;
    int64_t free_dyn_lifted_single_ma_l_arg_204234;
    int64_t free_gtid_212102;
    double free_x_212104;
    unsigned char *free_mem_219386;
    unsigned char *free_mem_219392;
};
static int futhark_mc_scan_stage_3_parloop_236230(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_229326, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_236229
    *futhark_mc_scan_stage_3_parloop_struct_236229 =
    (struct futhark_mc_scan_stage_3_parloop_struct_236229 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_236229->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_236230_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_236230_start = get_wall_time();
    
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_scan_stage_3_parloop_struct_236229->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t gtid_212102 =
            futhark_mc_scan_stage_3_parloop_struct_236229->free_gtid_212102;
    double x_212104 =
           futhark_mc_scan_stage_3_parloop_struct_236229->free_x_212104;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236229->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219392 = {.desc ="mem_219392", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236229->free_mem_219392,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229364 = start;
    double x_229361;
    double x_229362;
    
    if (iter_229364 == (int64_t) 0) {
        x_229361 = 0.0;
    } else {
        x_229361 = ((double *) mem_219392.mem)[iter_229364 - (int64_t) 1];
    }
    for (; iter_229364 < end; iter_229364++) {
        int64_t gtid_229327 = iter_229364;
        
        // stage 3 scan body
        {
            bool cond_229331 = gtid_229327 == (int64_t) 0;
            double defunc_0_f_res_229332;
            
            if (cond_229331) {
                double defunc_0_f_res_t_res_229333 = x_212104 / 3.0;
                
                defunc_0_f_res_229332 = defunc_0_f_res_t_res_229333;
            } else {
                int64_t x_229334 = add64((int64_t) 3, gtid_229327);
                int64_t i_229335 = sub64(x_229334, (int64_t) 1);
                bool x_229336 = sle64((int64_t) 0, i_229335);
                bool y_229337 = slt64(i_229335,
                                      dyn_lifted_single_ma_l_arg_204234);
                bool bounds_check_229338 = x_229336 && y_229337;
                bool index_certs_229339;
                
                if (!bounds_check_229338) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229335,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204234,
                                  "].",
                                  "-> #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_229340;
                
                x_229340 = ((double *) mem_219386.mem)[gtid_212102 *
                                                       dyn_lifted_single_ma_l_arg_204234 +
                                                       i_229335];
                
                int64_t i_229341 = sub64(gtid_229327, (int64_t) 1);
                bool x_229342 = sle64((int64_t) 0, i_229341);
                bool y_229343 = slt64(i_229341,
                                      dyn_lifted_single_ma_l_arg_204234);
                bool bounds_check_229344 = x_229342 && y_229343;
                bool index_certs_229345;
                
                if (!bounds_check_229344) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229341,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204234,
                                  "].",
                                  "-> #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_229346;
                
                y_229346 = ((double *) mem_219386.mem)[gtid_212102 *
                                                       dyn_lifted_single_ma_l_arg_204234 +
                                                       i_229341];
                
                double x_229347 = x_229340 - y_229346;
                double defunc_0_f_res_f_res_229348 = x_229347 / 3.0;
                
                defunc_0_f_res_229332 = defunc_0_f_res_f_res_229348;
            }
            x_229361 = x_229361;
            x_229362 = defunc_0_f_res_229332;
            
            double defunc_1_op_res_229363 = x_229361 + x_229362;
            
            ((double *) mem_219392.mem)[gtid_229327] = defunc_1_op_res_229363;
            x_229361 = defunc_1_op_res_229363;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_236230_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_236230_end -
                 futhark_mc_scan_stage_3_parloop_236230_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_236230_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_236230_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_236230_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_236225(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229326 = tid;
    int num_tasks_229351 = info.nsubtasks;
    struct futhark_mc_task_236224 *futhark_mc_task_236224 =
                                  (struct futhark_mc_task_236224 *) args;
    struct futhark_context *ctx = futhark_mc_task_236224->ctx;
    uint64_t futhark_mc_segscan_task_236225_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_236225_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236224->free_n_203572;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_task_236224->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t gtid_212102 = futhark_mc_task_236224->free_gtid_212102;
    double x_212104 = futhark_mc_task_236224->free_x_212104;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_task_236224->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219392 = {.desc ="mem_219392", .mem =
                                  futhark_mc_task_236224->free_mem_219392,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_229358_cached_sizze_236226 = 0;
    unsigned char *scan_stage_2_accum_mem_229358 = NULL;
    int64_t iter_229352;
    struct futhark_mc_scan_stage_1_parloop_struct_236227
    futhark_mc_scan_stage_1_parloop_struct_236227;
    
    futhark_mc_scan_stage_1_parloop_struct_236227.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_236227.free_dyn_lifted_single_ma_l_arg_204234 =
        dyn_lifted_single_ma_l_arg_204234;
    futhark_mc_scan_stage_1_parloop_struct_236227.free_gtid_212102 =
        gtid_212102;
    futhark_mc_scan_stage_1_parloop_struct_236227.free_x_212104 = x_212104;
    futhark_mc_scan_stage_1_parloop_struct_236227.free_mem_219386 =
        mem_219386.mem;
    futhark_mc_scan_stage_1_parloop_struct_236227.free_mem_219392 =
        mem_219392.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_236228_task;
    
    futhark_mc_scan_stage_1_parloop_236228_task.name =
        "futhark_mc_scan_stage_1_parloop_236228";
    futhark_mc_scan_stage_1_parloop_236228_task.fn =
        futhark_mc_scan_stage_1_parloop_236228;
    futhark_mc_scan_stage_1_parloop_236228_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_236227;
    futhark_mc_scan_stage_1_parloop_236228_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_236228_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_236228_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236228_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_236228_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_236228_task);
    
    if (futhark_mc_scan_stage_1_parloop_236228_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236228_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236228_total_end -
                 futhark_mc_scan_stage_1_parloop_236228_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236228_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236228_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236228_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_229351)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        double x_229353;
        double x_229354;
        int64_t offset_229356 = (int64_t) 0;
        int64_t offset_index_229357 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_229358_cached_sizze_236226 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_229358 =
                realloc(scan_stage_2_accum_mem_229358, (int64_t) 8);
            scan_stage_2_accum_mem_229358_cached_sizze_236226 = (int64_t) 8;
        }
        ((double *) scan_stage_2_accum_mem_229358)[(int64_t) 0] = 0.0;
        for (int32_t i_229360 = 0; i_229360 < num_tasks_229351 - 1;
             i_229360++) {
            offset_229356 = squot64(n_203572, sext_i32_i64(num_tasks_229351));
            if (slt64(sext_i32_i64(i_229360), srem64(n_203572,
                                                     sext_i32_i64(num_tasks_229351)))) {
                offset_229356 += (int64_t) 1;
            }
            offset_index_229357 += offset_229356;
            
            int64_t gtid_229327 = offset_index_229357;
            bool cond_229331 = gtid_229327 == (int64_t) 0;
            double defunc_0_f_res_229332;
            
            if (cond_229331) {
                double defunc_0_f_res_t_res_229333 = x_212104 / 3.0;
                
                defunc_0_f_res_229332 = defunc_0_f_res_t_res_229333;
            } else {
                int64_t x_229334 = add64((int64_t) 3, gtid_229327);
                int64_t i_229335 = sub64(x_229334, (int64_t) 1);
                bool x_229336 = sle64((int64_t) 0, i_229335);
                bool y_229337 = slt64(i_229335,
                                      dyn_lifted_single_ma_l_arg_204234);
                bool bounds_check_229338 = x_229336 && y_229337;
                bool index_certs_229339;
                
                if (!bounds_check_229338) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229335,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204234,
                                  "].",
                                  "-> #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_229340;
                
                x_229340 = ((double *) mem_219386.mem)[gtid_212102 *
                                                       dyn_lifted_single_ma_l_arg_204234 +
                                                       i_229335];
                
                int64_t i_229341 = sub64(gtid_229327, (int64_t) 1);
                bool x_229342 = sle64((int64_t) 0, i_229341);
                bool y_229343 = slt64(i_229341,
                                      dyn_lifted_single_ma_l_arg_204234);
                bool bounds_check_229344 = x_229342 && y_229343;
                bool index_certs_229345;
                
                if (!bounds_check_229344) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) i_229341,
                                  "] out of bounds for array of shape [",
                                  (long long) dyn_lifted_single_ma_l_arg_204234,
                                  "].",
                                  "-> #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_229346;
                
                y_229346 = ((double *) mem_219386.mem)[gtid_212102 *
                                                       dyn_lifted_single_ma_l_arg_204234 +
                                                       i_229341];
                
                double x_229347 = x_229340 - y_229346;
                double defunc_0_f_res_f_res_229348 = x_229347 / 3.0;
                
                defunc_0_f_res_229332 = defunc_0_f_res_f_res_229348;
            }
            // Read carry in
            {
                x_229353 =
                    ((double *) scan_stage_2_accum_mem_229358)[(int64_t) 0];
            }
            // Read next values
            {
                x_229354 = ((double *) mem_219392.mem)[offset_index_229357 -
                                                       (int64_t) 1];
            }
            
            double defunc_1_op_res_229355 = x_229353 + x_229354;
            
            ((double *) mem_219392.mem)[offset_index_229357 - (int64_t) 1] =
                defunc_1_op_res_229355;
            ((double *) scan_stage_2_accum_mem_229358)[(int64_t) 0] =
                defunc_1_op_res_229355;
        }
        
        int64_t iter_229364 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_236229
        futhark_mc_scan_stage_3_parloop_struct_236229;
        
        futhark_mc_scan_stage_3_parloop_struct_236229.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_236229.free_dyn_lifted_single_ma_l_arg_204234 =
            dyn_lifted_single_ma_l_arg_204234;
        futhark_mc_scan_stage_3_parloop_struct_236229.free_gtid_212102 =
            gtid_212102;
        futhark_mc_scan_stage_3_parloop_struct_236229.free_x_212104 = x_212104;
        futhark_mc_scan_stage_3_parloop_struct_236229.free_mem_219386 =
            mem_219386.mem;
        futhark_mc_scan_stage_3_parloop_struct_236229.free_mem_219392 =
            mem_219392.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_236230_task;
        
        futhark_mc_scan_stage_3_parloop_236230_task.name =
            "futhark_mc_scan_stage_3_parloop_236230";
        futhark_mc_scan_stage_3_parloop_236230_task.fn =
            futhark_mc_scan_stage_3_parloop_236230;
        futhark_mc_scan_stage_3_parloop_236230_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_236229;
        futhark_mc_scan_stage_3_parloop_236230_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_236230_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_236230_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_236230_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_236230_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_236230_task);
        
        if (futhark_mc_scan_stage_3_parloop_236230_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_236230_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_236230_total_end -
                     futhark_mc_scan_stage_3_parloop_236230_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236230_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236230_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236230_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_229358);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_236225_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_236225_end -
                 futhark_mc_segscan_task_236225_start;
        
        ctx->futhark_mc_segscan_task_236225_runs[tid]++;
        ctx->futhark_mc_segscan_task_236225_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_236225_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236222(void *args, int64_t start,
                                            int64_t end, int flat_tid_212101,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236221
    *futhark_mc_segmap_parloop_struct_236221 =
    (struct futhark_mc_segmap_parloop_struct_236221 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236221->ctx;
    uint64_t futhark_mc_segmap_parloop_236222_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236222_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236221->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236221->free_partition_sizze_203667;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_segmap_parloop_struct_236221->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236221->free_bytes_217420;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_segmap_parloop_struct_236221->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219389 = {.desc ="mem_219389", .mem =
                                  futhark_mc_segmap_parloop_struct_236221->free_mem_219389,
                                  .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236221->free_mem_219411,
                                  .size =0, .references =NULL};
    size_t mem_219392_cached_sizze_236223 = 0;
    unsigned char *mem_219392 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229325 = start;
    
    if (mem_219392_cached_sizze_236223 < (size_t) bytes_217420) {
        mem_219392 = realloc(mem_219392, bytes_217420);
        mem_219392_cached_sizze_236223 = bytes_217420;
    }
    for (; iter_229325 < end; iter_229325++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229349 = partition_sizze_203667;
        int64_t gtid_212102 = iter_229325;
        int64_t remnant_229350 = iter_229325 - gtid_212102;
        double x_212104;
        
        x_212104 = ((double *) mem_219389.mem)[gtid_212102];
        
        int64_t flat_tid_229326 = (int64_t) 0;
        int32_t num_tasks_229351;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_236224 futhark_mc_task_236224;
        
        futhark_mc_task_236224.ctx = ctx;
        futhark_mc_task_236224.free_n_203572 = n_203572;
        futhark_mc_task_236224.free_dyn_lifted_single_ma_l_arg_204234 =
            dyn_lifted_single_ma_l_arg_204234;
        futhark_mc_task_236224.free_gtid_212102 = gtid_212102;
        futhark_mc_task_236224.free_x_212104 = x_212104;
        futhark_mc_task_236224.free_mem_219386 = mem_219386.mem;
        futhark_mc_task_236224.free_mem_219392 = mem_219392;
        
        struct scheduler_segop futhark_mc_task_236224_task;
        
        futhark_mc_task_236224_task.args = &futhark_mc_task_236224;
        futhark_mc_task_236224_task.top_level_fn =
            futhark_mc_segscan_task_236225;
        futhark_mc_task_236224_task.name = "futhark_mc_segscan_task_236225";
        futhark_mc_task_236224_task.iterations = n_203572;
        futhark_mc_task_236224_task.task_time =
            &ctx->futhark_mc_segscan_task_236225_total_time;
        futhark_mc_task_236224_task.task_iter =
            &ctx->futhark_mc_segscan_task_236225_total_iter;
        futhark_mc_task_236224_task.sched = STATIC;
        futhark_mc_task_236224_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_236225_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236224_task);
        
        if (futhark_mc_segscan_task_236225_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_219411.mem + gtid_212102 * n_203572 * (int64_t) 8,
                    mem_219392 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219392);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236222_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236222_end -
                 futhark_mc_segmap_parloop_236222_start;
        
        ctx->futhark_mc_segmap_parloop_236222_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236222_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236222_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236220(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212101 = tid;
    int num_tasks_229296 = info.nsubtasks;
    struct futhark_mc_task_236215 *futhark_mc_task_236215 =
                                  (struct futhark_mc_task_236215 *) args;
    struct futhark_context *ctx = futhark_mc_task_236215->ctx;
    uint64_t futhark_mc_segmap_nested_task_236220_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236220_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236215->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236215->free_partition_sizze_203667;
    int64_t dyn_lifted_single_ma_l_arg_204234 =
            futhark_mc_task_236215->free_dyn_lifted_single_ma_l_arg_204234;
    int64_t bytes_217420 = futhark_mc_task_236215->free_bytes_217420;
    struct memblock mem_219386 = {.desc ="mem_219386", .mem =
                                  futhark_mc_task_236215->free_mem_219386,
                                  .size =0, .references =NULL};
    struct memblock mem_219389 = {.desc ="mem_219389", .mem =
                                  futhark_mc_task_236215->free_mem_219389,
                                  .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236215->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t iter_229325;
    struct futhark_mc_segmap_parloop_struct_236221
    futhark_mc_segmap_parloop_struct_236221;
    
    futhark_mc_segmap_parloop_struct_236221.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236221.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236221.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236221.free_dyn_lifted_single_ma_l_arg_204234 =
        dyn_lifted_single_ma_l_arg_204234;
    futhark_mc_segmap_parloop_struct_236221.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236221.free_mem_219386 = mem_219386.mem;
    futhark_mc_segmap_parloop_struct_236221.free_mem_219389 = mem_219389.mem;
    futhark_mc_segmap_parloop_struct_236221.free_mem_219411 = mem_219411.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236222_task;
    
    futhark_mc_segmap_parloop_236222_task.name =
        "futhark_mc_segmap_parloop_236222";
    futhark_mc_segmap_parloop_236222_task.fn = futhark_mc_segmap_parloop_236222;
    futhark_mc_segmap_parloop_236222_task.args =
        &futhark_mc_segmap_parloop_struct_236221;
    futhark_mc_segmap_parloop_236222_task.iterations = iterations;
    futhark_mc_segmap_parloop_236222_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236222_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236222_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236222_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236222_task);
    
    if (futhark_mc_segmap_parloop_236222_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236222_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236222_total_end -
                 futhark_mc_segmap_parloop_236222_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236222_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236222_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236222_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236220_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236220_end -
                 futhark_mc_segmap_nested_task_236220_start;
        
        ctx->futhark_mc_segmap_nested_task_236220_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236220_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236220_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236231 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219437;
};
struct futhark_mc_segmap_parloop_struct_236233 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219437;
};
static int futhark_mc_segmap_parloop_236234(void *args, int64_t start,
                                            int64_t end, int flat_tid_212130,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236233
    *futhark_mc_segmap_parloop_struct_236233 =
    (struct futhark_mc_segmap_parloop_struct_236233 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236233->ctx;
    uint64_t futhark_mc_segmap_parloop_236234_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236234_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236233->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236233->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236233->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236233->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236233->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236233->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236233->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236233->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236233->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236233->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236233->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236233->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236233->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236233->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219437 = {.desc ="mem_219437", .mem =
                                  futhark_mc_segmap_parloop_struct_236233->free_mem_219437,
                                  .size =0, .references =NULL};
    size_t mem_219421_cached_sizze_236235 = 0;
    unsigned char *mem_219421 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229368 = start;
    
    if (mem_219421_cached_sizze_236235 < (size_t) bytes_217838) {
        mem_219421 = realloc(mem_219421, bytes_217838);
        mem_219421_cached_sizze_236235 = bytes_217838;
    }
    for (; iter_229368 < end; iter_229368++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229425 = partition_sizze_203667;
        int64_t gtid_212131 = iter_229368;
        int64_t remnant_229426 = iter_229368 - gtid_212131;
        
        for (int64_t i_229369 = 0; i_229369 < l_n_m_203733; i_229369++) {
            int64_t x_229371;
            
            x_229371 = ((int64_t *) mem_217891.mem)[gtid_212131 * l_n_m_203733 +
                                                    i_229369];
            
            double x_229372;
            
            x_229372 = ((double *) mem_217895.mem)[gtid_212131 * l_n_m_203733 +
                                                   i_229369];
            
            int64_t min_arg_229373 = mul64(jump_t_203582, i_229369);
            int64_t min_res_229374 = smin64(i_203760, min_arg_229373);
            int64_t defunc_0_g_res_229375 = add64((int64_t) 1, min_res_229374);
            double defunc_2_reduce_res_229376;
            double redout_229378 = 0.0;
            
            for (int64_t i_229377 = 0; i_229377 < q_l_203577; i_229377++) {
                bool cond_229379 = sle64(n_203572, i_229377);
                int64_t defunc_0_f_res_229380;
                
                if (cond_229379) {
                    defunc_0_f_res_229380 = (int64_t) 0;
                } else {
                    int64_t i_229381 = add64(x_229371, i_229377);
                    int64_t defunc_1_add_res_229382 = add64((int64_t) 1,
                                                            i_229381);
                    
                    defunc_0_f_res_229380 = defunc_1_add_res_229382;
                }
                
                double defunc_0_f_res_229383;
                
                if (cond_229379) {
                    defunc_0_f_res_229383 = 0.0;
                } else {
                    int64_t i_229384 = add64(x_229371, i_229377);
                    double defunc_0_add_arg_229385;
                    
                    defunc_0_add_arg_229385 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_212131 *
                                                           ctx_param_ext_217985 +
                                                           i_229384 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_229383 = defunc_0_add_arg_229385;
                }
                
                int64_t binop_p_229386 = sub64(defunc_0_f_res_229380,
                                               defunc_0_g_res_229375);
                double defunc_0_f_res_229387 = sitofp_i64_f64(binop_p_229386);
                double abs_res_229388 = fabs(defunc_0_f_res_229387);
                double tmp1_229389 = abs_res_229388 / x_229372;
                double x_229390 = tmp1_229389 * tmp1_229389;
                double y_229391 = tmp1_229389 * x_229390;
                double tmp2_229392 = 1.0 - y_229391;
                double x_229393 = tmp2_229392 * tmp2_229392;
                double tmp3_229394 = tmp2_229392 * x_229393;
                double w_j_229395 = defunc_0_f_res_229383 * tmp3_229394;
                double defunc_1_op_res_229396 = w_j_229395 + redout_229378;
                double redout_tmp_229428 = defunc_1_op_res_229396;
                
                redout_229378 = redout_tmp_229428;
            }
            defunc_2_reduce_res_229376 = redout_229378;
            
            double a0_229397 = 1.0 / defunc_2_reduce_res_229376;
            double defunc_2_reduce_res_229398;
            double redout_229400 = 0.0;
            
            for (int64_t i_229399 = 0; i_229399 < q_l_203577; i_229399++) {
                bool cond_229401 = sle64(n_203572, i_229399);
                int64_t defunc_0_f_res_229402;
                
                if (cond_229401) {
                    defunc_0_f_res_229402 = (int64_t) 0;
                } else {
                    int64_t i_229403 = add64(x_229371, i_229399);
                    int64_t defunc_1_add_res_229404 = add64((int64_t) 1,
                                                            i_229403);
                    
                    defunc_0_f_res_229402 = defunc_1_add_res_229404;
                }
                
                double defunc_0_f_res_229405;
                
                if (cond_229401) {
                    defunc_0_f_res_229405 = 0.0;
                } else {
                    int64_t i_229406 = add64(x_229371, i_229399);
                    double defunc_0_add_arg_229407;
                    
                    defunc_0_add_arg_229407 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_212131 *
                                                           ctx_param_ext_217985 +
                                                           i_229406 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_229405 = defunc_0_add_arg_229407;
                }
                
                int64_t binop_p_229408 = sub64(defunc_0_f_res_229402,
                                               defunc_0_g_res_229375);
                double defunc_0_f_res_229409 = sitofp_i64_f64(binop_p_229408);
                double abs_res_229410 = fabs(defunc_0_f_res_229409);
                double tmp1_229411 = abs_res_229410 / x_229372;
                double x_229412 = tmp1_229411 * tmp1_229411;
                double y_229413 = tmp1_229411 * x_229412;
                double tmp2_229414 = 1.0 - y_229413;
                double x_229415 = tmp2_229414 * tmp2_229414;
                double tmp3_229416 = tmp2_229414 * x_229415;
                double tmp4_229417 = defunc_0_f_res_229405 * tmp3_229416;
                double defunc_0_f_res_229418;
                
                if (cond_229401) {
                    defunc_0_f_res_229418 = 0.0;
                } else {
                    int64_t i_229419 = add64(x_229371, i_229399);
                    double defunc_0_add_arg_229420;
                    
                    defunc_0_add_arg_229420 =
                        ((double *) mem_219411.mem)[gtid_212131 * n_203572 +
                                                    i_229419];
                    defunc_0_f_res_229418 = defunc_0_add_arg_229420;
                }
                
                double x_229421 = a0_229397 * tmp4_229417;
                double defunc_9_fit_fun_res_229422 = defunc_0_f_res_229418 *
                       x_229421;
                double defunc_1_op_res_229423 = defunc_9_fit_fun_res_229422 +
                       redout_229400;
                double redout_tmp_229429 = defunc_1_op_res_229423;
                
                redout_229400 = redout_tmp_229429;
            }
            defunc_2_reduce_res_229398 = redout_229400;
            ((double *) mem_219421)[i_229369] = defunc_2_reduce_res_229398;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219437.mem + gtid_212131 * l_n_m_203733 * (int64_t) 8,
                    mem_219421 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219421);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236234_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236234_end -
                 futhark_mc_segmap_parloop_236234_start;
        
        ctx->futhark_mc_segmap_parloop_236234_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236234_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236234_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236232(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212130 = tid;
    int num_tasks_229367 = info.nsubtasks;
    struct futhark_mc_task_236231 *futhark_mc_task_236231 =
                                  (struct futhark_mc_task_236231 *) args;
    struct futhark_context *ctx = futhark_mc_task_236231->ctx;
    uint64_t futhark_mc_segmap_task_236232_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236232_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236231->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236231->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236231->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236231->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236231->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236231->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236231->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236231->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236231->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236231->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236231->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236231->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236231->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236231->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219437 = {.desc ="mem_219437", .mem =
                                  futhark_mc_task_236231->free_mem_219437,
                                  .size =0, .references =NULL};
    int64_t iter_229368;
    struct futhark_mc_segmap_parloop_struct_236233
    futhark_mc_segmap_parloop_struct_236233;
    
    futhark_mc_segmap_parloop_struct_236233.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236233.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236233.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236233.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236233.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236233.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236233.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236233.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236233.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236233.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236233.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236233.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236233.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236233.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236233.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236233.free_mem_219437 = mem_219437.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236234_task;
    
    futhark_mc_segmap_parloop_236234_task.name =
        "futhark_mc_segmap_parloop_236234";
    futhark_mc_segmap_parloop_236234_task.fn = futhark_mc_segmap_parloop_236234;
    futhark_mc_segmap_parloop_236234_task.args =
        &futhark_mc_segmap_parloop_struct_236233;
    futhark_mc_segmap_parloop_236234_task.iterations = iterations;
    futhark_mc_segmap_parloop_236234_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236234_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236234_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236234_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236234_task);
    
    if (futhark_mc_segmap_parloop_236234_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236234_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236234_total_end -
                 futhark_mc_segmap_parloop_236234_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236234_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236234_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236234_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236232_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236232_end -
                 futhark_mc_segmap_task_236232_start;
        
        ctx->futhark_mc_segmap_task_236232_runs[tid]++;
        ctx->futhark_mc_segmap_task_236232_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236232_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236237 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219437;
};
struct futhark_mc_task_236240 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_212205;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219418;
};
struct futhark_mc_segmap_parloop_struct_236242 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_212205;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219418;
};
static int futhark_mc_segmap_parloop_236243(void *args, int64_t start,
                                            int64_t end, int flat_tid_229490,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236242
    *futhark_mc_segmap_parloop_struct_236242 =
    (struct futhark_mc_segmap_parloop_struct_236242 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236242->ctx;
    uint64_t futhark_mc_segmap_parloop_236243_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236243_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236242->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236242->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236242->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236242->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236242->free_i_203760;
    int64_t gtid_212205 =
            futhark_mc_segmap_parloop_struct_236242->free_gtid_212205;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236242->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236242->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236242->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236242->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236242->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236242->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236242->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219418 = {.desc ="mem_219418", .mem =
                                  futhark_mc_segmap_parloop_struct_236242->free_mem_219418,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229548 = start;
    
    for (; iter_229548 < end; iter_229548++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229594 = l_n_m_203733;
        int64_t gtid_229491 = iter_229548;
        int64_t remnant_229595 = iter_229548 - gtid_229491;
        int64_t x_229492;
        
        x_229492 = ((int64_t *) mem_217891.mem)[gtid_212205 * l_n_m_203733 +
                                                gtid_229491];
        
        double x_229493;
        
        x_229493 = ((double *) mem_217895.mem)[gtid_212205 * l_n_m_203733 +
                                               gtid_229491];
        
        int64_t min_arg_229494 = mul64(jump_t_203582, gtid_229491);
        int64_t min_res_229495 = smin64(i_203760, min_arg_229494);
        int64_t defunc_0_g_res_229496 = add64((int64_t) 1, min_res_229495);
        double defunc_2_reduce_res_229497;
        double redout_229550 = 0.0;
        
        for (int64_t i_229549 = 0; i_229549 < q_l_203577; i_229549++) {
            bool cond_229551 = sle64(n_203572, i_229549);
            int64_t defunc_0_f_res_229552;
            
            if (cond_229551) {
                defunc_0_f_res_229552 = (int64_t) 0;
            } else {
                int64_t i_229553 = add64(x_229492, i_229549);
                int64_t defunc_1_add_res_229554 = add64((int64_t) 1, i_229553);
                
                defunc_0_f_res_229552 = defunc_1_add_res_229554;
            }
            
            double defunc_0_f_res_229555;
            
            if (cond_229551) {
                defunc_0_f_res_229555 = 0.0;
            } else {
                int64_t i_229556 = add64(x_229492, i_229549);
                double defunc_0_add_arg_229557;
                
                defunc_0_add_arg_229557 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_212205 *
                                                       ctx_param_ext_217985 +
                                                       i_229556 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_229555 = defunc_0_add_arg_229557;
            }
            
            int64_t binop_p_229558 = sub64(defunc_0_f_res_229552,
                                           defunc_0_g_res_229496);
            double defunc_0_f_res_229559 = sitofp_i64_f64(binop_p_229558);
            double abs_res_229560 = fabs(defunc_0_f_res_229559);
            double tmp1_229561 = abs_res_229560 / x_229493;
            double x_229562 = tmp1_229561 * tmp1_229561;
            double y_229563 = tmp1_229561 * x_229562;
            double tmp2_229564 = 1.0 - y_229563;
            double x_229565 = tmp2_229564 * tmp2_229564;
            double tmp3_229566 = tmp2_229564 * x_229565;
            double w_j_229567 = defunc_0_f_res_229555 * tmp3_229566;
            double defunc_1_op_res_229568 = w_j_229567 + redout_229550;
            double redout_tmp_229596 = defunc_1_op_res_229568;
            
            redout_229550 = redout_tmp_229596;
        }
        defunc_2_reduce_res_229497 = redout_229550;
        
        double a0_229518 = 1.0 / defunc_2_reduce_res_229497;
        double defunc_2_reduce_res_229519;
        double redout_229570 = 0.0;
        
        for (int64_t i_229569 = 0; i_229569 < q_l_203577; i_229569++) {
            bool cond_229571 = sle64(n_203572, i_229569);
            int64_t defunc_0_f_res_229572;
            
            if (cond_229571) {
                defunc_0_f_res_229572 = (int64_t) 0;
            } else {
                int64_t i_229573 = add64(x_229492, i_229569);
                int64_t defunc_1_add_res_229574 = add64((int64_t) 1, i_229573);
                
                defunc_0_f_res_229572 = defunc_1_add_res_229574;
            }
            
            double defunc_0_f_res_229575;
            
            if (cond_229571) {
                defunc_0_f_res_229575 = 0.0;
            } else {
                int64_t i_229576 = add64(x_229492, i_229569);
                double defunc_0_add_arg_229577;
                
                defunc_0_add_arg_229577 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_212205 *
                                                       ctx_param_ext_217985 +
                                                       i_229576 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_229575 = defunc_0_add_arg_229577;
            }
            
            int64_t binop_p_229578 = sub64(defunc_0_f_res_229572,
                                           defunc_0_g_res_229496);
            double defunc_0_f_res_229579 = sitofp_i64_f64(binop_p_229578);
            double abs_res_229580 = fabs(defunc_0_f_res_229579);
            double tmp1_229581 = abs_res_229580 / x_229493;
            double x_229582 = tmp1_229581 * tmp1_229581;
            double y_229583 = tmp1_229581 * x_229582;
            double tmp2_229584 = 1.0 - y_229583;
            double x_229585 = tmp2_229584 * tmp2_229584;
            double tmp3_229586 = tmp2_229584 * x_229585;
            double tmp4_229587 = defunc_0_f_res_229575 * tmp3_229586;
            double defunc_0_f_res_229588;
            
            if (cond_229571) {
                defunc_0_f_res_229588 = 0.0;
            } else {
                int64_t i_229589 = add64(x_229492, i_229569);
                double defunc_0_add_arg_229590;
                
                defunc_0_add_arg_229590 =
                    ((double *) mem_219411.mem)[gtid_212205 * n_203572 +
                                                i_229589];
                defunc_0_f_res_229588 = defunc_0_add_arg_229590;
            }
            
            double x_229591 = a0_229518 * tmp4_229587;
            double defunc_9_fit_fun_res_229592 = defunc_0_f_res_229588 *
                   x_229591;
            double defunc_1_op_res_229593 = defunc_9_fit_fun_res_229592 +
                   redout_229570;
            double redout_tmp_229597 = defunc_1_op_res_229593;
            
            redout_229570 = redout_tmp_229597;
        }
        defunc_2_reduce_res_229519 = redout_229570;
        ((double *) mem_219418.mem)[gtid_229491] = defunc_2_reduce_res_229519;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236243_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236243_end -
                 futhark_mc_segmap_parloop_236243_start;
        
        ctx->futhark_mc_segmap_parloop_236243_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236243_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236243_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236241(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229490 = tid;
    int num_tasks_229547 = 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_segmap_task_236241_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236241_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236240->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236240->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236240->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236240->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236240->free_i_203760;
    int64_t gtid_212205 = futhark_mc_task_236240->free_gtid_212205;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236240->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236240->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236240->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236240->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236240->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236240->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236240->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219418 = {.desc ="mem_219418", .mem =
                                  futhark_mc_task_236240->free_mem_219418,
                                  .size =0, .references =NULL};
    int64_t iter_229548;
    struct futhark_mc_segmap_parloop_struct_236242
    futhark_mc_segmap_parloop_struct_236242;
    
    futhark_mc_segmap_parloop_struct_236242.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236242.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236242.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236242.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236242.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236242.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236242.free_gtid_212205 = gtid_212205;
    futhark_mc_segmap_parloop_struct_236242.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236242.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236242.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236242.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236242.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236242.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236242.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236242.free_mem_219418 = mem_219418.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236243_task;
    
    futhark_mc_segmap_parloop_236243_task.name =
        "futhark_mc_segmap_parloop_236243";
    futhark_mc_segmap_parloop_236243_task.fn = futhark_mc_segmap_parloop_236243;
    futhark_mc_segmap_parloop_236243_task.args =
        &futhark_mc_segmap_parloop_struct_236242;
    futhark_mc_segmap_parloop_236243_task.iterations = iterations;
    futhark_mc_segmap_parloop_236243_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236243_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236243_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236243_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236243_task);
    
    if (futhark_mc_segmap_parloop_236243_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236243_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236243_total_end -
                 futhark_mc_segmap_parloop_236243_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236243_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236243_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236243_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236241_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236241_end -
                 futhark_mc_segmap_task_236241_start;
        
        ctx->futhark_mc_segmap_task_236241_runs[tid]++;
        ctx->futhark_mc_segmap_task_236241_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236241_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236245 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_212205;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219418;
};
struct futhark_mc_task_236247 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212205;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_229433;
    double free_x_229434;
    int64_t free_defunc_0_g_res_229437;
    double *retval_defunc_2_reduce_res_229438;
};
struct futhark_mc_segred_stage_1_parloop_struct_236250 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212205;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_229433;
    double free_x_229434;
    int64_t free_defunc_0_g_res_229437;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229651;
};
static int futhark_mc_segred_stage_1_parloop_236251(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229599,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236250
    *futhark_mc_segred_stage_1_parloop_struct_236250 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236250 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236250->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236251_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236251_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236250->free_n_203572;
    int64_t gtid_212205 =
            futhark_mc_segred_stage_1_parloop_struct_236250->free_gtid_212205;
    int64_t ctx_param_ext_217984 =
            futhark_mc_segred_stage_1_parloop_struct_236250->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segred_stage_1_parloop_struct_236250->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segred_stage_1_parloop_struct_236250->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236250->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_229433 =
            futhark_mc_segred_stage_1_parloop_struct_236250->free_x_229433;
    double x_229434 =
           futhark_mc_segred_stage_1_parloop_struct_236250->free_x_229434;
    int64_t defunc_0_g_res_229437 =
            futhark_mc_segred_stage_1_parloop_struct_236250->free_defunc_0_g_res_229437;
    struct memblock reduce_stage_1_tid_res_arr_mem_229651 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229651",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236250->free_reduce_stage_1_tid_res_arr_mem_229651,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229653 = start;
    double x_229601;
    double x_229602;
    double local_acc_229654 = 0.0;
    
    for (; iter_229653 < end; iter_229653++) {
        int64_t gtid_229600 = iter_229653;
        bool cond_229604 = sle64(n_203572, gtid_229600);
        int64_t defunc_0_f_res_229605;
        
        if (cond_229604) {
            defunc_0_f_res_229605 = (int64_t) 0;
        } else {
            int64_t i_229606 = add64(x_229433, gtid_229600);
            int64_t defunc_1_add_res_229607 = add64((int64_t) 1, i_229606);
            
            defunc_0_f_res_229605 = defunc_1_add_res_229607;
        }
        
        double defunc_0_f_res_229608;
        
        if (cond_229604) {
            defunc_0_f_res_229608 = 0.0;
        } else {
            int64_t i_229609 = add64(x_229433, gtid_229600);
            double defunc_0_add_arg_229610;
            
            defunc_0_add_arg_229610 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_212205 *
                                                   ctx_param_ext_217985 +
                                                   i_229609 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_229608 = defunc_0_add_arg_229610;
        }
        
        int64_t binop_p_229611 = sub64(defunc_0_f_res_229605,
                                       defunc_0_g_res_229437);
        double defunc_0_f_res_229612 = sitofp_i64_f64(binop_p_229611);
        double abs_res_229613 = fabs(defunc_0_f_res_229612);
        double tmp1_229614 = abs_res_229613 / x_229434;
        double x_229615 = tmp1_229614 * tmp1_229614;
        double y_229616 = tmp1_229614 * x_229615;
        double tmp2_229617 = 1.0 - y_229616;
        double x_229618 = tmp2_229617 * tmp2_229617;
        double tmp3_229619 = tmp2_229617 * x_229618;
        double w_j_229620 = defunc_0_f_res_229608 * tmp3_229619;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_229601 = local_acc_229654;
        }
        // Load next params
        {
            x_229602 = w_j_229620;
        }
        // Red body
        {
            double defunc_1_op_res_229603 = x_229601 + x_229602;
            
            local_acc_229654 = defunc_1_op_res_229603;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229651.mem)[flat_tid_229599] =
        local_acc_229654;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236251_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236251_end -
                 futhark_mc_segred_stage_1_parloop_236251_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236251_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236251_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236251_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236248(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229599 = tid;
    int num_tasks_229650 = info.nsubtasks;
    struct futhark_mc_task_236247 *futhark_mc_task_236247 =
                                  (struct futhark_mc_task_236247 *) args;
    struct futhark_context *ctx = futhark_mc_task_236247->ctx;
    uint64_t futhark_mc_segred_task_236248_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236248_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236247->free_n_203572;
    int64_t gtid_212205 = futhark_mc_task_236247->free_gtid_212205;
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236247->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236247->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236247->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236247->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_229433 = futhark_mc_task_236247->free_x_229433;
    double x_229434 = futhark_mc_task_236247->free_x_229434;
    int64_t defunc_0_g_res_229437 =
            futhark_mc_task_236247->free_defunc_0_g_res_229437;
    double defunc_2_reduce_res_229438 =
           *futhark_mc_task_236247->retval_defunc_2_reduce_res_229438;
    size_t reduce_stage_1_tid_res_arr_mem_229651_cached_sizze_236249 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229651 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229651_cached_sizze_236249 <
        (size_t) ((int64_t) 8 * num_tasks_229650)) {
        reduce_stage_1_tid_res_arr_mem_229651 =
            realloc(reduce_stage_1_tid_res_arr_mem_229651, (int64_t) 8 *
                    num_tasks_229650);
        reduce_stage_1_tid_res_arr_mem_229651_cached_sizze_236249 =
            (int64_t) 8 * num_tasks_229650;
    }
    
    int64_t iter_229653;
    struct futhark_mc_segred_stage_1_parloop_struct_236250
    futhark_mc_segred_stage_1_parloop_struct_236250;
    
    futhark_mc_segred_stage_1_parloop_struct_236250.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_gtid_212205 =
        gtid_212205;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_x_229433 = x_229433;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_x_229434 = x_229434;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_defunc_0_g_res_229437 =
        defunc_0_g_res_229437;
    futhark_mc_segred_stage_1_parloop_struct_236250.free_reduce_stage_1_tid_res_arr_mem_229651 =
        reduce_stage_1_tid_res_arr_mem_229651;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236251_task;
    
    futhark_mc_segred_stage_1_parloop_236251_task.name =
        "futhark_mc_segred_stage_1_parloop_236251";
    futhark_mc_segred_stage_1_parloop_236251_task.fn =
        futhark_mc_segred_stage_1_parloop_236251;
    futhark_mc_segred_stage_1_parloop_236251_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236250;
    futhark_mc_segred_stage_1_parloop_236251_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236251_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236251_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236251_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236251_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236251_task);
    
    if (futhark_mc_segred_stage_1_parloop_236251_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236251_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236251_total_end -
                 futhark_mc_segred_stage_1_parloop_236251_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236251_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236251_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236251_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_229438 = 0.0;
    }
    
    double x_229655;
    double x_229656;
    
    for (int32_t i_229658 = 0; i_229658 < num_tasks_229650; i_229658++) {
        flat_tid_229599 = i_229658;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229655 = defunc_2_reduce_res_229438;
            }
            // load next params
            {
                x_229656 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229651)[flat_tid_229599];
            }
            // red body
            {
                double defunc_1_op_res_229657 = x_229655 + x_229656;
                
                defunc_2_reduce_res_229438 = defunc_1_op_res_229657;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229651);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236248_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236248_end -
                 futhark_mc_segred_task_236248_start;
        
        ctx->futhark_mc_segred_task_236248_runs[tid]++;
        ctx->futhark_mc_segred_task_236248_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236248_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236247->retval_defunc_2_reduce_res_229438 =
            defunc_2_reduce_res_229438;
    }
    return err;
}
struct futhark_mc_task_236252 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212205;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_x_229433;
    double free_x_229434;
    int64_t free_defunc_0_g_res_229437;
    double free_a0_229461;
    double *retval_defunc_2_reduce_res_229462;
};
struct futhark_mc_segred_stage_1_parloop_struct_236255 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212205;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_x_229433;
    double free_x_229434;
    int64_t free_defunc_0_g_res_229437;
    double free_a0_229461;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_229660;
};
static int futhark_mc_segred_stage_1_parloop_236256(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_229621,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236255
    *futhark_mc_segred_stage_1_parloop_struct_236255 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236255 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236255->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236256_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236256_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236255->free_n_203572;
    int64_t gtid_212205 =
            futhark_mc_segred_stage_1_parloop_struct_236255->free_gtid_212205;
    int64_t ctx_param_ext_217984 =
            futhark_mc_segred_stage_1_parloop_struct_236255->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segred_stage_1_parloop_struct_236255->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segred_stage_1_parloop_struct_236255->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236255->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236255->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_229433 =
            futhark_mc_segred_stage_1_parloop_struct_236255->free_x_229433;
    double x_229434 =
           futhark_mc_segred_stage_1_parloop_struct_236255->free_x_229434;
    int64_t defunc_0_g_res_229437 =
            futhark_mc_segred_stage_1_parloop_struct_236255->free_defunc_0_g_res_229437;
    double a0_229461 =
           futhark_mc_segred_stage_1_parloop_struct_236255->free_a0_229461;
    struct memblock reduce_stage_1_tid_res_arr_mem_229660 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_229660",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236255->free_reduce_stage_1_tid_res_arr_mem_229660,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229662 = start;
    double x_229623;
    double x_229624;
    double local_acc_229663 = 0.0;
    
    for (; iter_229662 < end; iter_229662++) {
        int64_t gtid_229622 = iter_229662;
        bool cond_229626 = sle64(n_203572, gtid_229622);
        int64_t defunc_0_f_res_229627;
        
        if (cond_229626) {
            defunc_0_f_res_229627 = (int64_t) 0;
        } else {
            int64_t i_229628 = add64(x_229433, gtid_229622);
            int64_t defunc_1_add_res_229629 = add64((int64_t) 1, i_229628);
            
            defunc_0_f_res_229627 = defunc_1_add_res_229629;
        }
        
        double defunc_0_f_res_229630;
        
        if (cond_229626) {
            defunc_0_f_res_229630 = 0.0;
        } else {
            int64_t i_229631 = add64(x_229433, gtid_229622);
            double defunc_0_add_arg_229632;
            
            defunc_0_add_arg_229632 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_212205 *
                                                   ctx_param_ext_217985 +
                                                   i_229631 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_229630 = defunc_0_add_arg_229632;
        }
        
        int64_t binop_p_229633 = sub64(defunc_0_f_res_229627,
                                       defunc_0_g_res_229437);
        double defunc_0_f_res_229634 = sitofp_i64_f64(binop_p_229633);
        double abs_res_229635 = fabs(defunc_0_f_res_229634);
        double tmp1_229636 = abs_res_229635 / x_229434;
        double x_229637 = tmp1_229636 * tmp1_229636;
        double y_229638 = tmp1_229636 * x_229637;
        double tmp2_229639 = 1.0 - y_229638;
        double x_229640 = tmp2_229639 * tmp2_229639;
        double tmp3_229641 = tmp2_229639 * x_229640;
        double tmp4_229642 = defunc_0_f_res_229630 * tmp3_229641;
        double defunc_0_f_res_229643;
        
        if (cond_229626) {
            defunc_0_f_res_229643 = 0.0;
        } else {
            int64_t i_229644 = add64(x_229433, gtid_229622);
            double defunc_0_add_arg_229645;
            
            defunc_0_add_arg_229645 = ((double *) mem_219411.mem)[gtid_212205 *
                                                                  n_203572 +
                                                                  i_229644];
            defunc_0_f_res_229643 = defunc_0_add_arg_229645;
        }
        
        double x_229646 = a0_229461 * tmp4_229642;
        double defunc_9_fit_fun_res_229647 = defunc_0_f_res_229643 * x_229646;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_229623 = local_acc_229663;
        }
        // Load next params
        {
            x_229624 = defunc_9_fit_fun_res_229647;
        }
        // Red body
        {
            double defunc_1_op_res_229625 = x_229623 + x_229624;
            
            local_acc_229663 = defunc_1_op_res_229625;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_229660.mem)[flat_tid_229621] =
        local_acc_229663;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236256_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236256_end -
                 futhark_mc_segred_stage_1_parloop_236256_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236256_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236256_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236256_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236253(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229621 = tid;
    int num_tasks_229659 = info.nsubtasks;
    struct futhark_mc_task_236252 *futhark_mc_task_236252 =
                                  (struct futhark_mc_task_236252 *) args;
    struct futhark_context *ctx = futhark_mc_task_236252->ctx;
    uint64_t futhark_mc_segred_task_236253_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236253_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236252->free_n_203572;
    int64_t gtid_212205 = futhark_mc_task_236252->free_gtid_212205;
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236252->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236252->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236252->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236252->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236252->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_229433 = futhark_mc_task_236252->free_x_229433;
    double x_229434 = futhark_mc_task_236252->free_x_229434;
    int64_t defunc_0_g_res_229437 =
            futhark_mc_task_236252->free_defunc_0_g_res_229437;
    double a0_229461 = futhark_mc_task_236252->free_a0_229461;
    double defunc_2_reduce_res_229462 =
           *futhark_mc_task_236252->retval_defunc_2_reduce_res_229462;
    size_t reduce_stage_1_tid_res_arr_mem_229660_cached_sizze_236254 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_229660 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_229660_cached_sizze_236254 <
        (size_t) ((int64_t) 8 * num_tasks_229659)) {
        reduce_stage_1_tid_res_arr_mem_229660 =
            realloc(reduce_stage_1_tid_res_arr_mem_229660, (int64_t) 8 *
                    num_tasks_229659);
        reduce_stage_1_tid_res_arr_mem_229660_cached_sizze_236254 =
            (int64_t) 8 * num_tasks_229659;
    }
    
    int64_t iter_229662;
    struct futhark_mc_segred_stage_1_parloop_struct_236255
    futhark_mc_segred_stage_1_parloop_struct_236255;
    
    futhark_mc_segred_stage_1_parloop_struct_236255.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_gtid_212205 =
        gtid_212205;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_mem_219411 =
        mem_219411.mem;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_x_229433 = x_229433;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_x_229434 = x_229434;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_defunc_0_g_res_229437 =
        defunc_0_g_res_229437;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_a0_229461 = a0_229461;
    futhark_mc_segred_stage_1_parloop_struct_236255.free_reduce_stage_1_tid_res_arr_mem_229660 =
        reduce_stage_1_tid_res_arr_mem_229660;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236256_task;
    
    futhark_mc_segred_stage_1_parloop_236256_task.name =
        "futhark_mc_segred_stage_1_parloop_236256";
    futhark_mc_segred_stage_1_parloop_236256_task.fn =
        futhark_mc_segred_stage_1_parloop_236256;
    futhark_mc_segred_stage_1_parloop_236256_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236255;
    futhark_mc_segred_stage_1_parloop_236256_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236256_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236256_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236256_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236256_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236256_task);
    
    if (futhark_mc_segred_stage_1_parloop_236256_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236256_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236256_total_end -
                 futhark_mc_segred_stage_1_parloop_236256_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236256_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236256_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236256_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_229462 = 0.0;
    }
    
    double x_229664;
    double x_229665;
    
    for (int32_t i_229667 = 0; i_229667 < num_tasks_229659; i_229667++) {
        flat_tid_229621 = i_229667;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_229664 = defunc_2_reduce_res_229462;
            }
            // load next params
            {
                x_229665 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_229660)[flat_tid_229621];
            }
            // red body
            {
                double defunc_1_op_res_229666 = x_229664 + x_229665;
                
                defunc_2_reduce_res_229462 = defunc_1_op_res_229666;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_229660);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236253_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236253_end -
                 futhark_mc_segred_task_236253_start;
        
        ctx->futhark_mc_segred_task_236253_runs[tid]++;
        ctx->futhark_mc_segred_task_236253_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236253_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236252->retval_defunc_2_reduce_res_229462 =
            defunc_2_reduce_res_229462;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236246(void *args, int64_t start,
                                            int64_t end, int flat_tid_229431,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236245
    *futhark_mc_segmap_parloop_struct_236245 =
    (struct futhark_mc_segmap_parloop_struct_236245 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236245->ctx;
    uint64_t futhark_mc_segmap_parloop_236246_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236246_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236245->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236245->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236245->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236245->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236245->free_i_203760;
    int64_t gtid_212205 =
            futhark_mc_segmap_parloop_struct_236245->free_gtid_212205;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236245->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236245->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236245->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236245->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236245->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236245->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236245->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219418 = {.desc ="mem_219418", .mem =
                                  futhark_mc_segmap_parloop_struct_236245->free_mem_219418,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229598 = start;
    
    for (; iter_229598 < end; iter_229598++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229648 = l_n_m_203733;
        int64_t gtid_229432 = iter_229598;
        int64_t remnant_229649 = iter_229598 - gtid_229432;
        int64_t x_229433;
        
        x_229433 = ((int64_t *) mem_217891.mem)[gtid_212205 * l_n_m_203733 +
                                                gtid_229432];
        
        double x_229434;
        
        x_229434 = ((double *) mem_217895.mem)[gtid_212205 * l_n_m_203733 +
                                               gtid_229432];
        
        int64_t min_arg_229435 = mul64(jump_t_203582, gtid_229432);
        int64_t min_res_229436 = smin64(i_203760, min_arg_229435);
        int64_t defunc_0_g_res_229437 = add64((int64_t) 1, min_res_229436);
        double defunc_2_reduce_res_229438;
        int64_t flat_tid_229599 = (int64_t) 0;
        int32_t num_tasks_229650;
        
        defunc_2_reduce_res_229438 = 0.0;
        
        struct futhark_mc_task_236247 futhark_mc_task_236247;
        
        futhark_mc_task_236247.ctx = ctx;
        futhark_mc_task_236247.free_n_203572 = n_203572;
        futhark_mc_task_236247.free_gtid_212205 = gtid_212205;
        futhark_mc_task_236247.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236247.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236247.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236247.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236247.free_x_229433 = x_229433;
        futhark_mc_task_236247.free_x_229434 = x_229434;
        futhark_mc_task_236247.free_defunc_0_g_res_229437 =
            defunc_0_g_res_229437;
        futhark_mc_task_236247.retval_defunc_2_reduce_res_229438 =
            &defunc_2_reduce_res_229438;
        
        struct scheduler_segop futhark_mc_task_236247_task;
        
        futhark_mc_task_236247_task.args = &futhark_mc_task_236247;
        futhark_mc_task_236247_task.top_level_fn =
            futhark_mc_segred_task_236248;
        futhark_mc_task_236247_task.name = "futhark_mc_segred_task_236248";
        futhark_mc_task_236247_task.iterations = q_l_203577;
        futhark_mc_task_236247_task.task_time =
            &ctx->futhark_mc_segred_task_236248_total_time;
        futhark_mc_task_236247_task.task_iter =
            &ctx->futhark_mc_segred_task_236248_total_iter;
        futhark_mc_task_236247_task.sched = STATIC;
        futhark_mc_task_236247_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236248_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236247_task);
        
        if (futhark_mc_segred_task_236248_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_229461 = 1.0 / defunc_2_reduce_res_229438;
        double defunc_2_reduce_res_229462;
        int64_t flat_tid_229621 = (int64_t) 0;
        int32_t num_tasks_229659;
        
        defunc_2_reduce_res_229462 = 0.0;
        
        struct futhark_mc_task_236252 futhark_mc_task_236252;
        
        futhark_mc_task_236252.ctx = ctx;
        futhark_mc_task_236252.free_n_203572 = n_203572;
        futhark_mc_task_236252.free_gtid_212205 = gtid_212205;
        futhark_mc_task_236252.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236252.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236252.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236252.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236252.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236252.free_x_229433 = x_229433;
        futhark_mc_task_236252.free_x_229434 = x_229434;
        futhark_mc_task_236252.free_defunc_0_g_res_229437 =
            defunc_0_g_res_229437;
        futhark_mc_task_236252.free_a0_229461 = a0_229461;
        futhark_mc_task_236252.retval_defunc_2_reduce_res_229462 =
            &defunc_2_reduce_res_229462;
        
        struct scheduler_segop futhark_mc_task_236252_task;
        
        futhark_mc_task_236252_task.args = &futhark_mc_task_236252;
        futhark_mc_task_236252_task.top_level_fn =
            futhark_mc_segred_task_236253;
        futhark_mc_task_236252_task.name = "futhark_mc_segred_task_236253";
        futhark_mc_task_236252_task.iterations = q_l_203577;
        futhark_mc_task_236252_task.task_time =
            &ctx->futhark_mc_segred_task_236253_total_time;
        futhark_mc_task_236252_task.task_iter =
            &ctx->futhark_mc_segred_task_236253_total_iter;
        futhark_mc_task_236252_task.sched = STATIC;
        futhark_mc_task_236252_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236253_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236252_task);
        
        if (futhark_mc_segred_task_236253_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219418.mem)[gtid_229432] = defunc_2_reduce_res_229462;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236246_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236246_end -
                 futhark_mc_segmap_parloop_236246_start;
        
        ctx->futhark_mc_segmap_parloop_236246_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236246_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236246_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236244(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229431 = tid;
    int num_tasks_229547 = 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_segmap_nested_task_236244_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236244_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236240->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236240->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236240->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236240->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236240->free_i_203760;
    int64_t gtid_212205 = futhark_mc_task_236240->free_gtid_212205;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236240->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236240->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236240->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236240->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236240->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236240->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236240->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219418 = {.desc ="mem_219418", .mem =
                                  futhark_mc_task_236240->free_mem_219418,
                                  .size =0, .references =NULL};
    int64_t iter_229598;
    struct futhark_mc_segmap_parloop_struct_236245
    futhark_mc_segmap_parloop_struct_236245;
    
    futhark_mc_segmap_parloop_struct_236245.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236245.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236245.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236245.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236245.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236245.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236245.free_gtid_212205 = gtid_212205;
    futhark_mc_segmap_parloop_struct_236245.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236245.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236245.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236245.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236245.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236245.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236245.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236245.free_mem_219418 = mem_219418.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236246_task;
    
    futhark_mc_segmap_parloop_236246_task.name =
        "futhark_mc_segmap_parloop_236246";
    futhark_mc_segmap_parloop_236246_task.fn = futhark_mc_segmap_parloop_236246;
    futhark_mc_segmap_parloop_236246_task.args =
        &futhark_mc_segmap_parloop_struct_236245;
    futhark_mc_segmap_parloop_236246_task.iterations = iterations;
    futhark_mc_segmap_parloop_236246_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236246_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236246_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236246_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236246_task);
    
    if (futhark_mc_segmap_parloop_236246_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236246_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236246_total_end -
                 futhark_mc_segmap_parloop_236246_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236246_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236246_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236246_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236244_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236244_end -
                 futhark_mc_segmap_nested_task_236244_start;
        
        ctx->futhark_mc_segmap_nested_task_236244_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236244_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236244_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236238(void *args, int64_t start,
                                            int64_t end, int flat_tid_212204,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236237
    *futhark_mc_segmap_parloop_struct_236237 =
    (struct futhark_mc_segmap_parloop_struct_236237 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236237->ctx;
    uint64_t futhark_mc_segmap_parloop_236238_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236238_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236237->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236237->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236237->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236237->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236237->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236237->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236237->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236237->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236237->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236237->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236237->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236237->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236237->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236237->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219437 = {.desc ="mem_219437", .mem =
                                  futhark_mc_segmap_parloop_struct_236237->free_mem_219437,
                                  .size =0, .references =NULL};
    size_t mem_219418_cached_sizze_236239 = 0;
    unsigned char *mem_219418 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229430 = start;
    
    if (mem_219418_cached_sizze_236239 < (size_t) bytes_217838) {
        mem_219418 = realloc(mem_219418, bytes_217838);
        mem_219418_cached_sizze_236239 = bytes_217838;
    }
    for (; iter_229430 < end; iter_229430++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229545 = partition_sizze_203667;
        int64_t gtid_212205 = iter_229430;
        int64_t remnant_229546 = iter_229430 - gtid_212205;
        int64_t flat_tid_229490 = (int64_t) 0;
        int32_t num_tasks_229547;
        int64_t flat_tid_229431 = (int64_t) 0;
        struct futhark_mc_task_236240 futhark_mc_task_236240;
        
        futhark_mc_task_236240.ctx = ctx;
        futhark_mc_task_236240.free_n_203572 = n_203572;
        futhark_mc_task_236240.free_q_l_203577 = q_l_203577;
        futhark_mc_task_236240.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236240.free_l_n_m_203733 = l_n_m_203733;
        futhark_mc_task_236240.free_i_203760 = i_203760;
        futhark_mc_task_236240.free_gtid_212205 = gtid_212205;
        futhark_mc_task_236240.free_mem_217891 = mem_217891.mem;
        futhark_mc_task_236240.free_mem_217895 = mem_217895.mem;
        futhark_mc_task_236240.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236240.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236240.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236240.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236240.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236240.free_mem_219418 = mem_219418;
        
        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_segmap_task_236241;
        futhark_mc_task_236240_task.name = "futhark_mc_segmap_task_236241";
        futhark_mc_task_236240_task.iterations = l_n_m_203733;
        futhark_mc_task_236240_task.task_time =
            &ctx->futhark_mc_segmap_task_236241_total_time;
        futhark_mc_task_236240_task.task_iter =
            &ctx->futhark_mc_segmap_task_236241_total_iter;
        futhark_mc_task_236240_task.sched = STATIC;
        futhark_mc_task_236240_task.nested_fn =
            futhark_mc_segmap_nested_task_236244;
        
        int futhark_mc_segmap_task_236241_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236240_task);
        
        if (futhark_mc_segmap_task_236241_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219437.mem + gtid_212205 * l_n_m_203733 * (int64_t) 8,
                    mem_219418 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219418);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236238_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236238_end -
                 futhark_mc_segmap_parloop_236238_start;
        
        ctx->futhark_mc_segmap_parloop_236238_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236238_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236238_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236236(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212204 = tid;
    int num_tasks_229367 = info.nsubtasks;
    struct futhark_mc_task_236231 *futhark_mc_task_236231 =
                                  (struct futhark_mc_task_236231 *) args;
    struct futhark_context *ctx = futhark_mc_task_236231->ctx;
    uint64_t futhark_mc_segmap_nested_task_236236_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236236_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236231->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236231->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236231->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236231->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236231->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236231->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236231->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236231->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236231->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236231->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236231->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236231->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236231->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236231->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219437 = {.desc ="mem_219437", .mem =
                                  futhark_mc_task_236231->free_mem_219437,
                                  .size =0, .references =NULL};
    int64_t iter_229430;
    struct futhark_mc_segmap_parloop_struct_236237
    futhark_mc_segmap_parloop_struct_236237;
    
    futhark_mc_segmap_parloop_struct_236237.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236237.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236237.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236237.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236237.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236237.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236237.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236237.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236237.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236237.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236237.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236237.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236237.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236237.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236237.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236237.free_mem_219437 = mem_219437.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236238_task;
    
    futhark_mc_segmap_parloop_236238_task.name =
        "futhark_mc_segmap_parloop_236238";
    futhark_mc_segmap_parloop_236238_task.fn = futhark_mc_segmap_parloop_236238;
    futhark_mc_segmap_parloop_236238_task.args =
        &futhark_mc_segmap_parloop_struct_236237;
    futhark_mc_segmap_parloop_236238_task.iterations = iterations;
    futhark_mc_segmap_parloop_236238_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236238_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236238_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236238_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236238_task);
    
    if (futhark_mc_segmap_parloop_236238_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236238_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236238_total_end -
                 futhark_mc_segmap_parloop_236238_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236238_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236238_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236238_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236236_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236236_end -
                 futhark_mc_segmap_nested_task_236236_start;
        
        ctx->futhark_mc_segmap_nested_task_236236_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236236_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236236_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236257 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219477;
    unsigned char *free_mem_219481;
};
struct futhark_mc_segmap_parloop_struct_236259 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219477;
    unsigned char *free_mem_219481;
};
static int futhark_mc_segmap_parloop_236260(void *args, int64_t start,
                                            int64_t end, int flat_tid_212331,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236259
    *futhark_mc_segmap_parloop_struct_236259 =
    (struct futhark_mc_segmap_parloop_struct_236259 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236259->ctx;
    uint64_t futhark_mc_segmap_parloop_236260_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236260_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236259->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236259->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236259->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236259->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236259->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236259->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236259->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236259->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236259->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236259->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236259->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236259->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236259->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236259->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219477 = {.desc ="mem_219477", .mem =
                                  futhark_mc_segmap_parloop_struct_236259->free_mem_219477,
                                  .size =0, .references =NULL};
    struct memblock mem_219481 = {.desc ="mem_219481", .mem =
                                  futhark_mc_segmap_parloop_struct_236259->free_mem_219481,
                                  .size =0, .references =NULL};
    size_t mem_219446_cached_sizze_236261 = 0;
    unsigned char *mem_219446 = NULL;
    size_t mem_219449_cached_sizze_236262 = 0;
    unsigned char *mem_219449 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229669 = start;
    
    if (mem_219446_cached_sizze_236261 < (size_t) bytes_217838) {
        mem_219446 = realloc(mem_219446, bytes_217838);
        mem_219446_cached_sizze_236261 = bytes_217838;
    }
    if (mem_219449_cached_sizze_236262 < (size_t) bytes_217838) {
        mem_219449 = realloc(mem_219449, bytes_217838);
        mem_219449_cached_sizze_236262 = bytes_217838;
    }
    for (; iter_229669 < end; iter_229669++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229753 = partition_sizze_203667;
        int64_t gtid_212332 = iter_229669;
        int64_t remnant_229754 = iter_229669 - gtid_212332;
        
        for (int64_t i_229670 = 0; i_229670 < l_n_m_203733; i_229670++) {
            int64_t x_229673;
            
            x_229673 = ((int64_t *) mem_217891.mem)[gtid_212332 * l_n_m_203733 +
                                                    i_229670];
            
            double x_229674;
            
            x_229674 = ((double *) mem_217895.mem)[gtid_212332 * l_n_m_203733 +
                                                   i_229670];
            
            int64_t min_arg_229675 = mul64(jump_t_203582, i_229670);
            int64_t min_res_229676 = smin64(i_203760, min_arg_229675);
            int64_t defunc_0_g_res_229677 = add64((int64_t) 1, min_res_229676);
            double defunc_2_reduce_res_229678;
            double defunc_2_reduce_res_229679;
            double defunc_2_reduce_res_229680;
            double redout_229682;
            double redout_229683;
            double redout_229684;
            
            redout_229682 = 0.0;
            redout_229683 = 0.0;
            redout_229684 = 0.0;
            for (int64_t i_229681 = 0; i_229681 < q_l_203577; i_229681++) {
                bool cond_229685 = sle64(n_203572, i_229681);
                int64_t defunc_0_f_res_229686;
                
                if (cond_229685) {
                    defunc_0_f_res_229686 = (int64_t) 0;
                } else {
                    int64_t i_229687 = add64(x_229673, i_229681);
                    int64_t defunc_1_add_res_229688 = add64((int64_t) 1,
                                                            i_229687);
                    
                    defunc_0_f_res_229686 = defunc_1_add_res_229688;
                }
                
                double defunc_0_f_res_229689;
                
                if (cond_229685) {
                    defunc_0_f_res_229689 = 0.0;
                } else {
                    int64_t i_229690 = add64(x_229673, i_229681);
                    double defunc_0_add_arg_229691;
                    
                    defunc_0_add_arg_229691 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_212332 *
                                                           ctx_param_ext_217985 +
                                                           i_229690 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_229689 = defunc_0_add_arg_229691;
                }
                
                int64_t binop_p_229692 = sub64(defunc_0_f_res_229686,
                                               defunc_0_g_res_229677);
                double defunc_0_f_res_229693 = sitofp_i64_f64(binop_p_229692);
                double abs_res_229694 = fabs(defunc_0_f_res_229693);
                double tmp1_229695 = abs_res_229694 / x_229674;
                double x_229696 = tmp1_229695 * tmp1_229695;
                double y_229697 = tmp1_229695 * x_229696;
                double tmp2_229698 = 1.0 - y_229697;
                double x_229699 = tmp2_229698 * tmp2_229698;
                double tmp3_229700 = tmp2_229698 * x_229699;
                double w_j_229701 = defunc_0_f_res_229689 * tmp3_229700;
                double xw_j_229702 = defunc_0_f_res_229693 * w_j_229701;
                double x2w_j_229703 = defunc_0_f_res_229693 * xw_j_229702;
                double defunc_1_op_res_229704 = w_j_229701 + redout_229682;
                double defunc_1_op_res_229705 = xw_j_229702 + redout_229683;
                double defunc_1_op_res_229706 = x2w_j_229703 + redout_229684;
                double redout_tmp_229757 = defunc_1_op_res_229704;
                double redout_tmp_229758 = defunc_1_op_res_229705;
                double redout_tmp_229759 = defunc_1_op_res_229706;
                
                redout_229682 = redout_tmp_229757;
                redout_229683 = redout_tmp_229758;
                redout_229684 = redout_tmp_229759;
            }
            defunc_2_reduce_res_229678 = redout_229682;
            defunc_2_reduce_res_229679 = redout_229683;
            defunc_2_reduce_res_229680 = redout_229684;
            
            double x_229707 = defunc_2_reduce_res_229678 *
                   defunc_2_reduce_res_229680;
            double y_229708 = defunc_2_reduce_res_229679 *
                   defunc_2_reduce_res_229679;
            double y_229709 = x_229707 - y_229708;
            double det1_229710 = 1.0 / y_229709;
            double a11_229711 = defunc_2_reduce_res_229680 * det1_229710;
            double x_229712 = 0.0 - defunc_2_reduce_res_229679;
            double b11_229713 = det1_229710 * x_229712;
            double c11_229714 = defunc_2_reduce_res_229678 * det1_229710;
            double defunc_2_reduce_res_229715;
            double defunc_2_reduce_res_229716;
            double redout_229718;
            double redout_229719;
            
            redout_229718 = 0.0;
            redout_229719 = 0.0;
            for (int64_t i_229717 = 0; i_229717 < q_l_203577; i_229717++) {
                bool cond_229720 = sle64(n_203572, i_229717);
                int64_t defunc_0_f_res_229721;
                
                if (cond_229720) {
                    defunc_0_f_res_229721 = (int64_t) 0;
                } else {
                    int64_t i_229722 = add64(x_229673, i_229717);
                    int64_t defunc_1_add_res_229723 = add64((int64_t) 1,
                                                            i_229722);
                    
                    defunc_0_f_res_229721 = defunc_1_add_res_229723;
                }
                
                double defunc_0_f_res_229724;
                
                if (cond_229720) {
                    defunc_0_f_res_229724 = 0.0;
                } else {
                    int64_t i_229725 = add64(x_229673, i_229717);
                    double defunc_0_add_arg_229726;
                    
                    defunc_0_add_arg_229726 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_212332 *
                                                           ctx_param_ext_217985 +
                                                           i_229725 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_229724 = defunc_0_add_arg_229726;
                }
                
                int64_t binop_p_229727 = sub64(defunc_0_f_res_229721,
                                               defunc_0_g_res_229677);
                double defunc_0_f_res_229728 = sitofp_i64_f64(binop_p_229727);
                double abs_res_229729 = fabs(defunc_0_f_res_229728);
                double tmp1_229730 = abs_res_229729 / x_229674;
                double x_229731 = tmp1_229730 * tmp1_229730;
                double y_229732 = tmp1_229730 * x_229731;
                double tmp2_229733 = 1.0 - y_229732;
                double x_229734 = tmp2_229733 * tmp2_229733;
                double tmp3_229735 = tmp2_229733 * x_229734;
                double tmp4_229736 = defunc_0_f_res_229724 * tmp3_229735;
                double defunc_1_f_res_229737 = defunc_0_f_res_229728 *
                       tmp4_229736;
                double defunc_0_f_res_229738;
                
                if (cond_229720) {
                    defunc_0_f_res_229738 = 0.0;
                } else {
                    int64_t i_229739 = add64(x_229673, i_229717);
                    double defunc_0_add_arg_229740;
                    
                    defunc_0_add_arg_229740 =
                        ((double *) mem_219411.mem)[gtid_212332 * n_203572 +
                                                    i_229739];
                    defunc_0_f_res_229738 = defunc_0_add_arg_229740;
                }
                
                double x_229741 = a11_229711 * tmp4_229736;
                double y_229742 = b11_229713 * defunc_1_f_res_229737;
                double x_229743 = x_229741 + y_229742;
                double defunc_9_fit_fun_res_229744 = defunc_0_f_res_229738 *
                       x_229743;
                double x_229745 = b11_229713 * tmp4_229736;
                double y_229746 = c11_229714 * defunc_1_f_res_229737;
                double x_229747 = x_229745 + y_229746;
                double defunc_9_slope_fun_res_229748 = defunc_0_f_res_229738 *
                       x_229747;
                double defunc_1_op_res_229749 = defunc_9_fit_fun_res_229744 +
                       redout_229718;
                double defunc_1_op_res_229750 = defunc_9_slope_fun_res_229748 +
                       redout_229719;
                double redout_tmp_229760 = defunc_1_op_res_229749;
                double redout_tmp_229761 = defunc_1_op_res_229750;
                
                redout_229718 = redout_tmp_229760;
                redout_229719 = redout_tmp_229761;
            }
            defunc_2_reduce_res_229715 = redout_229718;
            defunc_2_reduce_res_229716 = redout_229719;
            ((double *) mem_219446)[i_229670] = defunc_2_reduce_res_229715;
            ((double *) mem_219449)[i_229670] = defunc_2_reduce_res_229716;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219477.mem + gtid_212332 * l_n_m_203733 * (int64_t) 8,
                    mem_219446 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219481.mem + gtid_212332 * l_n_m_203733 * (int64_t) 8,
                    mem_219449 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219446);
    free(mem_219449);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236260_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236260_end -
                 futhark_mc_segmap_parloop_236260_start;
        
        ctx->futhark_mc_segmap_parloop_236260_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236260_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236260_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236258(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212331 = tid;
    int num_tasks_229668 = info.nsubtasks;
    struct futhark_mc_task_236257 *futhark_mc_task_236257 =
                                  (struct futhark_mc_task_236257 *) args;
    struct futhark_context *ctx = futhark_mc_task_236257->ctx;
    uint64_t futhark_mc_segmap_task_236258_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236258_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236257->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236257->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236257->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236257->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236257->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236257->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236257->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236257->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236257->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236257->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236257->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236257->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236257->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236257->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219477 = {.desc ="mem_219477", .mem =
                                  futhark_mc_task_236257->free_mem_219477,
                                  .size =0, .references =NULL};
    struct memblock mem_219481 = {.desc ="mem_219481", .mem =
                                  futhark_mc_task_236257->free_mem_219481,
                                  .size =0, .references =NULL};
    int64_t iter_229669;
    struct futhark_mc_segmap_parloop_struct_236259
    futhark_mc_segmap_parloop_struct_236259;
    
    futhark_mc_segmap_parloop_struct_236259.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236259.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236259.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236259.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236259.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236259.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236259.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236259.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236259.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236259.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236259.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236259.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236259.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236259.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236259.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236259.free_mem_219477 = mem_219477.mem;
    futhark_mc_segmap_parloop_struct_236259.free_mem_219481 = mem_219481.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236260_task;
    
    futhark_mc_segmap_parloop_236260_task.name =
        "futhark_mc_segmap_parloop_236260";
    futhark_mc_segmap_parloop_236260_task.fn = futhark_mc_segmap_parloop_236260;
    futhark_mc_segmap_parloop_236260_task.args =
        &futhark_mc_segmap_parloop_struct_236259;
    futhark_mc_segmap_parloop_236260_task.iterations = iterations;
    futhark_mc_segmap_parloop_236260_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236260_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236260_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236260_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236260_task);
    
    if (futhark_mc_segmap_parloop_236260_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236260_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236260_total_end -
                 futhark_mc_segmap_parloop_236260_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236260_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236260_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236260_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236258_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236258_end -
                 futhark_mc_segmap_task_236258_start;
        
        ctx->futhark_mc_segmap_task_236258_runs[tid]++;
        ctx->futhark_mc_segmap_task_236258_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236258_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236264 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219477;
    unsigned char *free_mem_219481;
};
struct futhark_mc_task_236268 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_212434;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219440;
    unsigned char *free_mem_219443;
};
struct futhark_mc_segmap_parloop_struct_236270 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_212434;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219440;
    unsigned char *free_mem_219443;
};
static int futhark_mc_segmap_parloop_236271(void *args, int64_t start,
                                            int64_t end, int flat_tid_229850,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236270->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236270->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236270->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236270->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236270->free_i_203760;
    int64_t gtid_212434 =
            futhark_mc_segmap_parloop_struct_236270->free_gtid_212434;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236270->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236270->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236270->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236270->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236270->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236270->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236270->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219440 = {.desc ="mem_219440", .mem =
                                  futhark_mc_segmap_parloop_struct_236270->free_mem_219440,
                                  .size =0, .references =NULL};
    struct memblock mem_219443 = {.desc ="mem_219443", .mem =
                                  futhark_mc_segmap_parloop_struct_236270->free_mem_219443,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_229933 = start;
    
    for (; iter_229933 < end; iter_229933++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229994 = l_n_m_203733;
        int64_t gtid_229851 = iter_229933;
        int64_t remnant_229995 = iter_229933 - gtid_229851;
        int64_t x_229852;
        
        x_229852 = ((int64_t *) mem_217891.mem)[gtid_212434 * l_n_m_203733 +
                                                gtid_229851];
        
        double x_229853;
        
        x_229853 = ((double *) mem_217895.mem)[gtid_212434 * l_n_m_203733 +
                                               gtid_229851];
        
        int64_t min_arg_229854 = mul64(jump_t_203582, gtid_229851);
        int64_t min_res_229855 = smin64(i_203760, min_arg_229854);
        int64_t defunc_0_g_res_229856 = add64((int64_t) 1, min_res_229855);
        double defunc_2_reduce_res_229857;
        double defunc_2_reduce_res_229858;
        double defunc_2_reduce_res_229859;
        double redout_229935;
        double redout_229936;
        double redout_229937;
        
        redout_229935 = 0.0;
        redout_229936 = 0.0;
        redout_229937 = 0.0;
        for (int64_t i_229934 = 0; i_229934 < q_l_203577; i_229934++) {
            bool cond_229938 = sle64(n_203572, i_229934);
            int64_t defunc_0_f_res_229939;
            
            if (cond_229938) {
                defunc_0_f_res_229939 = (int64_t) 0;
            } else {
                int64_t i_229940 = add64(x_229852, i_229934);
                int64_t defunc_1_add_res_229941 = add64((int64_t) 1, i_229940);
                
                defunc_0_f_res_229939 = defunc_1_add_res_229941;
            }
            
            double defunc_0_f_res_229942;
            
            if (cond_229938) {
                defunc_0_f_res_229942 = 0.0;
            } else {
                int64_t i_229943 = add64(x_229852, i_229934);
                double defunc_0_add_arg_229944;
                
                defunc_0_add_arg_229944 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_212434 *
                                                       ctx_param_ext_217985 +
                                                       i_229943 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_229942 = defunc_0_add_arg_229944;
            }
            
            int64_t binop_p_229945 = sub64(defunc_0_f_res_229939,
                                           defunc_0_g_res_229856);
            double defunc_0_f_res_229946 = sitofp_i64_f64(binop_p_229945);
            double abs_res_229947 = fabs(defunc_0_f_res_229946);
            double tmp1_229948 = abs_res_229947 / x_229853;
            double x_229949 = tmp1_229948 * tmp1_229948;
            double y_229950 = tmp1_229948 * x_229949;
            double tmp2_229951 = 1.0 - y_229950;
            double x_229952 = tmp2_229951 * tmp2_229951;
            double tmp3_229953 = tmp2_229951 * x_229952;
            double w_j_229954 = defunc_0_f_res_229942 * tmp3_229953;
            double xw_j_229955 = defunc_0_f_res_229946 * w_j_229954;
            double x2w_j_229956 = defunc_0_f_res_229946 * xw_j_229955;
            double defunc_1_op_res_229957 = w_j_229954 + redout_229935;
            double defunc_1_op_res_229958 = xw_j_229955 + redout_229936;
            double defunc_1_op_res_229959 = x2w_j_229956 + redout_229937;
            double redout_tmp_229996 = defunc_1_op_res_229957;
            double redout_tmp_229997 = defunc_1_op_res_229958;
            double redout_tmp_229998 = defunc_1_op_res_229959;
            
            redout_229935 = redout_tmp_229996;
            redout_229936 = redout_tmp_229997;
            redout_229937 = redout_tmp_229998;
        }
        defunc_2_reduce_res_229857 = redout_229935;
        defunc_2_reduce_res_229858 = redout_229936;
        defunc_2_reduce_res_229859 = redout_229937;
        
        double x_229886 = defunc_2_reduce_res_229857 *
               defunc_2_reduce_res_229859;
        double y_229887 = defunc_2_reduce_res_229858 *
               defunc_2_reduce_res_229858;
        double y_229888 = x_229886 - y_229887;
        double det1_229889 = 1.0 / y_229888;
        double a11_229890 = defunc_2_reduce_res_229859 * det1_229889;
        double x_229891 = 0.0 - defunc_2_reduce_res_229858;
        double b11_229892 = det1_229889 * x_229891;
        double c11_229893 = defunc_2_reduce_res_229857 * det1_229889;
        double defunc_2_reduce_res_229894;
        double defunc_2_reduce_res_229895;
        double redout_229961;
        double redout_229962;
        
        redout_229961 = 0.0;
        redout_229962 = 0.0;
        for (int64_t i_229960 = 0; i_229960 < q_l_203577; i_229960++) {
            bool cond_229963 = sle64(n_203572, i_229960);
            int64_t defunc_0_f_res_229964;
            
            if (cond_229963) {
                defunc_0_f_res_229964 = (int64_t) 0;
            } else {
                int64_t i_229965 = add64(x_229852, i_229960);
                int64_t defunc_1_add_res_229966 = add64((int64_t) 1, i_229965);
                
                defunc_0_f_res_229964 = defunc_1_add_res_229966;
            }
            
            double defunc_0_f_res_229967;
            
            if (cond_229963) {
                defunc_0_f_res_229967 = 0.0;
            } else {
                int64_t i_229968 = add64(x_229852, i_229960);
                double defunc_0_add_arg_229969;
                
                defunc_0_add_arg_229969 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_212434 *
                                                       ctx_param_ext_217985 +
                                                       i_229968 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_229967 = defunc_0_add_arg_229969;
            }
            
            int64_t binop_p_229970 = sub64(defunc_0_f_res_229964,
                                           defunc_0_g_res_229856);
            double defunc_0_f_res_229971 = sitofp_i64_f64(binop_p_229970);
            double abs_res_229972 = fabs(defunc_0_f_res_229971);
            double tmp1_229973 = abs_res_229972 / x_229853;
            double x_229974 = tmp1_229973 * tmp1_229973;
            double y_229975 = tmp1_229973 * x_229974;
            double tmp2_229976 = 1.0 - y_229975;
            double x_229977 = tmp2_229976 * tmp2_229976;
            double tmp3_229978 = tmp2_229976 * x_229977;
            double tmp4_229979 = defunc_0_f_res_229967 * tmp3_229978;
            double defunc_1_f_res_229980 = defunc_0_f_res_229971 * tmp4_229979;
            double defunc_0_f_res_229981;
            
            if (cond_229963) {
                defunc_0_f_res_229981 = 0.0;
            } else {
                int64_t i_229982 = add64(x_229852, i_229960);
                double defunc_0_add_arg_229983;
                
                defunc_0_add_arg_229983 =
                    ((double *) mem_219411.mem)[gtid_212434 * n_203572 +
                                                i_229982];
                defunc_0_f_res_229981 = defunc_0_add_arg_229983;
            }
            
            double x_229984 = a11_229890 * tmp4_229979;
            double y_229985 = b11_229892 * defunc_1_f_res_229980;
            double x_229986 = x_229984 + y_229985;
            double defunc_9_fit_fun_res_229987 = defunc_0_f_res_229981 *
                   x_229986;
            double x_229988 = b11_229892 * tmp4_229979;
            double y_229989 = c11_229893 * defunc_1_f_res_229980;
            double x_229990 = x_229988 + y_229989;
            double defunc_9_slope_fun_res_229991 = defunc_0_f_res_229981 *
                   x_229990;
            double defunc_1_op_res_229992 = defunc_9_fit_fun_res_229987 +
                   redout_229961;
            double defunc_1_op_res_229993 = defunc_9_slope_fun_res_229991 +
                   redout_229962;
            double redout_tmp_229999 = defunc_1_op_res_229992;
            double redout_tmp_230000 = defunc_1_op_res_229993;
            
            redout_229961 = redout_tmp_229999;
            redout_229962 = redout_tmp_230000;
        }
        defunc_2_reduce_res_229894 = redout_229961;
        defunc_2_reduce_res_229895 = redout_229962;
        ((double *) mem_219440.mem)[gtid_229851] = defunc_2_reduce_res_229894;
        ((double *) mem_219443.mem)[gtid_229851] = defunc_2_reduce_res_229895;
    }
    
  cleanup:
    { }
    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_229850 = tid;
    int num_tasks_229932 = 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_203572 = futhark_mc_task_236268->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236268->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236268->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236268->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236268->free_i_203760;
    int64_t gtid_212434 = futhark_mc_task_236268->free_gtid_212434;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236268->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236268->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236268->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236268->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236268->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236268->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236268->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219440 = {.desc ="mem_219440", .mem =
                                  futhark_mc_task_236268->free_mem_219440,
                                  .size =0, .references =NULL};
    struct memblock mem_219443 = {.desc ="mem_219443", .mem =
                                  futhark_mc_task_236268->free_mem_219443,
                                  .size =0, .references =NULL};
    int64_t iter_229933;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236270.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236270.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236270.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236270.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236270.free_gtid_212434 = gtid_212434;
    futhark_mc_segmap_parloop_struct_236270.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236270.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236270.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236270.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236270.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236270.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236270.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236270.free_mem_219440 = mem_219440.mem;
    futhark_mc_segmap_parloop_struct_236270.free_mem_219443 = mem_219443.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_236273 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_212434;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219440;
    unsigned char *free_mem_219443;
};
struct futhark_mc_task_236275 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212434;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_229765;
    double free_x_229766;
    int64_t free_defunc_0_g_res_229769;
    double *retval_defunc_2_reduce_res_229770;
    double *retval_defunc_2_reduce_res_229771;
    double *retval_defunc_2_reduce_res_229772;
};
struct futhark_mc_segred_stage_1_parloop_struct_236280 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212434;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_229765;
    double free_x_229766;
    int64_t free_defunc_0_g_res_229769;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230072;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230074;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230076;
};
static int futhark_mc_segred_stage_1_parloop_236281(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230002,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236280
    *futhark_mc_segred_stage_1_parloop_struct_236280 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236280 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236280->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236281_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236281_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236280->free_n_203572;
    int64_t gtid_212434 =
            futhark_mc_segred_stage_1_parloop_struct_236280->free_gtid_212434;
    int64_t ctx_param_ext_217984 =
            futhark_mc_segred_stage_1_parloop_struct_236280->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segred_stage_1_parloop_struct_236280->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segred_stage_1_parloop_struct_236280->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236280->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_229765 =
            futhark_mc_segred_stage_1_parloop_struct_236280->free_x_229765;
    double x_229766 =
           futhark_mc_segred_stage_1_parloop_struct_236280->free_x_229766;
    int64_t defunc_0_g_res_229769 =
            futhark_mc_segred_stage_1_parloop_struct_236280->free_defunc_0_g_res_229769;
    struct memblock reduce_stage_1_tid_res_arr_mem_230072 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230072",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236280->free_reduce_stage_1_tid_res_arr_mem_230072,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230074 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230074",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236280->free_reduce_stage_1_tid_res_arr_mem_230074,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230076 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230076",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236280->free_reduce_stage_1_tid_res_arr_mem_230076,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230078 = start;
    double x_230004;
    double x_230005;
    double x_230007;
    double x_230008;
    double x_230010;
    double x_230011;
    double local_acc_230079 = 0.0;
    double local_acc_230080 = 0.0;
    double local_acc_230081 = 0.0;
    
    for (; iter_230078 < end; iter_230078++) {
        int64_t gtid_230003 = iter_230078;
        bool cond_230013 = sle64(n_203572, gtid_230003);
        int64_t defunc_0_f_res_230014;
        
        if (cond_230013) {
            defunc_0_f_res_230014 = (int64_t) 0;
        } else {
            int64_t i_230015 = add64(x_229765, gtid_230003);
            int64_t defunc_1_add_res_230016 = add64((int64_t) 1, i_230015);
            
            defunc_0_f_res_230014 = defunc_1_add_res_230016;
        }
        
        double defunc_0_f_res_230017;
        
        if (cond_230013) {
            defunc_0_f_res_230017 = 0.0;
        } else {
            int64_t i_230018 = add64(x_229765, gtid_230003);
            double defunc_0_add_arg_230019;
            
            defunc_0_add_arg_230019 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_212434 *
                                                   ctx_param_ext_217985 +
                                                   i_230018 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_230017 = defunc_0_add_arg_230019;
        }
        
        int64_t binop_p_230020 = sub64(defunc_0_f_res_230014,
                                       defunc_0_g_res_229769);
        double defunc_0_f_res_230021 = sitofp_i64_f64(binop_p_230020);
        double abs_res_230022 = fabs(defunc_0_f_res_230021);
        double tmp1_230023 = abs_res_230022 / x_229766;
        double x_230024 = tmp1_230023 * tmp1_230023;
        double y_230025 = tmp1_230023 * x_230024;
        double tmp2_230026 = 1.0 - y_230025;
        double x_230027 = tmp2_230026 * tmp2_230026;
        double tmp3_230028 = tmp2_230026 * x_230027;
        double w_j_230029 = defunc_0_f_res_230017 * tmp3_230028;
        double xw_j_230030 = defunc_0_f_res_230021 * w_j_230029;
        double x2w_j_230031 = defunc_0_f_res_230021 * xw_j_230030;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_230004 = local_acc_230079;
        }
        // Load next params
        {
            x_230005 = w_j_230029;
        }
        // Red body
        {
            double defunc_1_op_res_230006 = x_230004 + x_230005;
            
            local_acc_230079 = defunc_1_op_res_230006;
        }
        // Load accum params
        {
            x_230007 = local_acc_230080;
        }
        // Load next params
        {
            x_230008 = xw_j_230030;
        }
        // Red body
        {
            double defunc_1_op_res_230009 = x_230007 + x_230008;
            
            local_acc_230080 = defunc_1_op_res_230009;
        }
        // Load accum params
        {
            x_230010 = local_acc_230081;
        }
        // Load next params
        {
            x_230011 = x2w_j_230031;
        }
        // Red body
        {
            double defunc_1_op_res_230012 = x_230010 + x_230011;
            
            local_acc_230081 = defunc_1_op_res_230012;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230072.mem)[flat_tid_230002] =
        local_acc_230079;
    ((double *) reduce_stage_1_tid_res_arr_mem_230074.mem)[flat_tid_230002] =
        local_acc_230080;
    ((double *) reduce_stage_1_tid_res_arr_mem_230076.mem)[flat_tid_230002] =
        local_acc_230081;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236281_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236281_end -
                 futhark_mc_segred_stage_1_parloop_236281_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236281_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236281_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236281_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236276(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230002 = tid;
    int num_tasks_230071 = info.nsubtasks;
    struct futhark_mc_task_236275 *futhark_mc_task_236275 =
                                  (struct futhark_mc_task_236275 *) args;
    struct futhark_context *ctx = futhark_mc_task_236275->ctx;
    uint64_t futhark_mc_segred_task_236276_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236276_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236275->free_n_203572;
    int64_t gtid_212434 = futhark_mc_task_236275->free_gtid_212434;
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236275->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236275->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236275->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236275->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_229765 = futhark_mc_task_236275->free_x_229765;
    double x_229766 = futhark_mc_task_236275->free_x_229766;
    int64_t defunc_0_g_res_229769 =
            futhark_mc_task_236275->free_defunc_0_g_res_229769;
    double defunc_2_reduce_res_229770 =
           *futhark_mc_task_236275->retval_defunc_2_reduce_res_229770;
    double defunc_2_reduce_res_229771 =
           *futhark_mc_task_236275->retval_defunc_2_reduce_res_229771;
    double defunc_2_reduce_res_229772 =
           *futhark_mc_task_236275->retval_defunc_2_reduce_res_229772;
    size_t reduce_stage_1_tid_res_arr_mem_230072_cached_sizze_236277 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230072 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230074_cached_sizze_236278 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230074 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230076_cached_sizze_236279 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230076 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230072_cached_sizze_236277 <
        (size_t) ((int64_t) 8 * num_tasks_230071)) {
        reduce_stage_1_tid_res_arr_mem_230072 =
            realloc(reduce_stage_1_tid_res_arr_mem_230072, (int64_t) 8 *
                    num_tasks_230071);
        reduce_stage_1_tid_res_arr_mem_230072_cached_sizze_236277 =
            (int64_t) 8 * num_tasks_230071;
    }
    if (reduce_stage_1_tid_res_arr_mem_230074_cached_sizze_236278 <
        (size_t) ((int64_t) 8 * num_tasks_230071)) {
        reduce_stage_1_tid_res_arr_mem_230074 =
            realloc(reduce_stage_1_tid_res_arr_mem_230074, (int64_t) 8 *
                    num_tasks_230071);
        reduce_stage_1_tid_res_arr_mem_230074_cached_sizze_236278 =
            (int64_t) 8 * num_tasks_230071;
    }
    if (reduce_stage_1_tid_res_arr_mem_230076_cached_sizze_236279 <
        (size_t) ((int64_t) 8 * num_tasks_230071)) {
        reduce_stage_1_tid_res_arr_mem_230076 =
            realloc(reduce_stage_1_tid_res_arr_mem_230076, (int64_t) 8 *
                    num_tasks_230071);
        reduce_stage_1_tid_res_arr_mem_230076_cached_sizze_236279 =
            (int64_t) 8 * num_tasks_230071;
    }
    
    int64_t iter_230078;
    struct futhark_mc_segred_stage_1_parloop_struct_236280
    futhark_mc_segred_stage_1_parloop_struct_236280;
    
    futhark_mc_segred_stage_1_parloop_struct_236280.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_gtid_212434 =
        gtid_212434;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_x_229765 = x_229765;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_x_229766 = x_229766;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_defunc_0_g_res_229769 =
        defunc_0_g_res_229769;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_reduce_stage_1_tid_res_arr_mem_230072 =
        reduce_stage_1_tid_res_arr_mem_230072;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_reduce_stage_1_tid_res_arr_mem_230074 =
        reduce_stage_1_tid_res_arr_mem_230074;
    futhark_mc_segred_stage_1_parloop_struct_236280.free_reduce_stage_1_tid_res_arr_mem_230076 =
        reduce_stage_1_tid_res_arr_mem_230076;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236281_task;
    
    futhark_mc_segred_stage_1_parloop_236281_task.name =
        "futhark_mc_segred_stage_1_parloop_236281";
    futhark_mc_segred_stage_1_parloop_236281_task.fn =
        futhark_mc_segred_stage_1_parloop_236281;
    futhark_mc_segred_stage_1_parloop_236281_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236280;
    futhark_mc_segred_stage_1_parloop_236281_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236281_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236281_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236281_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236281_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236281_task);
    
    if (futhark_mc_segred_stage_1_parloop_236281_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236281_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236281_total_end -
                 futhark_mc_segred_stage_1_parloop_236281_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236281_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236281_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236281_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_229770 = 0.0;
        defunc_2_reduce_res_229771 = 0.0;
        defunc_2_reduce_res_229772 = 0.0;
    }
    
    double x_230082;
    double x_230083;
    double x_230085;
    double x_230086;
    double x_230088;
    double x_230089;
    
    for (int32_t i_230091 = 0; i_230091 < num_tasks_230071; i_230091++) {
        flat_tid_230002 = i_230091;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230082 = defunc_2_reduce_res_229770;
            }
            // load next params
            {
                x_230083 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230072)[flat_tid_230002];
            }
            // red body
            {
                double defunc_1_op_res_230084 = x_230082 + x_230083;
                
                defunc_2_reduce_res_229770 = defunc_1_op_res_230084;
            }
            // load acc params
            {
                x_230085 = defunc_2_reduce_res_229771;
            }
            // load next params
            {
                x_230086 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230074)[flat_tid_230002];
            }
            // red body
            {
                double defunc_1_op_res_230087 = x_230085 + x_230086;
                
                defunc_2_reduce_res_229771 = defunc_1_op_res_230087;
            }
            // load acc params
            {
                x_230088 = defunc_2_reduce_res_229772;
            }
            // load next params
            {
                x_230089 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230076)[flat_tid_230002];
            }
            // red body
            {
                double defunc_1_op_res_230090 = x_230088 + x_230089;
                
                defunc_2_reduce_res_229772 = defunc_1_op_res_230090;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230072);
        free(reduce_stage_1_tid_res_arr_mem_230074);
        free(reduce_stage_1_tid_res_arr_mem_230076);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236276_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236276_end -
                 futhark_mc_segred_task_236276_start;
        
        ctx->futhark_mc_segred_task_236276_runs[tid]++;
        ctx->futhark_mc_segred_task_236276_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236276_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236275->retval_defunc_2_reduce_res_229770 =
            defunc_2_reduce_res_229770;
        *futhark_mc_task_236275->retval_defunc_2_reduce_res_229771 =
            defunc_2_reduce_res_229771;
        *futhark_mc_task_236275->retval_defunc_2_reduce_res_229772 =
            defunc_2_reduce_res_229772;
    }
    return err;
}
struct futhark_mc_task_236282 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212434;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_x_229765;
    double free_x_229766;
    int64_t free_defunc_0_g_res_229769;
    double free_a11_229807;
    double free_b11_229809;
    double free_c11_229810;
    double *retval_defunc_2_reduce_res_229811;
    double *retval_defunc_2_reduce_res_229812;
};
struct futhark_mc_segred_stage_1_parloop_struct_236286 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212434;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_x_229765;
    double free_x_229766;
    int64_t free_defunc_0_g_res_229769;
    double free_a11_229807;
    double free_b11_229809;
    double free_c11_229810;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230093;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230095;
};
static int futhark_mc_segred_stage_1_parloop_236287(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230032,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236286
    *futhark_mc_segred_stage_1_parloop_struct_236286 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236286 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236286->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236287_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236287_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236286->free_n_203572;
    int64_t gtid_212434 =
            futhark_mc_segred_stage_1_parloop_struct_236286->free_gtid_212434;
    int64_t ctx_param_ext_217984 =
            futhark_mc_segred_stage_1_parloop_struct_236286->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segred_stage_1_parloop_struct_236286->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segred_stage_1_parloop_struct_236286->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236286->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236286->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_229765 =
            futhark_mc_segred_stage_1_parloop_struct_236286->free_x_229765;
    double x_229766 =
           futhark_mc_segred_stage_1_parloop_struct_236286->free_x_229766;
    int64_t defunc_0_g_res_229769 =
            futhark_mc_segred_stage_1_parloop_struct_236286->free_defunc_0_g_res_229769;
    double a11_229807 =
           futhark_mc_segred_stage_1_parloop_struct_236286->free_a11_229807;
    double b11_229809 =
           futhark_mc_segred_stage_1_parloop_struct_236286->free_b11_229809;
    double c11_229810 =
           futhark_mc_segred_stage_1_parloop_struct_236286->free_c11_229810;
    struct memblock reduce_stage_1_tid_res_arr_mem_230093 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230093",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236286->free_reduce_stage_1_tid_res_arr_mem_230093,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230095 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230095",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236286->free_reduce_stage_1_tid_res_arr_mem_230095,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230097 = start;
    double x_230034;
    double x_230035;
    double x_230037;
    double x_230038;
    double local_acc_230098 = 0.0;
    double local_acc_230099 = 0.0;
    
    for (; iter_230097 < end; iter_230097++) {
        int64_t gtid_230033 = iter_230097;
        bool cond_230040 = sle64(n_203572, gtid_230033);
        int64_t defunc_0_f_res_230041;
        
        if (cond_230040) {
            defunc_0_f_res_230041 = (int64_t) 0;
        } else {
            int64_t i_230042 = add64(x_229765, gtid_230033);
            int64_t defunc_1_add_res_230043 = add64((int64_t) 1, i_230042);
            
            defunc_0_f_res_230041 = defunc_1_add_res_230043;
        }
        
        double defunc_0_f_res_230044;
        
        if (cond_230040) {
            defunc_0_f_res_230044 = 0.0;
        } else {
            int64_t i_230045 = add64(x_229765, gtid_230033);
            double defunc_0_add_arg_230046;
            
            defunc_0_add_arg_230046 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_212434 *
                                                   ctx_param_ext_217985 +
                                                   i_230045 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_230044 = defunc_0_add_arg_230046;
        }
        
        int64_t binop_p_230047 = sub64(defunc_0_f_res_230041,
                                       defunc_0_g_res_229769);
        double defunc_0_f_res_230048 = sitofp_i64_f64(binop_p_230047);
        double abs_res_230049 = fabs(defunc_0_f_res_230048);
        double tmp1_230050 = abs_res_230049 / x_229766;
        double x_230051 = tmp1_230050 * tmp1_230050;
        double y_230052 = tmp1_230050 * x_230051;
        double tmp2_230053 = 1.0 - y_230052;
        double x_230054 = tmp2_230053 * tmp2_230053;
        double tmp3_230055 = tmp2_230053 * x_230054;
        double tmp4_230056 = defunc_0_f_res_230044 * tmp3_230055;
        double defunc_1_f_res_230057 = defunc_0_f_res_230048 * tmp4_230056;
        double defunc_0_f_res_230058;
        
        if (cond_230040) {
            defunc_0_f_res_230058 = 0.0;
        } else {
            int64_t i_230059 = add64(x_229765, gtid_230033);
            double defunc_0_add_arg_230060;
            
            defunc_0_add_arg_230060 = ((double *) mem_219411.mem)[gtid_212434 *
                                                                  n_203572 +
                                                                  i_230059];
            defunc_0_f_res_230058 = defunc_0_add_arg_230060;
        }
        
        double x_230061 = a11_229807 * tmp4_230056;
        double y_230062 = b11_229809 * defunc_1_f_res_230057;
        double x_230063 = x_230061 + y_230062;
        double defunc_9_fit_fun_res_230064 = defunc_0_f_res_230058 * x_230063;
        double x_230065 = b11_229809 * tmp4_230056;
        double y_230066 = c11_229810 * defunc_1_f_res_230057;
        double x_230067 = x_230065 + y_230066;
        double defunc_9_slope_fun_res_230068 = defunc_0_f_res_230058 * x_230067;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_230034 = local_acc_230098;
        }
        // Load next params
        {
            x_230035 = defunc_9_fit_fun_res_230064;
        }
        // Red body
        {
            double defunc_1_op_res_230036 = x_230034 + x_230035;
            
            local_acc_230098 = defunc_1_op_res_230036;
        }
        // Load accum params
        {
            x_230037 = local_acc_230099;
        }
        // Load next params
        {
            x_230038 = defunc_9_slope_fun_res_230068;
        }
        // Red body
        {
            double defunc_1_op_res_230039 = x_230037 + x_230038;
            
            local_acc_230099 = defunc_1_op_res_230039;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230093.mem)[flat_tid_230032] =
        local_acc_230098;
    ((double *) reduce_stage_1_tid_res_arr_mem_230095.mem)[flat_tid_230032] =
        local_acc_230099;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236287_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236287_end -
                 futhark_mc_segred_stage_1_parloop_236287_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236287_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236287_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236287_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236283(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230032 = tid;
    int num_tasks_230092 = info.nsubtasks;
    struct futhark_mc_task_236282 *futhark_mc_task_236282 =
                                  (struct futhark_mc_task_236282 *) args;
    struct futhark_context *ctx = futhark_mc_task_236282->ctx;
    uint64_t futhark_mc_segred_task_236283_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236283_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236282->free_n_203572;
    int64_t gtid_212434 = futhark_mc_task_236282->free_gtid_212434;
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236282->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236282->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236282->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236282->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236282->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_229765 = futhark_mc_task_236282->free_x_229765;
    double x_229766 = futhark_mc_task_236282->free_x_229766;
    int64_t defunc_0_g_res_229769 =
            futhark_mc_task_236282->free_defunc_0_g_res_229769;
    double a11_229807 = futhark_mc_task_236282->free_a11_229807;
    double b11_229809 = futhark_mc_task_236282->free_b11_229809;
    double c11_229810 = futhark_mc_task_236282->free_c11_229810;
    double defunc_2_reduce_res_229811 =
           *futhark_mc_task_236282->retval_defunc_2_reduce_res_229811;
    double defunc_2_reduce_res_229812 =
           *futhark_mc_task_236282->retval_defunc_2_reduce_res_229812;
    size_t reduce_stage_1_tid_res_arr_mem_230093_cached_sizze_236284 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230093 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230095_cached_sizze_236285 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230095 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230093_cached_sizze_236284 <
        (size_t) ((int64_t) 8 * num_tasks_230092)) {
        reduce_stage_1_tid_res_arr_mem_230093 =
            realloc(reduce_stage_1_tid_res_arr_mem_230093, (int64_t) 8 *
                    num_tasks_230092);
        reduce_stage_1_tid_res_arr_mem_230093_cached_sizze_236284 =
            (int64_t) 8 * num_tasks_230092;
    }
    if (reduce_stage_1_tid_res_arr_mem_230095_cached_sizze_236285 <
        (size_t) ((int64_t) 8 * num_tasks_230092)) {
        reduce_stage_1_tid_res_arr_mem_230095 =
            realloc(reduce_stage_1_tid_res_arr_mem_230095, (int64_t) 8 *
                    num_tasks_230092);
        reduce_stage_1_tid_res_arr_mem_230095_cached_sizze_236285 =
            (int64_t) 8 * num_tasks_230092;
    }
    
    int64_t iter_230097;
    struct futhark_mc_segred_stage_1_parloop_struct_236286
    futhark_mc_segred_stage_1_parloop_struct_236286;
    
    futhark_mc_segred_stage_1_parloop_struct_236286.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_gtid_212434 =
        gtid_212434;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_mem_219411 =
        mem_219411.mem;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_x_229765 = x_229765;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_x_229766 = x_229766;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_defunc_0_g_res_229769 =
        defunc_0_g_res_229769;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_a11_229807 =
        a11_229807;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_b11_229809 =
        b11_229809;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_c11_229810 =
        c11_229810;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_reduce_stage_1_tid_res_arr_mem_230093 =
        reduce_stage_1_tid_res_arr_mem_230093;
    futhark_mc_segred_stage_1_parloop_struct_236286.free_reduce_stage_1_tid_res_arr_mem_230095 =
        reduce_stage_1_tid_res_arr_mem_230095;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236287_task;
    
    futhark_mc_segred_stage_1_parloop_236287_task.name =
        "futhark_mc_segred_stage_1_parloop_236287";
    futhark_mc_segred_stage_1_parloop_236287_task.fn =
        futhark_mc_segred_stage_1_parloop_236287;
    futhark_mc_segred_stage_1_parloop_236287_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236286;
    futhark_mc_segred_stage_1_parloop_236287_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236287_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236287_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236287_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236287_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236287_task);
    
    if (futhark_mc_segred_stage_1_parloop_236287_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236287_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236287_total_end -
                 futhark_mc_segred_stage_1_parloop_236287_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236287_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236287_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236287_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_229811 = 0.0;
        defunc_2_reduce_res_229812 = 0.0;
    }
    
    double x_230100;
    double x_230101;
    double x_230103;
    double x_230104;
    
    for (int32_t i_230106 = 0; i_230106 < num_tasks_230092; i_230106++) {
        flat_tid_230032 = i_230106;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230100 = defunc_2_reduce_res_229811;
            }
            // load next params
            {
                x_230101 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230093)[flat_tid_230032];
            }
            // red body
            {
                double defunc_1_op_res_230102 = x_230100 + x_230101;
                
                defunc_2_reduce_res_229811 = defunc_1_op_res_230102;
            }
            // load acc params
            {
                x_230103 = defunc_2_reduce_res_229812;
            }
            // load next params
            {
                x_230104 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230095)[flat_tid_230032];
            }
            // red body
            {
                double defunc_1_op_res_230105 = x_230103 + x_230104;
                
                defunc_2_reduce_res_229812 = defunc_1_op_res_230105;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230093);
        free(reduce_stage_1_tid_res_arr_mem_230095);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236283_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236283_end -
                 futhark_mc_segred_task_236283_start;
        
        ctx->futhark_mc_segred_task_236283_runs[tid]++;
        ctx->futhark_mc_segred_task_236283_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236283_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236282->retval_defunc_2_reduce_res_229811 =
            defunc_2_reduce_res_229811;
        *futhark_mc_task_236282->retval_defunc_2_reduce_res_229812 =
            defunc_2_reduce_res_229812;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236274(void *args, int64_t start,
                                            int64_t end, int flat_tid_229763,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236273
    *futhark_mc_segmap_parloop_struct_236273 =
    (struct futhark_mc_segmap_parloop_struct_236273 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236273->ctx;
    uint64_t futhark_mc_segmap_parloop_236274_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236274_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236273->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236273->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236273->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236273->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236273->free_i_203760;
    int64_t gtid_212434 =
            futhark_mc_segmap_parloop_struct_236273->free_gtid_212434;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236273->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236273->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236273->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236273->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236273->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236273->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236273->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219440 = {.desc ="mem_219440", .mem =
                                  futhark_mc_segmap_parloop_struct_236273->free_mem_219440,
                                  .size =0, .references =NULL};
    struct memblock mem_219443 = {.desc ="mem_219443", .mem =
                                  futhark_mc_segmap_parloop_struct_236273->free_mem_219443,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230001 = start;
    
    for (; iter_230001 < end; iter_230001++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230069 = l_n_m_203733;
        int64_t gtid_229764 = iter_230001;
        int64_t remnant_230070 = iter_230001 - gtid_229764;
        int64_t x_229765;
        
        x_229765 = ((int64_t *) mem_217891.mem)[gtid_212434 * l_n_m_203733 +
                                                gtid_229764];
        
        double x_229766;
        
        x_229766 = ((double *) mem_217895.mem)[gtid_212434 * l_n_m_203733 +
                                               gtid_229764];
        
        int64_t min_arg_229767 = mul64(jump_t_203582, gtid_229764);
        int64_t min_res_229768 = smin64(i_203760, min_arg_229767);
        int64_t defunc_0_g_res_229769 = add64((int64_t) 1, min_res_229768);
        double defunc_2_reduce_res_229770;
        double defunc_2_reduce_res_229771;
        double defunc_2_reduce_res_229772;
        int64_t flat_tid_230002 = (int64_t) 0;
        int32_t num_tasks_230071;
        
        defunc_2_reduce_res_229770 = 0.0;
        defunc_2_reduce_res_229771 = 0.0;
        defunc_2_reduce_res_229772 = 0.0;
        
        struct futhark_mc_task_236275 futhark_mc_task_236275;
        
        futhark_mc_task_236275.ctx = ctx;
        futhark_mc_task_236275.free_n_203572 = n_203572;
        futhark_mc_task_236275.free_gtid_212434 = gtid_212434;
        futhark_mc_task_236275.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236275.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236275.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236275.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236275.free_x_229765 = x_229765;
        futhark_mc_task_236275.free_x_229766 = x_229766;
        futhark_mc_task_236275.free_defunc_0_g_res_229769 =
            defunc_0_g_res_229769;
        futhark_mc_task_236275.retval_defunc_2_reduce_res_229770 =
            &defunc_2_reduce_res_229770;
        futhark_mc_task_236275.retval_defunc_2_reduce_res_229771 =
            &defunc_2_reduce_res_229771;
        futhark_mc_task_236275.retval_defunc_2_reduce_res_229772 =
            &defunc_2_reduce_res_229772;
        
        struct scheduler_segop futhark_mc_task_236275_task;
        
        futhark_mc_task_236275_task.args = &futhark_mc_task_236275;
        futhark_mc_task_236275_task.top_level_fn =
            futhark_mc_segred_task_236276;
        futhark_mc_task_236275_task.name = "futhark_mc_segred_task_236276";
        futhark_mc_task_236275_task.iterations = q_l_203577;
        futhark_mc_task_236275_task.task_time =
            &ctx->futhark_mc_segred_task_236276_total_time;
        futhark_mc_task_236275_task.task_iter =
            &ctx->futhark_mc_segred_task_236276_total_iter;
        futhark_mc_task_236275_task.sched = STATIC;
        futhark_mc_task_236275_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236276_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236275_task);
        
        if (futhark_mc_segred_task_236276_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_229803 = defunc_2_reduce_res_229770 *
               defunc_2_reduce_res_229772;
        double y_229804 = defunc_2_reduce_res_229771 *
               defunc_2_reduce_res_229771;
        double y_229805 = x_229803 - y_229804;
        double det1_229806 = 1.0 / y_229805;
        double a11_229807 = defunc_2_reduce_res_229772 * det1_229806;
        double x_229808 = 0.0 - defunc_2_reduce_res_229771;
        double b11_229809 = det1_229806 * x_229808;
        double c11_229810 = defunc_2_reduce_res_229770 * det1_229806;
        double defunc_2_reduce_res_229811;
        double defunc_2_reduce_res_229812;
        int64_t flat_tid_230032 = (int64_t) 0;
        int32_t num_tasks_230092;
        
        defunc_2_reduce_res_229811 = 0.0;
        defunc_2_reduce_res_229812 = 0.0;
        
        struct futhark_mc_task_236282 futhark_mc_task_236282;
        
        futhark_mc_task_236282.ctx = ctx;
        futhark_mc_task_236282.free_n_203572 = n_203572;
        futhark_mc_task_236282.free_gtid_212434 = gtid_212434;
        futhark_mc_task_236282.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236282.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236282.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236282.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236282.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236282.free_x_229765 = x_229765;
        futhark_mc_task_236282.free_x_229766 = x_229766;
        futhark_mc_task_236282.free_defunc_0_g_res_229769 =
            defunc_0_g_res_229769;
        futhark_mc_task_236282.free_a11_229807 = a11_229807;
        futhark_mc_task_236282.free_b11_229809 = b11_229809;
        futhark_mc_task_236282.free_c11_229810 = c11_229810;
        futhark_mc_task_236282.retval_defunc_2_reduce_res_229811 =
            &defunc_2_reduce_res_229811;
        futhark_mc_task_236282.retval_defunc_2_reduce_res_229812 =
            &defunc_2_reduce_res_229812;
        
        struct scheduler_segop futhark_mc_task_236282_task;
        
        futhark_mc_task_236282_task.args = &futhark_mc_task_236282;
        futhark_mc_task_236282_task.top_level_fn =
            futhark_mc_segred_task_236283;
        futhark_mc_task_236282_task.name = "futhark_mc_segred_task_236283";
        futhark_mc_task_236282_task.iterations = q_l_203577;
        futhark_mc_task_236282_task.task_time =
            &ctx->futhark_mc_segred_task_236283_total_time;
        futhark_mc_task_236282_task.task_iter =
            &ctx->futhark_mc_segred_task_236283_total_iter;
        futhark_mc_task_236282_task.sched = STATIC;
        futhark_mc_task_236282_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236283_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236282_task);
        
        if (futhark_mc_segred_task_236283_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219440.mem)[gtid_229764] = defunc_2_reduce_res_229811;
        ((double *) mem_219443.mem)[gtid_229764] = defunc_2_reduce_res_229812;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236274_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236274_end -
                 futhark_mc_segmap_parloop_236274_start;
        
        ctx->futhark_mc_segmap_parloop_236274_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236274_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236274_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236272(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_229763 = tid;
    int num_tasks_229932 = 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_236272_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236272_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236268->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236268->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236268->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236268->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236268->free_i_203760;
    int64_t gtid_212434 = futhark_mc_task_236268->free_gtid_212434;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236268->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236268->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236268->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236268->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236268->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236268->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236268->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219440 = {.desc ="mem_219440", .mem =
                                  futhark_mc_task_236268->free_mem_219440,
                                  .size =0, .references =NULL};
    struct memblock mem_219443 = {.desc ="mem_219443", .mem =
                                  futhark_mc_task_236268->free_mem_219443,
                                  .size =0, .references =NULL};
    int64_t iter_230001;
    struct futhark_mc_segmap_parloop_struct_236273
    futhark_mc_segmap_parloop_struct_236273;
    
    futhark_mc_segmap_parloop_struct_236273.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236273.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236273.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236273.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236273.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236273.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236273.free_gtid_212434 = gtid_212434;
    futhark_mc_segmap_parloop_struct_236273.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236273.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236273.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236273.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236273.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236273.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236273.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236273.free_mem_219440 = mem_219440.mem;
    futhark_mc_segmap_parloop_struct_236273.free_mem_219443 = mem_219443.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236274_task;
    
    futhark_mc_segmap_parloop_236274_task.name =
        "futhark_mc_segmap_parloop_236274";
    futhark_mc_segmap_parloop_236274_task.fn = futhark_mc_segmap_parloop_236274;
    futhark_mc_segmap_parloop_236274_task.args =
        &futhark_mc_segmap_parloop_struct_236273;
    futhark_mc_segmap_parloop_236274_task.iterations = iterations;
    futhark_mc_segmap_parloop_236274_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236274_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236274_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236274_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236274_task);
    
    if (futhark_mc_segmap_parloop_236274_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236274_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236274_total_end -
                 futhark_mc_segmap_parloop_236274_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236274_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236274_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236274_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236272_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236272_end -
                 futhark_mc_segmap_nested_task_236272_start;
        
        ctx->futhark_mc_segmap_nested_task_236272_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236272_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236272_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236265(void *args, int64_t start,
                                            int64_t end, int flat_tid_212433,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236264
    *futhark_mc_segmap_parloop_struct_236264 =
    (struct futhark_mc_segmap_parloop_struct_236264 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236264->ctx;
    uint64_t futhark_mc_segmap_parloop_236265_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236265_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236264->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236264->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236264->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236264->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236264->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236264->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236264->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236264->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236264->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236264->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236264->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236264->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236264->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236264->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219477 = {.desc ="mem_219477", .mem =
                                  futhark_mc_segmap_parloop_struct_236264->free_mem_219477,
                                  .size =0, .references =NULL};
    struct memblock mem_219481 = {.desc ="mem_219481", .mem =
                                  futhark_mc_segmap_parloop_struct_236264->free_mem_219481,
                                  .size =0, .references =NULL};
    size_t mem_219440_cached_sizze_236266 = 0;
    unsigned char *mem_219440 = NULL;
    size_t mem_219443_cached_sizze_236267 = 0;
    unsigned char *mem_219443 = NULL;
    int64_t iterations = end - start;
    int64_t iter_229762 = start;
    
    if (mem_219440_cached_sizze_236266 < (size_t) bytes_217838) {
        mem_219440 = realloc(mem_219440, bytes_217838);
        mem_219440_cached_sizze_236266 = bytes_217838;
    }
    if (mem_219443_cached_sizze_236267 < (size_t) bytes_217838) {
        mem_219443 = realloc(mem_219443, bytes_217838);
        mem_219443_cached_sizze_236267 = bytes_217838;
    }
    for (; iter_229762 < end; iter_229762++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_229930 = partition_sizze_203667;
        int64_t gtid_212434 = iter_229762;
        int64_t remnant_229931 = iter_229762 - gtid_212434;
        int64_t flat_tid_229850 = (int64_t) 0;
        int32_t num_tasks_229932;
        int64_t flat_tid_229763 = (int64_t) 0;
        struct futhark_mc_task_236268 futhark_mc_task_236268;
        
        futhark_mc_task_236268.ctx = ctx;
        futhark_mc_task_236268.free_n_203572 = n_203572;
        futhark_mc_task_236268.free_q_l_203577 = q_l_203577;
        futhark_mc_task_236268.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236268.free_l_n_m_203733 = l_n_m_203733;
        futhark_mc_task_236268.free_i_203760 = i_203760;
        futhark_mc_task_236268.free_gtid_212434 = gtid_212434;
        futhark_mc_task_236268.free_mem_217891 = mem_217891.mem;
        futhark_mc_task_236268.free_mem_217895 = mem_217895.mem;
        futhark_mc_task_236268.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236268.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236268.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236268.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236268.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236268.free_mem_219440 = mem_219440;
        futhark_mc_task_236268.free_mem_219443 = mem_219443;
        
        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 = l_n_m_203733;
        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_236272;
        
        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) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219477.mem + gtid_212434 * l_n_m_203733 * (int64_t) 8,
                    mem_219440 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219481.mem + gtid_212434 * l_n_m_203733 * (int64_t) 8,
                    mem_219443 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219440);
    free(mem_219443);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236265_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236265_end -
                 futhark_mc_segmap_parloop_236265_start;
        
        ctx->futhark_mc_segmap_parloop_236265_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236265_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236265_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236263(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212433 = tid;
    int num_tasks_229668 = info.nsubtasks;
    struct futhark_mc_task_236257 *futhark_mc_task_236257 =
                                  (struct futhark_mc_task_236257 *) args;
    struct futhark_context *ctx = futhark_mc_task_236257->ctx;
    uint64_t futhark_mc_segmap_nested_task_236263_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236263_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236257->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236257->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236257->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236257->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236257->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236257->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236257->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236257->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236257->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236257->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236257->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236257->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236257->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236257->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219477 = {.desc ="mem_219477", .mem =
                                  futhark_mc_task_236257->free_mem_219477,
                                  .size =0, .references =NULL};
    struct memblock mem_219481 = {.desc ="mem_219481", .mem =
                                  futhark_mc_task_236257->free_mem_219481,
                                  .size =0, .references =NULL};
    int64_t iter_229762;
    struct futhark_mc_segmap_parloop_struct_236264
    futhark_mc_segmap_parloop_struct_236264;
    
    futhark_mc_segmap_parloop_struct_236264.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236264.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236264.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236264.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236264.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236264.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236264.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236264.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236264.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236264.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236264.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236264.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236264.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236264.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236264.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236264.free_mem_219477 = mem_219477.mem;
    futhark_mc_segmap_parloop_struct_236264.free_mem_219481 = mem_219481.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236265_task;
    
    futhark_mc_segmap_parloop_236265_task.name =
        "futhark_mc_segmap_parloop_236265";
    futhark_mc_segmap_parloop_236265_task.fn = futhark_mc_segmap_parloop_236265;
    futhark_mc_segmap_parloop_236265_task.args =
        &futhark_mc_segmap_parloop_struct_236264;
    futhark_mc_segmap_parloop_236265_task.iterations = iterations;
    futhark_mc_segmap_parloop_236265_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236265_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236265_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236265_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236265_task);
    
    if (futhark_mc_segmap_parloop_236265_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236265_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236265_total_end -
                 futhark_mc_segmap_parloop_236265_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236265_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236265_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236265_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236263_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236263_end -
                 futhark_mc_segmap_nested_task_236263_start;
        
        ctx->futhark_mc_segmap_nested_task_236263_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236263_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236263_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236288 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219521;
    unsigned char *free_mem_219525;
};
struct futhark_mc_segmap_parloop_struct_236290 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219521;
    unsigned char *free_mem_219525;
};
static int futhark_mc_segmap_parloop_236291(void *args, int64_t start,
                                            int64_t end, int flat_tid_212617,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236290->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236290->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236290->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236290->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236290->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236290->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236290->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236290->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236290->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236290->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236290->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219521 = {.desc ="mem_219521", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_219521,
                                  .size =0, .references =NULL};
    struct memblock mem_219525 = {.desc ="mem_219525", .mem =
                                  futhark_mc_segmap_parloop_struct_236290->free_mem_219525,
                                  .size =0, .references =NULL};
    size_t mem_219490_cached_sizze_236292 = 0;
    unsigned char *mem_219490 = NULL;
    size_t mem_219493_cached_sizze_236293 = 0;
    unsigned char *mem_219493 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230108 = start;
    
    if (mem_219490_cached_sizze_236292 < (size_t) bytes_217838) {
        mem_219490 = realloc(mem_219490, bytes_217838);
        mem_219490_cached_sizze_236292 = bytes_217838;
    }
    if (mem_219493_cached_sizze_236293 < (size_t) bytes_217838) {
        mem_219493 = realloc(mem_219493, bytes_217838);
        mem_219493_cached_sizze_236293 = bytes_217838;
    }
    for (; iter_230108 < end; iter_230108++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230222 = partition_sizze_203667;
        int64_t gtid_212618 = iter_230108;
        int64_t remnant_230223 = iter_230108 - gtid_212618;
        
        for (int64_t i_230109 = 0; i_230109 < l_n_m_203733; i_230109++) {
            int64_t x_230112;
            
            x_230112 = ((int64_t *) mem_217891.mem)[gtid_212618 * l_n_m_203733 +
                                                    i_230109];
            
            double x_230113;
            
            x_230113 = ((double *) mem_217895.mem)[gtid_212618 * l_n_m_203733 +
                                                   i_230109];
            
            int64_t min_arg_230114 = mul64(jump_t_203582, i_230109);
            int64_t min_res_230115 = smin64(i_203760, min_arg_230114);
            int64_t defunc_0_g_res_230116 = add64((int64_t) 1, min_res_230115);
            double defunc_2_reduce_res_230117;
            double defunc_2_reduce_res_230118;
            double defunc_2_reduce_res_230119;
            double defunc_2_reduce_res_230120;
            double defunc_2_reduce_res_230121;
            double redout_230123;
            double redout_230124;
            double redout_230125;
            double redout_230126;
            double redout_230127;
            
            redout_230123 = 0.0;
            redout_230124 = 0.0;
            redout_230125 = 0.0;
            redout_230126 = 0.0;
            redout_230127 = 0.0;
            for (int64_t i_230122 = 0; i_230122 < q_l_203577; i_230122++) {
                bool cond_230128 = sle64(n_203572, i_230122);
                int64_t defunc_0_f_res_230129;
                
                if (cond_230128) {
                    defunc_0_f_res_230129 = (int64_t) 0;
                } else {
                    int64_t i_230130 = add64(x_230112, i_230122);
                    int64_t defunc_1_add_res_230131 = add64((int64_t) 1,
                                                            i_230130);
                    
                    defunc_0_f_res_230129 = defunc_1_add_res_230131;
                }
                
                double defunc_0_f_res_230132;
                
                if (cond_230128) {
                    defunc_0_f_res_230132 = 0.0;
                } else {
                    int64_t i_230133 = add64(x_230112, i_230122);
                    double defunc_0_add_arg_230134;
                    
                    defunc_0_add_arg_230134 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_212618 *
                                                           ctx_param_ext_217985 +
                                                           i_230133 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_230132 = defunc_0_add_arg_230134;
                }
                
                int64_t binop_p_230135 = sub64(defunc_0_f_res_230129,
                                               defunc_0_g_res_230116);
                double defunc_0_f_res_230136 = sitofp_i64_f64(binop_p_230135);
                double abs_res_230137 = fabs(defunc_0_f_res_230136);
                double tmp1_230138 = abs_res_230137 / x_230113;
                double x_230139 = tmp1_230138 * tmp1_230138;
                double y_230140 = tmp1_230138 * x_230139;
                double tmp2_230141 = 1.0 - y_230140;
                double x_230142 = tmp2_230141 * tmp2_230141;
                double tmp3_230143 = tmp2_230141 * x_230142;
                double w_j_230144 = defunc_0_f_res_230132 * tmp3_230143;
                double xw_j_230145 = defunc_0_f_res_230136 * w_j_230144;
                double x2w_j_230146 = defunc_0_f_res_230136 * xw_j_230145;
                double x3w_j_230147 = defunc_0_f_res_230136 * x2w_j_230146;
                double x4w_j_230148 = defunc_0_f_res_230136 * x3w_j_230147;
                double defunc_1_op_res_230149 = w_j_230144 + redout_230123;
                double defunc_1_op_res_230150 = xw_j_230145 + redout_230124;
                double defunc_1_op_res_230151 = x2w_j_230146 + redout_230125;
                double defunc_1_op_res_230152 = x3w_j_230147 + redout_230126;
                double defunc_1_op_res_230153 = x4w_j_230148 + redout_230127;
                double redout_tmp_230226 = defunc_1_op_res_230149;
                double redout_tmp_230227 = defunc_1_op_res_230150;
                double redout_tmp_230228 = defunc_1_op_res_230151;
                double redout_tmp_230229 = defunc_1_op_res_230152;
                double redout_tmp_230230 = defunc_1_op_res_230153;
                
                redout_230123 = redout_tmp_230226;
                redout_230124 = redout_tmp_230227;
                redout_230125 = redout_tmp_230228;
                redout_230126 = redout_tmp_230229;
                redout_230127 = redout_tmp_230230;
            }
            defunc_2_reduce_res_230117 = redout_230123;
            defunc_2_reduce_res_230118 = redout_230124;
            defunc_2_reduce_res_230119 = redout_230125;
            defunc_2_reduce_res_230120 = redout_230126;
            defunc_2_reduce_res_230121 = redout_230127;
            
            double x_230154 = defunc_2_reduce_res_230119 *
                   defunc_2_reduce_res_230121;
            double y_230155 = defunc_2_reduce_res_230120 *
                   defunc_2_reduce_res_230120;
            double a12_230156 = x_230154 - y_230155;
            double x_230157 = defunc_2_reduce_res_230119 *
                   defunc_2_reduce_res_230120;
            double y_230158 = defunc_2_reduce_res_230118 *
                   defunc_2_reduce_res_230121;
            double b12_230159 = x_230157 - y_230158;
            double x_230160 = defunc_2_reduce_res_230118 *
                   defunc_2_reduce_res_230120;
            double y_230161 = defunc_2_reduce_res_230119 *
                   defunc_2_reduce_res_230119;
            double c12_230162 = x_230160 - y_230161;
            double x_230163 = defunc_2_reduce_res_230117 *
                   defunc_2_reduce_res_230121;
            double b2_230164 = x_230163 - y_230161;
            double x_230165 = defunc_2_reduce_res_230118 *
                   defunc_2_reduce_res_230119;
            double y_230166 = defunc_2_reduce_res_230117 *
                   defunc_2_reduce_res_230120;
            double c2_230167 = x_230165 - y_230166;
            double x_230168 = defunc_2_reduce_res_230117 * a12_230156;
            double y_230169 = defunc_2_reduce_res_230118 * b12_230159;
            double x_230170 = x_230168 + y_230169;
            double y_230171 = defunc_2_reduce_res_230119 * c12_230162;
            double y_230172 = x_230170 + y_230171;
            double det_230173 = 1.0 / y_230172;
            double a12_230174 = a12_230156 * det_230173;
            double b12_230175 = b12_230159 * det_230173;
            double c12_230176 = c12_230162 * det_230173;
            double b2_230177 = b2_230164 * det_230173;
            double c2_230178 = c2_230167 * det_230173;
            double defunc_2_reduce_res_230179;
            double defunc_2_reduce_res_230180;
            double redout_230182;
            double redout_230183;
            
            redout_230182 = 0.0;
            redout_230183 = 0.0;
            for (int64_t i_230181 = 0; i_230181 < q_l_203577; i_230181++) {
                bool cond_230184 = sle64(n_203572, i_230181);
                int64_t defunc_0_f_res_230185;
                
                if (cond_230184) {
                    defunc_0_f_res_230185 = (int64_t) 0;
                } else {
                    int64_t i_230186 = add64(x_230112, i_230181);
                    int64_t defunc_1_add_res_230187 = add64((int64_t) 1,
                                                            i_230186);
                    
                    defunc_0_f_res_230185 = defunc_1_add_res_230187;
                }
                
                double defunc_0_f_res_230188;
                
                if (cond_230184) {
                    defunc_0_f_res_230188 = 0.0;
                } else {
                    int64_t i_230189 = add64(x_230112, i_230181);
                    double defunc_0_add_arg_230190;
                    
                    defunc_0_add_arg_230190 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_212618 *
                                                           ctx_param_ext_217985 +
                                                           i_230189 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_230188 = defunc_0_add_arg_230190;
                }
                
                int64_t binop_p_230191 = sub64(defunc_0_f_res_230185,
                                               defunc_0_g_res_230116);
                double defunc_0_f_res_230192 = sitofp_i64_f64(binop_p_230191);
                double abs_res_230193 = fabs(defunc_0_f_res_230192);
                double tmp1_230194 = abs_res_230193 / x_230113;
                double x_230195 = tmp1_230194 * tmp1_230194;
                double y_230196 = tmp1_230194 * x_230195;
                double tmp2_230197 = 1.0 - y_230196;
                double x_230198 = tmp2_230197 * tmp2_230197;
                double tmp3_230199 = tmp2_230197 * x_230198;
                double tmp4_230200 = defunc_0_f_res_230188 * tmp3_230199;
                double defunc_1_f_res_230201 = defunc_0_f_res_230192 *
                       tmp4_230200;
                double defunc_1_f_res_230202 = defunc_0_f_res_230192 *
                       defunc_1_f_res_230201;
                double defunc_0_f_res_230203;
                
                if (cond_230184) {
                    defunc_0_f_res_230203 = 0.0;
                } else {
                    int64_t i_230204 = add64(x_230112, i_230181);
                    double defunc_0_add_arg_230205;
                    
                    defunc_0_add_arg_230205 =
                        ((double *) mem_219411.mem)[gtid_212618 * n_203572 +
                                                    i_230204];
                    defunc_0_f_res_230203 = defunc_0_add_arg_230205;
                }
                
                double x_230206 = a12_230174 * tmp4_230200;
                double y_230207 = b12_230175 * defunc_1_f_res_230201;
                double x_230208 = x_230206 + y_230207;
                double y_230209 = c12_230176 * defunc_1_f_res_230202;
                double x_230210 = x_230208 + y_230209;
                double defunc_9_fit_fun_res_230211 = defunc_0_f_res_230203 *
                       x_230210;
                double x_230212 = b12_230175 * tmp4_230200;
                double y_230213 = b2_230177 * defunc_1_f_res_230201;
                double x_230214 = x_230212 + y_230213;
                double y_230215 = c2_230178 * defunc_1_f_res_230202;
                double x_230216 = x_230214 + y_230215;
                double defunc_9_slope_fun_res_230217 = defunc_0_f_res_230203 *
                       x_230216;
                double defunc_1_op_res_230218 = defunc_9_fit_fun_res_230211 +
                       redout_230182;
                double defunc_1_op_res_230219 = defunc_9_slope_fun_res_230217 +
                       redout_230183;
                double redout_tmp_230231 = defunc_1_op_res_230218;
                double redout_tmp_230232 = defunc_1_op_res_230219;
                
                redout_230182 = redout_tmp_230231;
                redout_230183 = redout_tmp_230232;
            }
            defunc_2_reduce_res_230179 = redout_230182;
            defunc_2_reduce_res_230180 = redout_230183;
            ((double *) mem_219490)[i_230109] = defunc_2_reduce_res_230179;
            ((double *) mem_219493)[i_230109] = defunc_2_reduce_res_230180;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219521.mem + gtid_212618 * l_n_m_203733 * (int64_t) 8,
                    mem_219490 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219525.mem + gtid_212618 * l_n_m_203733 * (int64_t) 8,
                    mem_219493 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219490);
    free(mem_219493);
    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_task_236289(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212617 = tid;
    int num_tasks_230107 = info.nsubtasks;
    struct futhark_mc_task_236288 *futhark_mc_task_236288 =
                                  (struct futhark_mc_task_236288 *) args;
    struct futhark_context *ctx = futhark_mc_task_236288->ctx;
    uint64_t futhark_mc_segmap_task_236289_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236289_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236288->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236288->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236288->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236288->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236288->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236288->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236288->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236288->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236288->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236288->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236288->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236288->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236288->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236288->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219521 = {.desc ="mem_219521", .mem =
                                  futhark_mc_task_236288->free_mem_219521,
                                  .size =0, .references =NULL};
    struct memblock mem_219525 = {.desc ="mem_219525", .mem =
                                  futhark_mc_task_236288->free_mem_219525,
                                  .size =0, .references =NULL};
    int64_t iter_230108;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236290.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236290.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236290.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236290.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236290.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236290.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236290.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236290.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236290.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236290.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236290.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236290.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236290.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236290.free_mem_219521 = mem_219521.mem;
    futhark_mc_segmap_parloop_struct_236290.free_mem_219525 = mem_219525.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_task_236289_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236289_end -
                 futhark_mc_segmap_task_236289_start;
        
        ctx->futhark_mc_segmap_task_236289_runs[tid]++;
        ctx->futhark_mc_segmap_task_236289_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236289_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236295 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219521;
    unsigned char *free_mem_219525;
};
struct futhark_mc_task_236299 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_212752;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219484;
    unsigned char *free_mem_219487;
};
struct futhark_mc_segmap_parloop_struct_236301 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_212752;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219484;
    unsigned char *free_mem_219487;
};
static int futhark_mc_segmap_parloop_236302(void *args, int64_t start,
                                            int64_t end, int flat_tid_230353,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236301
    *futhark_mc_segmap_parloop_struct_236301 =
    (struct futhark_mc_segmap_parloop_struct_236301 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236301->ctx;
    uint64_t futhark_mc_segmap_parloop_236302_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236302_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236301->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236301->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236301->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236301->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236301->free_i_203760;
    int64_t gtid_212752 =
            futhark_mc_segmap_parloop_struct_236301->free_gtid_212752;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236301->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236301->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236301->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236301->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236301->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236301->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236301->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219484 = {.desc ="mem_219484", .mem =
                                  futhark_mc_segmap_parloop_struct_236301->free_mem_219484,
                                  .size =0, .references =NULL};
    struct memblock mem_219487 = {.desc ="mem_219487", .mem =
                                  futhark_mc_segmap_parloop_struct_236301->free_mem_219487,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230466 = start;
    
    for (; iter_230466 < end; iter_230466++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230538 = l_n_m_203733;
        int64_t gtid_230354 = iter_230466;
        int64_t remnant_230539 = iter_230466 - gtid_230354;
        int64_t x_230355;
        
        x_230355 = ((int64_t *) mem_217891.mem)[gtid_212752 * l_n_m_203733 +
                                                gtid_230354];
        
        double x_230356;
        
        x_230356 = ((double *) mem_217895.mem)[gtid_212752 * l_n_m_203733 +
                                               gtid_230354];
        
        int64_t min_arg_230357 = mul64(jump_t_203582, gtid_230354);
        int64_t min_res_230358 = smin64(i_203760, min_arg_230357);
        int64_t defunc_0_g_res_230359 = add64((int64_t) 1, min_res_230358);
        double defunc_2_reduce_res_230360;
        double defunc_2_reduce_res_230361;
        double defunc_2_reduce_res_230362;
        double defunc_2_reduce_res_230363;
        double defunc_2_reduce_res_230364;
        double redout_230468;
        double redout_230469;
        double redout_230470;
        double redout_230471;
        double redout_230472;
        
        redout_230468 = 0.0;
        redout_230469 = 0.0;
        redout_230470 = 0.0;
        redout_230471 = 0.0;
        redout_230472 = 0.0;
        for (int64_t i_230467 = 0; i_230467 < q_l_203577; i_230467++) {
            bool cond_230473 = sle64(n_203572, i_230467);
            int64_t defunc_0_f_res_230474;
            
            if (cond_230473) {
                defunc_0_f_res_230474 = (int64_t) 0;
            } else {
                int64_t i_230475 = add64(x_230355, i_230467);
                int64_t defunc_1_add_res_230476 = add64((int64_t) 1, i_230475);
                
                defunc_0_f_res_230474 = defunc_1_add_res_230476;
            }
            
            double defunc_0_f_res_230477;
            
            if (cond_230473) {
                defunc_0_f_res_230477 = 0.0;
            } else {
                int64_t i_230478 = add64(x_230355, i_230467);
                double defunc_0_add_arg_230479;
                
                defunc_0_add_arg_230479 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_212752 *
                                                       ctx_param_ext_217985 +
                                                       i_230478 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_230477 = defunc_0_add_arg_230479;
            }
            
            int64_t binop_p_230480 = sub64(defunc_0_f_res_230474,
                                           defunc_0_g_res_230359);
            double defunc_0_f_res_230481 = sitofp_i64_f64(binop_p_230480);
            double abs_res_230482 = fabs(defunc_0_f_res_230481);
            double tmp1_230483 = abs_res_230482 / x_230356;
            double x_230484 = tmp1_230483 * tmp1_230483;
            double y_230485 = tmp1_230483 * x_230484;
            double tmp2_230486 = 1.0 - y_230485;
            double x_230487 = tmp2_230486 * tmp2_230486;
            double tmp3_230488 = tmp2_230486 * x_230487;
            double w_j_230489 = defunc_0_f_res_230477 * tmp3_230488;
            double xw_j_230490 = defunc_0_f_res_230481 * w_j_230489;
            double x2w_j_230491 = defunc_0_f_res_230481 * xw_j_230490;
            double x3w_j_230492 = defunc_0_f_res_230481 * x2w_j_230491;
            double x4w_j_230493 = defunc_0_f_res_230481 * x3w_j_230492;
            double defunc_1_op_res_230494 = w_j_230489 + redout_230468;
            double defunc_1_op_res_230495 = xw_j_230490 + redout_230469;
            double defunc_1_op_res_230496 = x2w_j_230491 + redout_230470;
            double defunc_1_op_res_230497 = x3w_j_230492 + redout_230471;
            double defunc_1_op_res_230498 = x4w_j_230493 + redout_230472;
            double redout_tmp_230540 = defunc_1_op_res_230494;
            double redout_tmp_230541 = defunc_1_op_res_230495;
            double redout_tmp_230542 = defunc_1_op_res_230496;
            double redout_tmp_230543 = defunc_1_op_res_230497;
            double redout_tmp_230544 = defunc_1_op_res_230498;
            
            redout_230468 = redout_tmp_230540;
            redout_230469 = redout_tmp_230541;
            redout_230470 = redout_tmp_230542;
            redout_230471 = redout_tmp_230543;
            redout_230472 = redout_tmp_230544;
        }
        defunc_2_reduce_res_230360 = redout_230468;
        defunc_2_reduce_res_230361 = redout_230469;
        defunc_2_reduce_res_230362 = redout_230470;
        defunc_2_reduce_res_230363 = redout_230471;
        defunc_2_reduce_res_230364 = redout_230472;
        
        double x_230397 = defunc_2_reduce_res_230362 *
               defunc_2_reduce_res_230364;
        double y_230398 = defunc_2_reduce_res_230363 *
               defunc_2_reduce_res_230363;
        double a12_230399 = x_230397 - y_230398;
        double x_230400 = defunc_2_reduce_res_230362 *
               defunc_2_reduce_res_230363;
        double y_230401 = defunc_2_reduce_res_230361 *
               defunc_2_reduce_res_230364;
        double b12_230402 = x_230400 - y_230401;
        double x_230403 = defunc_2_reduce_res_230361 *
               defunc_2_reduce_res_230363;
        double y_230404 = defunc_2_reduce_res_230362 *
               defunc_2_reduce_res_230362;
        double c12_230405 = x_230403 - y_230404;
        double x_230406 = defunc_2_reduce_res_230360 *
               defunc_2_reduce_res_230364;
        double b2_230407 = x_230406 - y_230404;
        double x_230408 = defunc_2_reduce_res_230361 *
               defunc_2_reduce_res_230362;
        double y_230409 = defunc_2_reduce_res_230360 *
               defunc_2_reduce_res_230363;
        double c2_230410 = x_230408 - y_230409;
        double x_230411 = defunc_2_reduce_res_230360 * a12_230399;
        double y_230412 = defunc_2_reduce_res_230361 * b12_230402;
        double x_230413 = x_230411 + y_230412;
        double y_230414 = defunc_2_reduce_res_230362 * c12_230405;
        double y_230415 = x_230413 + y_230414;
        double det_230416 = 1.0 / y_230415;
        double a12_230417 = a12_230399 * det_230416;
        double b12_230418 = b12_230402 * det_230416;
        double c12_230419 = c12_230405 * det_230416;
        double b2_230420 = b2_230407 * det_230416;
        double c2_230421 = c2_230410 * det_230416;
        double defunc_2_reduce_res_230422;
        double defunc_2_reduce_res_230423;
        double redout_230500;
        double redout_230501;
        
        redout_230500 = 0.0;
        redout_230501 = 0.0;
        for (int64_t i_230499 = 0; i_230499 < q_l_203577; i_230499++) {
            bool cond_230502 = sle64(n_203572, i_230499);
            int64_t defunc_0_f_res_230503;
            
            if (cond_230502) {
                defunc_0_f_res_230503 = (int64_t) 0;
            } else {
                int64_t i_230504 = add64(x_230355, i_230499);
                int64_t defunc_1_add_res_230505 = add64((int64_t) 1, i_230504);
                
                defunc_0_f_res_230503 = defunc_1_add_res_230505;
            }
            
            double defunc_0_f_res_230506;
            
            if (cond_230502) {
                defunc_0_f_res_230506 = 0.0;
            } else {
                int64_t i_230507 = add64(x_230355, i_230499);
                double defunc_0_add_arg_230508;
                
                defunc_0_add_arg_230508 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_212752 *
                                                       ctx_param_ext_217985 +
                                                       i_230507 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_230506 = defunc_0_add_arg_230508;
            }
            
            int64_t binop_p_230509 = sub64(defunc_0_f_res_230503,
                                           defunc_0_g_res_230359);
            double defunc_0_f_res_230510 = sitofp_i64_f64(binop_p_230509);
            double abs_res_230511 = fabs(defunc_0_f_res_230510);
            double tmp1_230512 = abs_res_230511 / x_230356;
            double x_230513 = tmp1_230512 * tmp1_230512;
            double y_230514 = tmp1_230512 * x_230513;
            double tmp2_230515 = 1.0 - y_230514;
            double x_230516 = tmp2_230515 * tmp2_230515;
            double tmp3_230517 = tmp2_230515 * x_230516;
            double tmp4_230518 = defunc_0_f_res_230506 * tmp3_230517;
            double defunc_1_f_res_230519 = defunc_0_f_res_230510 * tmp4_230518;
            double defunc_1_f_res_230520 = defunc_0_f_res_230510 *
                   defunc_1_f_res_230519;
            double defunc_0_f_res_230521;
            
            if (cond_230502) {
                defunc_0_f_res_230521 = 0.0;
            } else {
                int64_t i_230522 = add64(x_230355, i_230499);
                double defunc_0_add_arg_230523;
                
                defunc_0_add_arg_230523 =
                    ((double *) mem_219411.mem)[gtid_212752 * n_203572 +
                                                i_230522];
                defunc_0_f_res_230521 = defunc_0_add_arg_230523;
            }
            
            double x_230524 = a12_230417 * tmp4_230518;
            double y_230525 = b12_230418 * defunc_1_f_res_230519;
            double x_230526 = x_230524 + y_230525;
            double y_230527 = c12_230419 * defunc_1_f_res_230520;
            double x_230528 = x_230526 + y_230527;
            double defunc_9_fit_fun_res_230529 = defunc_0_f_res_230521 *
                   x_230528;
            double x_230530 = b12_230418 * tmp4_230518;
            double y_230531 = b2_230420 * defunc_1_f_res_230519;
            double x_230532 = x_230530 + y_230531;
            double y_230533 = c2_230421 * defunc_1_f_res_230520;
            double x_230534 = x_230532 + y_230533;
            double defunc_9_slope_fun_res_230535 = defunc_0_f_res_230521 *
                   x_230534;
            double defunc_1_op_res_230536 = defunc_9_fit_fun_res_230529 +
                   redout_230500;
            double defunc_1_op_res_230537 = defunc_9_slope_fun_res_230535 +
                   redout_230501;
            double redout_tmp_230545 = defunc_1_op_res_230536;
            double redout_tmp_230546 = defunc_1_op_res_230537;
            
            redout_230500 = redout_tmp_230545;
            redout_230501 = redout_tmp_230546;
        }
        defunc_2_reduce_res_230422 = redout_230500;
        defunc_2_reduce_res_230423 = redout_230501;
        ((double *) mem_219484.mem)[gtid_230354] = defunc_2_reduce_res_230422;
        ((double *) mem_219487.mem)[gtid_230354] = defunc_2_reduce_res_230423;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236302_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236302_end -
                 futhark_mc_segmap_parloop_236302_start;
        
        ctx->futhark_mc_segmap_parloop_236302_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236302_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236302_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236300(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230353 = tid;
    int num_tasks_230465 = info.nsubtasks;
    struct futhark_mc_task_236299 *futhark_mc_task_236299 =
                                  (struct futhark_mc_task_236299 *) args;
    struct futhark_context *ctx = futhark_mc_task_236299->ctx;
    uint64_t futhark_mc_segmap_task_236300_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236300_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236299->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236299->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236299->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236299->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236299->free_i_203760;
    int64_t gtid_212752 = futhark_mc_task_236299->free_gtid_212752;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236299->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236299->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236299->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236299->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236299->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236299->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236299->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219484 = {.desc ="mem_219484", .mem =
                                  futhark_mc_task_236299->free_mem_219484,
                                  .size =0, .references =NULL};
    struct memblock mem_219487 = {.desc ="mem_219487", .mem =
                                  futhark_mc_task_236299->free_mem_219487,
                                  .size =0, .references =NULL};
    int64_t iter_230466;
    struct futhark_mc_segmap_parloop_struct_236301
    futhark_mc_segmap_parloop_struct_236301;
    
    futhark_mc_segmap_parloop_struct_236301.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236301.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236301.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236301.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236301.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236301.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236301.free_gtid_212752 = gtid_212752;
    futhark_mc_segmap_parloop_struct_236301.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236301.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236301.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236301.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236301.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236301.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236301.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236301.free_mem_219484 = mem_219484.mem;
    futhark_mc_segmap_parloop_struct_236301.free_mem_219487 = mem_219487.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236302_task;
    
    futhark_mc_segmap_parloop_236302_task.name =
        "futhark_mc_segmap_parloop_236302";
    futhark_mc_segmap_parloop_236302_task.fn = futhark_mc_segmap_parloop_236302;
    futhark_mc_segmap_parloop_236302_task.args =
        &futhark_mc_segmap_parloop_struct_236301;
    futhark_mc_segmap_parloop_236302_task.iterations = iterations;
    futhark_mc_segmap_parloop_236302_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236302_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236302_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236302_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236302_task);
    
    if (futhark_mc_segmap_parloop_236302_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236302_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236302_total_end -
                 futhark_mc_segmap_parloop_236302_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236302_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236302_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236302_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236300_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236300_end -
                 futhark_mc_segmap_task_236300_start;
        
        ctx->futhark_mc_segmap_task_236300_runs[tid]++;
        ctx->futhark_mc_segmap_task_236300_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236300_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236304 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_212752;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    unsigned char *free_mem_219484;
    unsigned char *free_mem_219487;
};
struct futhark_mc_task_236306 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212752;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_230236;
    double free_x_230237;
    int64_t free_defunc_0_g_res_230240;
    double *retval_defunc_2_reduce_res_230241;
    double *retval_defunc_2_reduce_res_230242;
    double *retval_defunc_2_reduce_res_230243;
    double *retval_defunc_2_reduce_res_230244;
    double *retval_defunc_2_reduce_res_230245;
};
struct futhark_mc_segred_stage_1_parloop_struct_236313 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212752;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_230236;
    double free_x_230237;
    int64_t free_defunc_0_g_res_230240;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230631;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230633;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230635;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230637;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230639;
};
static int futhark_mc_segred_stage_1_parloop_236314(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230548,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236313
    *futhark_mc_segred_stage_1_parloop_struct_236313 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236313 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236313->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236314_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236314_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236313->free_n_203572;
    int64_t gtid_212752 =
            futhark_mc_segred_stage_1_parloop_struct_236313->free_gtid_212752;
    int64_t ctx_param_ext_217984 =
            futhark_mc_segred_stage_1_parloop_struct_236313->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segred_stage_1_parloop_struct_236313->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segred_stage_1_parloop_struct_236313->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236313->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_230236 =
            futhark_mc_segred_stage_1_parloop_struct_236313->free_x_230236;
    double x_230237 =
           futhark_mc_segred_stage_1_parloop_struct_236313->free_x_230237;
    int64_t defunc_0_g_res_230240 =
            futhark_mc_segred_stage_1_parloop_struct_236313->free_defunc_0_g_res_230240;
    struct memblock reduce_stage_1_tid_res_arr_mem_230631 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230631",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236313->free_reduce_stage_1_tid_res_arr_mem_230631,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230633 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230633",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236313->free_reduce_stage_1_tid_res_arr_mem_230633,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230635 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230635",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236313->free_reduce_stage_1_tid_res_arr_mem_230635,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230637 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230637",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236313->free_reduce_stage_1_tid_res_arr_mem_230637,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230639 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230639",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236313->free_reduce_stage_1_tid_res_arr_mem_230639,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230641 = start;
    double x_230550;
    double x_230551;
    double x_230553;
    double x_230554;
    double x_230556;
    double x_230557;
    double x_230559;
    double x_230560;
    double x_230562;
    double x_230563;
    double local_acc_230642 = 0.0;
    double local_acc_230643 = 0.0;
    double local_acc_230644 = 0.0;
    double local_acc_230645 = 0.0;
    double local_acc_230646 = 0.0;
    
    for (; iter_230641 < end; iter_230641++) {
        int64_t gtid_230549 = iter_230641;
        bool cond_230565 = sle64(n_203572, gtid_230549);
        int64_t defunc_0_f_res_230566;
        
        if (cond_230565) {
            defunc_0_f_res_230566 = (int64_t) 0;
        } else {
            int64_t i_230567 = add64(x_230236, gtid_230549);
            int64_t defunc_1_add_res_230568 = add64((int64_t) 1, i_230567);
            
            defunc_0_f_res_230566 = defunc_1_add_res_230568;
        }
        
        double defunc_0_f_res_230569;
        
        if (cond_230565) {
            defunc_0_f_res_230569 = 0.0;
        } else {
            int64_t i_230570 = add64(x_230236, gtid_230549);
            double defunc_0_add_arg_230571;
            
            defunc_0_add_arg_230571 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_212752 *
                                                   ctx_param_ext_217985 +
                                                   i_230570 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_230569 = defunc_0_add_arg_230571;
        }
        
        int64_t binop_p_230572 = sub64(defunc_0_f_res_230566,
                                       defunc_0_g_res_230240);
        double defunc_0_f_res_230573 = sitofp_i64_f64(binop_p_230572);
        double abs_res_230574 = fabs(defunc_0_f_res_230573);
        double tmp1_230575 = abs_res_230574 / x_230237;
        double x_230576 = tmp1_230575 * tmp1_230575;
        double y_230577 = tmp1_230575 * x_230576;
        double tmp2_230578 = 1.0 - y_230577;
        double x_230579 = tmp2_230578 * tmp2_230578;
        double tmp3_230580 = tmp2_230578 * x_230579;
        double w_j_230581 = defunc_0_f_res_230569 * tmp3_230580;
        double xw_j_230582 = defunc_0_f_res_230573 * w_j_230581;
        double x2w_j_230583 = defunc_0_f_res_230573 * xw_j_230582;
        double x3w_j_230584 = defunc_0_f_res_230573 * x2w_j_230583;
        double x4w_j_230585 = defunc_0_f_res_230573 * x3w_j_230584;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_230550 = local_acc_230642;
        }
        // Load next params
        {
            x_230551 = w_j_230581;
        }
        // Red body
        {
            double defunc_1_op_res_230552 = x_230550 + x_230551;
            
            local_acc_230642 = defunc_1_op_res_230552;
        }
        // Load accum params
        {
            x_230553 = local_acc_230643;
        }
        // Load next params
        {
            x_230554 = xw_j_230582;
        }
        // Red body
        {
            double defunc_1_op_res_230555 = x_230553 + x_230554;
            
            local_acc_230643 = defunc_1_op_res_230555;
        }
        // Load accum params
        {
            x_230556 = local_acc_230644;
        }
        // Load next params
        {
            x_230557 = x2w_j_230583;
        }
        // Red body
        {
            double defunc_1_op_res_230558 = x_230556 + x_230557;
            
            local_acc_230644 = defunc_1_op_res_230558;
        }
        // Load accum params
        {
            x_230559 = local_acc_230645;
        }
        // Load next params
        {
            x_230560 = x3w_j_230584;
        }
        // Red body
        {
            double defunc_1_op_res_230561 = x_230559 + x_230560;
            
            local_acc_230645 = defunc_1_op_res_230561;
        }
        // Load accum params
        {
            x_230562 = local_acc_230646;
        }
        // Load next params
        {
            x_230563 = x4w_j_230585;
        }
        // Red body
        {
            double defunc_1_op_res_230564 = x_230562 + x_230563;
            
            local_acc_230646 = defunc_1_op_res_230564;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230631.mem)[flat_tid_230548] =
        local_acc_230642;
    ((double *) reduce_stage_1_tid_res_arr_mem_230633.mem)[flat_tid_230548] =
        local_acc_230643;
    ((double *) reduce_stage_1_tid_res_arr_mem_230635.mem)[flat_tid_230548] =
        local_acc_230644;
    ((double *) reduce_stage_1_tid_res_arr_mem_230637.mem)[flat_tid_230548] =
        local_acc_230645;
    ((double *) reduce_stage_1_tid_res_arr_mem_230639.mem)[flat_tid_230548] =
        local_acc_230646;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236314_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236314_end -
                 futhark_mc_segred_stage_1_parloop_236314_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236314_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236314_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236314_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236307(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230548 = tid;
    int num_tasks_230630 = info.nsubtasks;
    struct futhark_mc_task_236306 *futhark_mc_task_236306 =
                                  (struct futhark_mc_task_236306 *) args;
    struct futhark_context *ctx = futhark_mc_task_236306->ctx;
    uint64_t futhark_mc_segred_task_236307_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236307_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236306->free_n_203572;
    int64_t gtid_212752 = futhark_mc_task_236306->free_gtid_212752;
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236306->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236306->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236306->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236306->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_230236 = futhark_mc_task_236306->free_x_230236;
    double x_230237 = futhark_mc_task_236306->free_x_230237;
    int64_t defunc_0_g_res_230240 =
            futhark_mc_task_236306->free_defunc_0_g_res_230240;
    double defunc_2_reduce_res_230241 =
           *futhark_mc_task_236306->retval_defunc_2_reduce_res_230241;
    double defunc_2_reduce_res_230242 =
           *futhark_mc_task_236306->retval_defunc_2_reduce_res_230242;
    double defunc_2_reduce_res_230243 =
           *futhark_mc_task_236306->retval_defunc_2_reduce_res_230243;
    double defunc_2_reduce_res_230244 =
           *futhark_mc_task_236306->retval_defunc_2_reduce_res_230244;
    double defunc_2_reduce_res_230245 =
           *futhark_mc_task_236306->retval_defunc_2_reduce_res_230245;
    size_t reduce_stage_1_tid_res_arr_mem_230631_cached_sizze_236308 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230631 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230633_cached_sizze_236309 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230633 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230635_cached_sizze_236310 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230635 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230637_cached_sizze_236311 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230637 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230639_cached_sizze_236312 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230639 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230631_cached_sizze_236308 <
        (size_t) ((int64_t) 8 * num_tasks_230630)) {
        reduce_stage_1_tid_res_arr_mem_230631 =
            realloc(reduce_stage_1_tid_res_arr_mem_230631, (int64_t) 8 *
                    num_tasks_230630);
        reduce_stage_1_tid_res_arr_mem_230631_cached_sizze_236308 =
            (int64_t) 8 * num_tasks_230630;
    }
    if (reduce_stage_1_tid_res_arr_mem_230633_cached_sizze_236309 <
        (size_t) ((int64_t) 8 * num_tasks_230630)) {
        reduce_stage_1_tid_res_arr_mem_230633 =
            realloc(reduce_stage_1_tid_res_arr_mem_230633, (int64_t) 8 *
                    num_tasks_230630);
        reduce_stage_1_tid_res_arr_mem_230633_cached_sizze_236309 =
            (int64_t) 8 * num_tasks_230630;
    }
    if (reduce_stage_1_tid_res_arr_mem_230635_cached_sizze_236310 <
        (size_t) ((int64_t) 8 * num_tasks_230630)) {
        reduce_stage_1_tid_res_arr_mem_230635 =
            realloc(reduce_stage_1_tid_res_arr_mem_230635, (int64_t) 8 *
                    num_tasks_230630);
        reduce_stage_1_tid_res_arr_mem_230635_cached_sizze_236310 =
            (int64_t) 8 * num_tasks_230630;
    }
    if (reduce_stage_1_tid_res_arr_mem_230637_cached_sizze_236311 <
        (size_t) ((int64_t) 8 * num_tasks_230630)) {
        reduce_stage_1_tid_res_arr_mem_230637 =
            realloc(reduce_stage_1_tid_res_arr_mem_230637, (int64_t) 8 *
                    num_tasks_230630);
        reduce_stage_1_tid_res_arr_mem_230637_cached_sizze_236311 =
            (int64_t) 8 * num_tasks_230630;
    }
    if (reduce_stage_1_tid_res_arr_mem_230639_cached_sizze_236312 <
        (size_t) ((int64_t) 8 * num_tasks_230630)) {
        reduce_stage_1_tid_res_arr_mem_230639 =
            realloc(reduce_stage_1_tid_res_arr_mem_230639, (int64_t) 8 *
                    num_tasks_230630);
        reduce_stage_1_tid_res_arr_mem_230639_cached_sizze_236312 =
            (int64_t) 8 * num_tasks_230630;
    }
    
    int64_t iter_230641;
    struct futhark_mc_segred_stage_1_parloop_struct_236313
    futhark_mc_segred_stage_1_parloop_struct_236313;
    
    futhark_mc_segred_stage_1_parloop_struct_236313.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_gtid_212752 =
        gtid_212752;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_x_230236 = x_230236;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_x_230237 = x_230237;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_defunc_0_g_res_230240 =
        defunc_0_g_res_230240;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_reduce_stage_1_tid_res_arr_mem_230631 =
        reduce_stage_1_tid_res_arr_mem_230631;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_reduce_stage_1_tid_res_arr_mem_230633 =
        reduce_stage_1_tid_res_arr_mem_230633;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_reduce_stage_1_tid_res_arr_mem_230635 =
        reduce_stage_1_tid_res_arr_mem_230635;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_reduce_stage_1_tid_res_arr_mem_230637 =
        reduce_stage_1_tid_res_arr_mem_230637;
    futhark_mc_segred_stage_1_parloop_struct_236313.free_reduce_stage_1_tid_res_arr_mem_230639 =
        reduce_stage_1_tid_res_arr_mem_230639;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236314_task;
    
    futhark_mc_segred_stage_1_parloop_236314_task.name =
        "futhark_mc_segred_stage_1_parloop_236314";
    futhark_mc_segred_stage_1_parloop_236314_task.fn =
        futhark_mc_segred_stage_1_parloop_236314;
    futhark_mc_segred_stage_1_parloop_236314_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236313;
    futhark_mc_segred_stage_1_parloop_236314_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236314_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236314_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236314_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236314_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236314_task);
    
    if (futhark_mc_segred_stage_1_parloop_236314_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236314_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236314_total_end -
                 futhark_mc_segred_stage_1_parloop_236314_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236314_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236314_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236314_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_230241 = 0.0;
        defunc_2_reduce_res_230242 = 0.0;
        defunc_2_reduce_res_230243 = 0.0;
        defunc_2_reduce_res_230244 = 0.0;
        defunc_2_reduce_res_230245 = 0.0;
    }
    
    double x_230647;
    double x_230648;
    double x_230650;
    double x_230651;
    double x_230653;
    double x_230654;
    double x_230656;
    double x_230657;
    double x_230659;
    double x_230660;
    
    for (int32_t i_230662 = 0; i_230662 < num_tasks_230630; i_230662++) {
        flat_tid_230548 = i_230662;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230647 = defunc_2_reduce_res_230241;
            }
            // load next params
            {
                x_230648 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230631)[flat_tid_230548];
            }
            // red body
            {
                double defunc_1_op_res_230649 = x_230647 + x_230648;
                
                defunc_2_reduce_res_230241 = defunc_1_op_res_230649;
            }
            // load acc params
            {
                x_230650 = defunc_2_reduce_res_230242;
            }
            // load next params
            {
                x_230651 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230633)[flat_tid_230548];
            }
            // red body
            {
                double defunc_1_op_res_230652 = x_230650 + x_230651;
                
                defunc_2_reduce_res_230242 = defunc_1_op_res_230652;
            }
            // load acc params
            {
                x_230653 = defunc_2_reduce_res_230243;
            }
            // load next params
            {
                x_230654 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230635)[flat_tid_230548];
            }
            // red body
            {
                double defunc_1_op_res_230655 = x_230653 + x_230654;
                
                defunc_2_reduce_res_230243 = defunc_1_op_res_230655;
            }
            // load acc params
            {
                x_230656 = defunc_2_reduce_res_230244;
            }
            // load next params
            {
                x_230657 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230637)[flat_tid_230548];
            }
            // red body
            {
                double defunc_1_op_res_230658 = x_230656 + x_230657;
                
                defunc_2_reduce_res_230244 = defunc_1_op_res_230658;
            }
            // load acc params
            {
                x_230659 = defunc_2_reduce_res_230245;
            }
            // load next params
            {
                x_230660 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230639)[flat_tid_230548];
            }
            // red body
            {
                double defunc_1_op_res_230661 = x_230659 + x_230660;
                
                defunc_2_reduce_res_230245 = defunc_1_op_res_230661;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230631);
        free(reduce_stage_1_tid_res_arr_mem_230633);
        free(reduce_stage_1_tid_res_arr_mem_230635);
        free(reduce_stage_1_tid_res_arr_mem_230637);
        free(reduce_stage_1_tid_res_arr_mem_230639);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236307_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236307_end -
                 futhark_mc_segred_task_236307_start;
        
        ctx->futhark_mc_segred_task_236307_runs[tid]++;
        ctx->futhark_mc_segred_task_236307_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236307_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236306->retval_defunc_2_reduce_res_230241 =
            defunc_2_reduce_res_230241;
        *futhark_mc_task_236306->retval_defunc_2_reduce_res_230242 =
            defunc_2_reduce_res_230242;
        *futhark_mc_task_236306->retval_defunc_2_reduce_res_230243 =
            defunc_2_reduce_res_230243;
        *futhark_mc_task_236306->retval_defunc_2_reduce_res_230244 =
            defunc_2_reduce_res_230244;
        *futhark_mc_task_236306->retval_defunc_2_reduce_res_230245 =
            defunc_2_reduce_res_230245;
    }
    return err;
}
struct futhark_mc_task_236315 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212752;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_x_230236;
    double free_x_230237;
    int64_t free_defunc_0_g_res_230240;
    double free_a12_230304;
    double free_b12_230305;
    double free_c12_230306;
    double free_b2_230307;
    double free_c2_230308;
    double *retval_defunc_2_reduce_res_230309;
    double *retval_defunc_2_reduce_res_230310;
};
struct futhark_mc_segred_stage_1_parloop_struct_236319 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_212752;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_x_230236;
    double free_x_230237;
    int64_t free_defunc_0_g_res_230240;
    double free_a12_230304;
    double free_b12_230305;
    double free_c12_230306;
    double free_b2_230307;
    double free_c2_230308;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230664;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230666;
};
static int futhark_mc_segred_stage_1_parloop_236320(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230586,
                                                    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_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_n_203572;
    int64_t gtid_212752 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_gtid_212752;
    int64_t ctx_param_ext_217984 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236319->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236319->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_230236 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_x_230236;
    double x_230237 =
           futhark_mc_segred_stage_1_parloop_struct_236319->free_x_230237;
    int64_t defunc_0_g_res_230240 =
            futhark_mc_segred_stage_1_parloop_struct_236319->free_defunc_0_g_res_230240;
    double a12_230304 =
           futhark_mc_segred_stage_1_parloop_struct_236319->free_a12_230304;
    double b12_230305 =
           futhark_mc_segred_stage_1_parloop_struct_236319->free_b12_230305;
    double c12_230306 =
           futhark_mc_segred_stage_1_parloop_struct_236319->free_c12_230306;
    double b2_230307 =
           futhark_mc_segred_stage_1_parloop_struct_236319->free_b2_230307;
    double c2_230308 =
           futhark_mc_segred_stage_1_parloop_struct_236319->free_c2_230308;
    struct memblock reduce_stage_1_tid_res_arr_mem_230664 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230664",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236319->free_reduce_stage_1_tid_res_arr_mem_230664,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230666 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230666",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236319->free_reduce_stage_1_tid_res_arr_mem_230666,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230668 = start;
    double x_230588;
    double x_230589;
    double x_230591;
    double x_230592;
    double local_acc_230669 = 0.0;
    double local_acc_230670 = 0.0;
    
    for (; iter_230668 < end; iter_230668++) {
        int64_t gtid_230587 = iter_230668;
        bool cond_230594 = sle64(n_203572, gtid_230587);
        int64_t defunc_0_f_res_230595;
        
        if (cond_230594) {
            defunc_0_f_res_230595 = (int64_t) 0;
        } else {
            int64_t i_230596 = add64(x_230236, gtid_230587);
            int64_t defunc_1_add_res_230597 = add64((int64_t) 1, i_230596);
            
            defunc_0_f_res_230595 = defunc_1_add_res_230597;
        }
        
        double defunc_0_f_res_230598;
        
        if (cond_230594) {
            defunc_0_f_res_230598 = 0.0;
        } else {
            int64_t i_230599 = add64(x_230236, gtid_230587);
            double defunc_0_add_arg_230600;
            
            defunc_0_add_arg_230600 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_212752 *
                                                   ctx_param_ext_217985 +
                                                   i_230599 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_230598 = defunc_0_add_arg_230600;
        }
        
        int64_t binop_p_230601 = sub64(defunc_0_f_res_230595,
                                       defunc_0_g_res_230240);
        double defunc_0_f_res_230602 = sitofp_i64_f64(binop_p_230601);
        double abs_res_230603 = fabs(defunc_0_f_res_230602);
        double tmp1_230604 = abs_res_230603 / x_230237;
        double x_230605 = tmp1_230604 * tmp1_230604;
        double y_230606 = tmp1_230604 * x_230605;
        double tmp2_230607 = 1.0 - y_230606;
        double x_230608 = tmp2_230607 * tmp2_230607;
        double tmp3_230609 = tmp2_230607 * x_230608;
        double tmp4_230610 = defunc_0_f_res_230598 * tmp3_230609;
        double defunc_1_f_res_230611 = defunc_0_f_res_230602 * tmp4_230610;
        double defunc_1_f_res_230612 = defunc_0_f_res_230602 *
               defunc_1_f_res_230611;
        double defunc_0_f_res_230613;
        
        if (cond_230594) {
            defunc_0_f_res_230613 = 0.0;
        } else {
            int64_t i_230614 = add64(x_230236, gtid_230587);
            double defunc_0_add_arg_230615;
            
            defunc_0_add_arg_230615 = ((double *) mem_219411.mem)[gtid_212752 *
                                                                  n_203572 +
                                                                  i_230614];
            defunc_0_f_res_230613 = defunc_0_add_arg_230615;
        }
        
        double x_230616 = a12_230304 * tmp4_230610;
        double y_230617 = b12_230305 * defunc_1_f_res_230611;
        double x_230618 = x_230616 + y_230617;
        double y_230619 = c12_230306 * defunc_1_f_res_230612;
        double x_230620 = x_230618 + y_230619;
        double defunc_9_fit_fun_res_230621 = defunc_0_f_res_230613 * x_230620;
        double x_230622 = b12_230305 * tmp4_230610;
        double y_230623 = b2_230307 * defunc_1_f_res_230611;
        double x_230624 = x_230622 + y_230623;
        double y_230625 = c2_230308 * defunc_1_f_res_230612;
        double x_230626 = x_230624 + y_230625;
        double defunc_9_slope_fun_res_230627 = defunc_0_f_res_230613 * x_230626;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_230588 = local_acc_230669;
        }
        // Load next params
        {
            x_230589 = defunc_9_fit_fun_res_230621;
        }
        // Red body
        {
            double defunc_1_op_res_230590 = x_230588 + x_230589;
            
            local_acc_230669 = defunc_1_op_res_230590;
        }
        // Load accum params
        {
            x_230591 = local_acc_230670;
        }
        // Load next params
        {
            x_230592 = defunc_9_slope_fun_res_230627;
        }
        // Red body
        {
            double defunc_1_op_res_230593 = x_230591 + x_230592;
            
            local_acc_230670 = defunc_1_op_res_230593;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230664.mem)[flat_tid_230586] =
        local_acc_230669;
    ((double *) reduce_stage_1_tid_res_arr_mem_230666.mem)[flat_tid_230586] =
        local_acc_230670;
    
  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_236316(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230586 = tid;
    int num_tasks_230663 = info.nsubtasks;
    struct futhark_mc_task_236315 *futhark_mc_task_236315 =
                                  (struct futhark_mc_task_236315 *) args;
    struct futhark_context *ctx = futhark_mc_task_236315->ctx;
    uint64_t futhark_mc_segred_task_236316_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236316_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236315->free_n_203572;
    int64_t gtid_212752 = futhark_mc_task_236315->free_gtid_212752;
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236315->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236315->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236315->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236315->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236315->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_230236 = futhark_mc_task_236315->free_x_230236;
    double x_230237 = futhark_mc_task_236315->free_x_230237;
    int64_t defunc_0_g_res_230240 =
            futhark_mc_task_236315->free_defunc_0_g_res_230240;
    double a12_230304 = futhark_mc_task_236315->free_a12_230304;
    double b12_230305 = futhark_mc_task_236315->free_b12_230305;
    double c12_230306 = futhark_mc_task_236315->free_c12_230306;
    double b2_230307 = futhark_mc_task_236315->free_b2_230307;
    double c2_230308 = futhark_mc_task_236315->free_c2_230308;
    double defunc_2_reduce_res_230309 =
           *futhark_mc_task_236315->retval_defunc_2_reduce_res_230309;
    double defunc_2_reduce_res_230310 =
           *futhark_mc_task_236315->retval_defunc_2_reduce_res_230310;
    size_t reduce_stage_1_tid_res_arr_mem_230664_cached_sizze_236317 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230664 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_230666_cached_sizze_236318 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230666 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230664_cached_sizze_236317 <
        (size_t) ((int64_t) 8 * num_tasks_230663)) {
        reduce_stage_1_tid_res_arr_mem_230664 =
            realloc(reduce_stage_1_tid_res_arr_mem_230664, (int64_t) 8 *
                    num_tasks_230663);
        reduce_stage_1_tid_res_arr_mem_230664_cached_sizze_236317 =
            (int64_t) 8 * num_tasks_230663;
    }
    if (reduce_stage_1_tid_res_arr_mem_230666_cached_sizze_236318 <
        (size_t) ((int64_t) 8 * num_tasks_230663)) {
        reduce_stage_1_tid_res_arr_mem_230666 =
            realloc(reduce_stage_1_tid_res_arr_mem_230666, (int64_t) 8 *
                    num_tasks_230663);
        reduce_stage_1_tid_res_arr_mem_230666_cached_sizze_236318 =
            (int64_t) 8 * num_tasks_230663;
    }
    
    int64_t iter_230668;
    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_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_gtid_212752 =
        gtid_212752;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_mem_219411 =
        mem_219411.mem;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_x_230236 = x_230236;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_x_230237 = x_230237;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_defunc_0_g_res_230240 =
        defunc_0_g_res_230240;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_a12_230304 =
        a12_230304;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_b12_230305 =
        b12_230305;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_c12_230306 =
        c12_230306;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_b2_230307 = b2_230307;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_c2_230308 = c2_230308;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_reduce_stage_1_tid_res_arr_mem_230664 =
        reduce_stage_1_tid_res_arr_mem_230664;
    futhark_mc_segred_stage_1_parloop_struct_236319.free_reduce_stage_1_tid_res_arr_mem_230666 =
        reduce_stage_1_tid_res_arr_mem_230666;
    
    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_230309 = 0.0;
        defunc_2_reduce_res_230310 = 0.0;
    }
    
    double x_230671;
    double x_230672;
    double x_230674;
    double x_230675;
    
    for (int32_t i_230677 = 0; i_230677 < num_tasks_230663; i_230677++) {
        flat_tid_230586 = i_230677;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230671 = defunc_2_reduce_res_230309;
            }
            // load next params
            {
                x_230672 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230664)[flat_tid_230586];
            }
            // red body
            {
                double defunc_1_op_res_230673 = x_230671 + x_230672;
                
                defunc_2_reduce_res_230309 = defunc_1_op_res_230673;
            }
            // load acc params
            {
                x_230674 = defunc_2_reduce_res_230310;
            }
            // load next params
            {
                x_230675 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230666)[flat_tid_230586];
            }
            // red body
            {
                double defunc_1_op_res_230676 = x_230674 + x_230675;
                
                defunc_2_reduce_res_230310 = defunc_1_op_res_230676;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230664);
        free(reduce_stage_1_tid_res_arr_mem_230666);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236316_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236316_end -
                 futhark_mc_segred_task_236316_start;
        
        ctx->futhark_mc_segred_task_236316_runs[tid]++;
        ctx->futhark_mc_segred_task_236316_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236316_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236315->retval_defunc_2_reduce_res_230309 =
            defunc_2_reduce_res_230309;
        *futhark_mc_task_236315->retval_defunc_2_reduce_res_230310 =
            defunc_2_reduce_res_230310;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236305(void *args, int64_t start,
                                            int64_t end, int flat_tid_230234,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236304
    *futhark_mc_segmap_parloop_struct_236304 =
    (struct futhark_mc_segmap_parloop_struct_236304 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236304->ctx;
    uint64_t futhark_mc_segmap_parloop_236305_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236305_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236304->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236304->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236304->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236304->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236304->free_i_203760;
    int64_t gtid_212752 =
            futhark_mc_segmap_parloop_struct_236304->free_gtid_212752;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236304->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236304->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236304->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236304->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236304->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236304->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236304->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219484 = {.desc ="mem_219484", .mem =
                                  futhark_mc_segmap_parloop_struct_236304->free_mem_219484,
                                  .size =0, .references =NULL};
    struct memblock mem_219487 = {.desc ="mem_219487", .mem =
                                  futhark_mc_segmap_parloop_struct_236304->free_mem_219487,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230547 = start;
    
    for (; iter_230547 < end; iter_230547++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230628 = l_n_m_203733;
        int64_t gtid_230235 = iter_230547;
        int64_t remnant_230629 = iter_230547 - gtid_230235;
        int64_t x_230236;
        
        x_230236 = ((int64_t *) mem_217891.mem)[gtid_212752 * l_n_m_203733 +
                                                gtid_230235];
        
        double x_230237;
        
        x_230237 = ((double *) mem_217895.mem)[gtid_212752 * l_n_m_203733 +
                                               gtid_230235];
        
        int64_t min_arg_230238 = mul64(jump_t_203582, gtid_230235);
        int64_t min_res_230239 = smin64(i_203760, min_arg_230238);
        int64_t defunc_0_g_res_230240 = add64((int64_t) 1, min_res_230239);
        double defunc_2_reduce_res_230241;
        double defunc_2_reduce_res_230242;
        double defunc_2_reduce_res_230243;
        double defunc_2_reduce_res_230244;
        double defunc_2_reduce_res_230245;
        int64_t flat_tid_230548 = (int64_t) 0;
        int32_t num_tasks_230630;
        
        defunc_2_reduce_res_230241 = 0.0;
        defunc_2_reduce_res_230242 = 0.0;
        defunc_2_reduce_res_230243 = 0.0;
        defunc_2_reduce_res_230244 = 0.0;
        defunc_2_reduce_res_230245 = 0.0;
        
        struct futhark_mc_task_236306 futhark_mc_task_236306;
        
        futhark_mc_task_236306.ctx = ctx;
        futhark_mc_task_236306.free_n_203572 = n_203572;
        futhark_mc_task_236306.free_gtid_212752 = gtid_212752;
        futhark_mc_task_236306.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236306.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236306.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236306.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236306.free_x_230236 = x_230236;
        futhark_mc_task_236306.free_x_230237 = x_230237;
        futhark_mc_task_236306.free_defunc_0_g_res_230240 =
            defunc_0_g_res_230240;
        futhark_mc_task_236306.retval_defunc_2_reduce_res_230241 =
            &defunc_2_reduce_res_230241;
        futhark_mc_task_236306.retval_defunc_2_reduce_res_230242 =
            &defunc_2_reduce_res_230242;
        futhark_mc_task_236306.retval_defunc_2_reduce_res_230243 =
            &defunc_2_reduce_res_230243;
        futhark_mc_task_236306.retval_defunc_2_reduce_res_230244 =
            &defunc_2_reduce_res_230244;
        futhark_mc_task_236306.retval_defunc_2_reduce_res_230245 =
            &defunc_2_reduce_res_230245;
        
        struct scheduler_segop futhark_mc_task_236306_task;
        
        futhark_mc_task_236306_task.args = &futhark_mc_task_236306;
        futhark_mc_task_236306_task.top_level_fn =
            futhark_mc_segred_task_236307;
        futhark_mc_task_236306_task.name = "futhark_mc_segred_task_236307";
        futhark_mc_task_236306_task.iterations = q_l_203577;
        futhark_mc_task_236306_task.task_time =
            &ctx->futhark_mc_segred_task_236307_total_time;
        futhark_mc_task_236306_task.task_iter =
            &ctx->futhark_mc_segred_task_236307_total_iter;
        futhark_mc_task_236306_task.sched = STATIC;
        futhark_mc_task_236306_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236307_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236306_task);
        
        if (futhark_mc_segred_task_236307_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_230284 = defunc_2_reduce_res_230243 *
               defunc_2_reduce_res_230245;
        double y_230285 = defunc_2_reduce_res_230244 *
               defunc_2_reduce_res_230244;
        double a12_230286 = x_230284 - y_230285;
        double x_230287 = defunc_2_reduce_res_230243 *
               defunc_2_reduce_res_230244;
        double y_230288 = defunc_2_reduce_res_230242 *
               defunc_2_reduce_res_230245;
        double b12_230289 = x_230287 - y_230288;
        double x_230290 = defunc_2_reduce_res_230242 *
               defunc_2_reduce_res_230244;
        double y_230291 = defunc_2_reduce_res_230243 *
               defunc_2_reduce_res_230243;
        double c12_230292 = x_230290 - y_230291;
        double x_230293 = defunc_2_reduce_res_230241 *
               defunc_2_reduce_res_230245;
        double b2_230294 = x_230293 - y_230291;
        double x_230295 = defunc_2_reduce_res_230242 *
               defunc_2_reduce_res_230243;
        double y_230296 = defunc_2_reduce_res_230241 *
               defunc_2_reduce_res_230244;
        double c2_230297 = x_230295 - y_230296;
        double x_230298 = defunc_2_reduce_res_230241 * a12_230286;
        double y_230299 = defunc_2_reduce_res_230242 * b12_230289;
        double x_230300 = x_230298 + y_230299;
        double y_230301 = defunc_2_reduce_res_230243 * c12_230292;
        double y_230302 = x_230300 + y_230301;
        double det_230303 = 1.0 / y_230302;
        double a12_230304 = a12_230286 * det_230303;
        double b12_230305 = b12_230289 * det_230303;
        double c12_230306 = c12_230292 * det_230303;
        double b2_230307 = b2_230294 * det_230303;
        double c2_230308 = c2_230297 * det_230303;
        double defunc_2_reduce_res_230309;
        double defunc_2_reduce_res_230310;
        int64_t flat_tid_230586 = (int64_t) 0;
        int32_t num_tasks_230663;
        
        defunc_2_reduce_res_230309 = 0.0;
        defunc_2_reduce_res_230310 = 0.0;
        
        struct futhark_mc_task_236315 futhark_mc_task_236315;
        
        futhark_mc_task_236315.ctx = ctx;
        futhark_mc_task_236315.free_n_203572 = n_203572;
        futhark_mc_task_236315.free_gtid_212752 = gtid_212752;
        futhark_mc_task_236315.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236315.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236315.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236315.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236315.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236315.free_x_230236 = x_230236;
        futhark_mc_task_236315.free_x_230237 = x_230237;
        futhark_mc_task_236315.free_defunc_0_g_res_230240 =
            defunc_0_g_res_230240;
        futhark_mc_task_236315.free_a12_230304 = a12_230304;
        futhark_mc_task_236315.free_b12_230305 = b12_230305;
        futhark_mc_task_236315.free_c12_230306 = c12_230306;
        futhark_mc_task_236315.free_b2_230307 = b2_230307;
        futhark_mc_task_236315.free_c2_230308 = c2_230308;
        futhark_mc_task_236315.retval_defunc_2_reduce_res_230309 =
            &defunc_2_reduce_res_230309;
        futhark_mc_task_236315.retval_defunc_2_reduce_res_230310 =
            &defunc_2_reduce_res_230310;
        
        struct scheduler_segop futhark_mc_task_236315_task;
        
        futhark_mc_task_236315_task.args = &futhark_mc_task_236315;
        futhark_mc_task_236315_task.top_level_fn =
            futhark_mc_segred_task_236316;
        futhark_mc_task_236315_task.name = "futhark_mc_segred_task_236316";
        futhark_mc_task_236315_task.iterations = q_l_203577;
        futhark_mc_task_236315_task.task_time =
            &ctx->futhark_mc_segred_task_236316_total_time;
        futhark_mc_task_236315_task.task_iter =
            &ctx->futhark_mc_segred_task_236316_total_iter;
        futhark_mc_task_236315_task.sched = STATIC;
        futhark_mc_task_236315_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236316_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236315_task);
        
        if (futhark_mc_segred_task_236316_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219484.mem)[gtid_230235] = defunc_2_reduce_res_230309;
        ((double *) mem_219487.mem)[gtid_230235] = defunc_2_reduce_res_230310;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236305_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236305_end -
                 futhark_mc_segmap_parloop_236305_start;
        
        ctx->futhark_mc_segmap_parloop_236305_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236305_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236305_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236303(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230234 = tid;
    int num_tasks_230465 = info.nsubtasks;
    struct futhark_mc_task_236299 *futhark_mc_task_236299 =
                                  (struct futhark_mc_task_236299 *) args;
    struct futhark_context *ctx = futhark_mc_task_236299->ctx;
    uint64_t futhark_mc_segmap_nested_task_236303_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236303_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236299->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236299->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236299->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236299->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236299->free_i_203760;
    int64_t gtid_212752 = futhark_mc_task_236299->free_gtid_212752;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236299->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236299->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236299->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236299->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236299->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236299->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236299->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219484 = {.desc ="mem_219484", .mem =
                                  futhark_mc_task_236299->free_mem_219484,
                                  .size =0, .references =NULL};
    struct memblock mem_219487 = {.desc ="mem_219487", .mem =
                                  futhark_mc_task_236299->free_mem_219487,
                                  .size =0, .references =NULL};
    int64_t iter_230547;
    struct futhark_mc_segmap_parloop_struct_236304
    futhark_mc_segmap_parloop_struct_236304;
    
    futhark_mc_segmap_parloop_struct_236304.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236304.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236304.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236304.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236304.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236304.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236304.free_gtid_212752 = gtid_212752;
    futhark_mc_segmap_parloop_struct_236304.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236304.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236304.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236304.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236304.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236304.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236304.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236304.free_mem_219484 = mem_219484.mem;
    futhark_mc_segmap_parloop_struct_236304.free_mem_219487 = mem_219487.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236305_task;
    
    futhark_mc_segmap_parloop_236305_task.name =
        "futhark_mc_segmap_parloop_236305";
    futhark_mc_segmap_parloop_236305_task.fn = futhark_mc_segmap_parloop_236305;
    futhark_mc_segmap_parloop_236305_task.args =
        &futhark_mc_segmap_parloop_struct_236304;
    futhark_mc_segmap_parloop_236305_task.iterations = iterations;
    futhark_mc_segmap_parloop_236305_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236305_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236305_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236305_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236305_task);
    
    if (futhark_mc_segmap_parloop_236305_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236305_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236305_total_end -
                 futhark_mc_segmap_parloop_236305_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236305_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236305_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236305_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236303_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236303_end -
                 futhark_mc_segmap_nested_task_236303_start;
        
        ctx->futhark_mc_segmap_nested_task_236303_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236303_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236303_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236296(void *args, int64_t start,
                                            int64_t end, int flat_tid_212751,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236295
    *futhark_mc_segmap_parloop_struct_236295 =
    (struct futhark_mc_segmap_parloop_struct_236295 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236295->ctx;
    uint64_t futhark_mc_segmap_parloop_236296_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236296_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236295->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236295->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236295->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236295->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236295->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236295->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236295->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236295->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236295->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236295->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236295->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236295->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236295->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236295->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219521 = {.desc ="mem_219521", .mem =
                                  futhark_mc_segmap_parloop_struct_236295->free_mem_219521,
                                  .size =0, .references =NULL};
    struct memblock mem_219525 = {.desc ="mem_219525", .mem =
                                  futhark_mc_segmap_parloop_struct_236295->free_mem_219525,
                                  .size =0, .references =NULL};
    size_t mem_219484_cached_sizze_236297 = 0;
    unsigned char *mem_219484 = NULL;
    size_t mem_219487_cached_sizze_236298 = 0;
    unsigned char *mem_219487 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230233 = start;
    
    if (mem_219484_cached_sizze_236297 < (size_t) bytes_217838) {
        mem_219484 = realloc(mem_219484, bytes_217838);
        mem_219484_cached_sizze_236297 = bytes_217838;
    }
    if (mem_219487_cached_sizze_236298 < (size_t) bytes_217838) {
        mem_219487 = realloc(mem_219487, bytes_217838);
        mem_219487_cached_sizze_236298 = bytes_217838;
    }
    for (; iter_230233 < end; iter_230233++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230463 = partition_sizze_203667;
        int64_t gtid_212752 = iter_230233;
        int64_t remnant_230464 = iter_230233 - gtid_212752;
        int64_t flat_tid_230353 = (int64_t) 0;
        int32_t num_tasks_230465;
        int64_t flat_tid_230234 = (int64_t) 0;
        struct futhark_mc_task_236299 futhark_mc_task_236299;
        
        futhark_mc_task_236299.ctx = ctx;
        futhark_mc_task_236299.free_n_203572 = n_203572;
        futhark_mc_task_236299.free_q_l_203577 = q_l_203577;
        futhark_mc_task_236299.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236299.free_l_n_m_203733 = l_n_m_203733;
        futhark_mc_task_236299.free_i_203760 = i_203760;
        futhark_mc_task_236299.free_gtid_212752 = gtid_212752;
        futhark_mc_task_236299.free_mem_217891 = mem_217891.mem;
        futhark_mc_task_236299.free_mem_217895 = mem_217895.mem;
        futhark_mc_task_236299.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236299.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236299.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236299.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236299.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236299.free_mem_219484 = mem_219484;
        futhark_mc_task_236299.free_mem_219487 = mem_219487;
        
        struct scheduler_segop futhark_mc_task_236299_task;
        
        futhark_mc_task_236299_task.args = &futhark_mc_task_236299;
        futhark_mc_task_236299_task.top_level_fn =
            futhark_mc_segmap_task_236300;
        futhark_mc_task_236299_task.name = "futhark_mc_segmap_task_236300";
        futhark_mc_task_236299_task.iterations = l_n_m_203733;
        futhark_mc_task_236299_task.task_time =
            &ctx->futhark_mc_segmap_task_236300_total_time;
        futhark_mc_task_236299_task.task_iter =
            &ctx->futhark_mc_segmap_task_236300_total_iter;
        futhark_mc_task_236299_task.sched = STATIC;
        futhark_mc_task_236299_task.nested_fn =
            futhark_mc_segmap_nested_task_236303;
        
        int futhark_mc_segmap_task_236300_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236299_task);
        
        if (futhark_mc_segmap_task_236300_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219521.mem + gtid_212752 * l_n_m_203733 * (int64_t) 8,
                    mem_219484 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219525.mem + gtid_212752 * l_n_m_203733 * (int64_t) 8,
                    mem_219487 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219484);
    free(mem_219487);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236296_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236296_end -
                 futhark_mc_segmap_parloop_236296_start;
        
        ctx->futhark_mc_segmap_parloop_236296_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236296_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236296_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236294(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_212751 = tid;
    int num_tasks_230107 = info.nsubtasks;
    struct futhark_mc_task_236288 *futhark_mc_task_236288 =
                                  (struct futhark_mc_task_236288 *) args;
    struct futhark_context *ctx = futhark_mc_task_236288->ctx;
    uint64_t futhark_mc_segmap_nested_task_236294_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236294_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236288->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236288->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236288->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236288->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236288->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236288->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236288->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236288->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236288->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236288->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236288->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236288->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236288->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236288->free_mem_219411,
                                  .size =0, .references =NULL};
    struct memblock mem_219521 = {.desc ="mem_219521", .mem =
                                  futhark_mc_task_236288->free_mem_219521,
                                  .size =0, .references =NULL};
    struct memblock mem_219525 = {.desc ="mem_219525", .mem =
                                  futhark_mc_task_236288->free_mem_219525,
                                  .size =0, .references =NULL};
    int64_t iter_230233;
    struct futhark_mc_segmap_parloop_struct_236295
    futhark_mc_segmap_parloop_struct_236295;
    
    futhark_mc_segmap_parloop_struct_236295.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236295.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236295.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236295.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236295.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236295.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236295.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236295.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236295.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236295.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236295.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236295.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236295.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236295.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236295.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236295.free_mem_219521 = mem_219521.mem;
    futhark_mc_segmap_parloop_struct_236295.free_mem_219525 = mem_219525.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236296_task;
    
    futhark_mc_segmap_parloop_236296_task.name =
        "futhark_mc_segmap_parloop_236296";
    futhark_mc_segmap_parloop_236296_task.fn = futhark_mc_segmap_parloop_236296;
    futhark_mc_segmap_parloop_236296_task.args =
        &futhark_mc_segmap_parloop_struct_236295;
    futhark_mc_segmap_parloop_236296_task.iterations = iterations;
    futhark_mc_segmap_parloop_236296_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236296_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236296_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236296_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236296_task);
    
    if (futhark_mc_segmap_parloop_236296_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236296_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236296_total_end -
                 futhark_mc_segmap_parloop_236296_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236296_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236296_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236296_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236294_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236294_end -
                 futhark_mc_segmap_nested_task_236294_start;
        
        ctx->futhark_mc_segmap_nested_task_236294_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236294_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236294_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236321 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219535;
    unsigned char *free_mem_219588;
};
struct futhark_mc_segmap_parloop_struct_236323 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219535;
    unsigned char *free_mem_219588;
};
static int futhark_mc_segmap_parloop_236324(void *args, int64_t start,
                                            int64_t end, int flat_tid_212999,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236323->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236323->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236323->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236323->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236323->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236323->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236323->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236323->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236323->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236323->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236323->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219535 =
            futhark_mc_segmap_parloop_struct_236323->free_bytes_219535;
    struct memblock mem_219588 = {.desc ="mem_219588", .mem =
                                  futhark_mc_segmap_parloop_struct_236323->free_mem_219588,
                                  .size =0, .references =NULL};
    size_t mem_219557_cached_sizze_236325 = 0;
    unsigned char *mem_219557 = NULL;
    size_t mem_219567_cached_sizze_236326 = 0;
    unsigned char *mem_219567 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230681 = start;
    
    if (mem_219557_cached_sizze_236325 < (size_t) bytes_217838) {
        mem_219557 = realloc(mem_219557, bytes_217838);
        mem_219557_cached_sizze_236325 = bytes_217838;
    }
    if (mem_219567_cached_sizze_236326 < (size_t) bytes_219535) {
        mem_219567 = realloc(mem_219567, bytes_219535);
        mem_219567_cached_sizze_236326 = bytes_219535;
    }
    for (; iter_230681 < end; iter_230681++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230727 = partition_sizze_203667;
        int64_t gtid_213000 = iter_230681;
        int64_t remnant_230728 = iter_230681 - gtid_213000;
        
        for (int64_t i_230682 = 0; i_230682 < l_n_m_203733; i_230682++) {
            int64_t x_230684;
            
            x_230684 = ((int64_t *) mem_217891.mem)[gtid_213000 * l_n_m_203733 +
                                                    i_230682];
            
            double x_230685;
            
            x_230685 = ((double *) mem_217895.mem)[gtid_213000 * l_n_m_203733 +
                                                   i_230682];
            
            int64_t min_arg_230686 = mul64(jump_t_203582, i_230682);
            int64_t min_res_230687 = smin64(i_203760, min_arg_230686);
            int64_t defunc_0_g_res_230688 = add64((int64_t) 1, min_res_230687);
            double defunc_2_reduce_res_230690;
            double redout_230693 = 0.0;
            
            for (int64_t i_230692 = 0; i_230692 < q_l_203577; i_230692++) {
                bool cond_230695 = sle64(n_203572, i_230692);
                int64_t defunc_0_f_res_230696;
                
                if (cond_230695) {
                    defunc_0_f_res_230696 = (int64_t) 0;
                } else {
                    int64_t i_230697 = add64(x_230684, i_230692);
                    int64_t defunc_1_add_res_230698 = add64((int64_t) 1,
                                                            i_230697);
                    
                    defunc_0_f_res_230696 = defunc_1_add_res_230698;
                }
                
                double defunc_0_f_res_230699;
                
                if (cond_230695) {
                    defunc_0_f_res_230699 = 0.0;
                } else {
                    int64_t i_230700 = add64(x_230684, i_230692);
                    double defunc_0_add_arg_230701;
                    
                    defunc_0_add_arg_230701 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_213000 *
                                                           ctx_param_ext_217985 +
                                                           i_230700 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_230699 = defunc_0_add_arg_230701;
                }
                
                int64_t binop_p_230702 = sub64(defunc_0_f_res_230696,
                                               defunc_0_g_res_230688);
                double defunc_0_f_res_230703 = sitofp_i64_f64(binop_p_230702);
                double abs_res_230704 = fabs(defunc_0_f_res_230703);
                double tmp1_230705 = abs_res_230704 / x_230685;
                double x_230706 = tmp1_230705 * tmp1_230705;
                double y_230707 = tmp1_230705 * x_230706;
                double tmp2_230708 = 1.0 - y_230707;
                double x_230709 = tmp2_230708 * tmp2_230708;
                double tmp3_230710 = tmp2_230708 * x_230709;
                double tmp4_230711 = defunc_0_f_res_230699 * tmp3_230710;
                double defunc_1_op_res_230712 = tmp4_230711 + redout_230693;
                
                ((double *) mem_219567)[i_230692] = tmp4_230711;
                
                double redout_tmp_230730 = defunc_1_op_res_230712;
                
                redout_230693 = redout_tmp_230730;
            }
            defunc_2_reduce_res_230690 = redout_230693;
            
            double a0_230714 = 1.0 / defunc_2_reduce_res_230690;
            double defunc_2_reduce_res_230715;
            double redout_230717 = 0.0;
            
            for (int64_t i_230716 = 0; i_230716 < q_l_203577; i_230716++) {
                double x_230718;
                
                x_230718 = ((double *) mem_219567)[i_230716];
                
                bool cond_230719 = sle64(n_203572, i_230716);
                double defunc_0_f_res_230720;
                
                if (cond_230719) {
                    defunc_0_f_res_230720 = 0.0;
                } else {
                    int64_t i_230721 = add64(x_230684, i_230716);
                    double defunc_0_add_arg_230722;
                    
                    defunc_0_add_arg_230722 =
                        ((double *) mem_219411.mem)[gtid_213000 * n_203572 +
                                                    i_230721];
                    defunc_0_f_res_230720 = defunc_0_add_arg_230722;
                }
                
                double x_230723 = a0_230714 * x_230718;
                double defunc_9_fit_fun_res_230724 = defunc_0_f_res_230720 *
                       x_230723;
                double defunc_1_op_res_230725 = defunc_9_fit_fun_res_230724 +
                       redout_230717;
                double redout_tmp_230732 = defunc_1_op_res_230725;
                
                redout_230717 = redout_tmp_230732;
            }
            defunc_2_reduce_res_230715 = redout_230717;
            ((double *) mem_219557)[i_230682] = defunc_2_reduce_res_230715;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219588.mem + gtid_213000 * l_n_m_203733 * (int64_t) 8,
                    mem_219557 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219557);
    free(mem_219567);
    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_212999 = tid;
    int num_tasks_230680 = 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_203572 = futhark_mc_task_236321->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236321->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236321->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236321->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236321->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236321->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236321->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236321->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236321->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236321->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236321->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236321->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236321->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236321->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219535 = futhark_mc_task_236321->free_bytes_219535;
    struct memblock mem_219588 = {.desc ="mem_219588", .mem =
                                  futhark_mc_task_236321->free_mem_219588,
                                  .size =0, .references =NULL};
    int64_t iter_230681;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236323.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236323.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236323.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236323.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236323.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236323.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236323.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236323.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236323.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236323.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236323.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236323.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236323.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236323.free_bytes_219535 = bytes_219535;
    futhark_mc_segmap_parloop_struct_236323.free_mem_219588 = mem_219588.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_236328 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219535;
    unsigned char *free_mem_219588;
};
struct futhark_mc_task_236331 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_213060;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219535;
    unsigned char *free_mem_219554;
};
struct futhark_mc_segmap_parloop_struct_236333 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_213060;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219535;
    unsigned char *free_mem_219554;
};
static int futhark_mc_segmap_parloop_236334(void *args, int64_t start,
                                            int64_t end, int flat_tid_230780,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236333
    *futhark_mc_segmap_parloop_struct_236333 =
    (struct futhark_mc_segmap_parloop_struct_236333 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236333->ctx;
    uint64_t futhark_mc_segmap_parloop_236334_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236334_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236333->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236333->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236333->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236333->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236333->free_i_203760;
    int64_t gtid_213060 =
            futhark_mc_segmap_parloop_struct_236333->free_gtid_213060;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236333->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236333->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236333->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236333->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236333->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236333->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236333->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219535 =
            futhark_mc_segmap_parloop_struct_236333->free_bytes_219535;
    struct memblock mem_219554 = {.desc ="mem_219554", .mem =
                                  futhark_mc_segmap_parloop_struct_236333->free_mem_219554,
                                  .size =0, .references =NULL};
    size_t mem_230787_cached_sizze_236335 = 0;
    unsigned char *mem_230787 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230828 = start;
    
    if (mem_230787_cached_sizze_236335 < (size_t) bytes_219535) {
        mem_230787 = realloc(mem_230787, bytes_219535);
        mem_230787_cached_sizze_236335 = bytes_219535;
    }
    for (; iter_230828 < end; iter_230828++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230861 = l_n_m_203733;
        int64_t gtid_230781 = iter_230828;
        int64_t remnant_230862 = iter_230828 - gtid_230781;
        int64_t x_230782;
        
        x_230782 = ((int64_t *) mem_217891.mem)[gtid_213060 * l_n_m_203733 +
                                                gtid_230781];
        
        double x_230783;
        
        x_230783 = ((double *) mem_217895.mem)[gtid_213060 * l_n_m_203733 +
                                               gtid_230781];
        
        int64_t min_arg_230784 = mul64(jump_t_203582, gtid_230781);
        int64_t min_res_230785 = smin64(i_203760, min_arg_230784);
        int64_t defunc_0_g_res_230786 = add64((int64_t) 1, min_res_230785);
        double defunc_2_reduce_res_230789;
        double redout_230830 = 0.0;
        
        for (int64_t i_230829 = 0; i_230829 < q_l_203577; i_230829++) {
            bool cond_230832 = sle64(n_203572, i_230829);
            int64_t defunc_0_f_res_230833;
            
            if (cond_230832) {
                defunc_0_f_res_230833 = (int64_t) 0;
            } else {
                int64_t i_230834 = add64(x_230782, i_230829);
                int64_t defunc_1_add_res_230835 = add64((int64_t) 1, i_230834);
                
                defunc_0_f_res_230833 = defunc_1_add_res_230835;
            }
            
            double defunc_0_f_res_230836;
            
            if (cond_230832) {
                defunc_0_f_res_230836 = 0.0;
            } else {
                int64_t i_230837 = add64(x_230782, i_230829);
                double defunc_0_add_arg_230838;
                
                defunc_0_add_arg_230838 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_213060 *
                                                       ctx_param_ext_217985 +
                                                       i_230837 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_230836 = defunc_0_add_arg_230838;
            }
            
            int64_t binop_p_230839 = sub64(defunc_0_f_res_230833,
                                           defunc_0_g_res_230786);
            double defunc_0_f_res_230840 = sitofp_i64_f64(binop_p_230839);
            double abs_res_230841 = fabs(defunc_0_f_res_230840);
            double tmp1_230842 = abs_res_230841 / x_230783;
            double x_230843 = tmp1_230842 * tmp1_230842;
            double y_230844 = tmp1_230842 * x_230843;
            double tmp2_230845 = 1.0 - y_230844;
            double x_230846 = tmp2_230845 * tmp2_230845;
            double tmp3_230847 = tmp2_230845 * x_230846;
            double tmp4_230848 = defunc_0_f_res_230836 * tmp3_230847;
            double defunc_1_op_res_230849 = tmp4_230848 + redout_230830;
            
            ((double *) mem_230787)[i_230829] = tmp4_230848;
            
            double redout_tmp_230863 = defunc_1_op_res_230849;
            
            redout_230830 = redout_tmp_230863;
        }
        defunc_2_reduce_res_230789 = redout_230830;
        
        double a0_230813 = 1.0 / defunc_2_reduce_res_230789;
        double defunc_2_reduce_res_230814;
        double redout_230852 = 0.0;
        
        for (int64_t i_230851 = 0; i_230851 < q_l_203577; i_230851++) {
            double x_230853;
            
            x_230853 = ((double *) mem_230787)[i_230851];
            
            bool cond_230854 = sle64(n_203572, i_230851);
            double defunc_0_f_res_230855;
            
            if (cond_230854) {
                defunc_0_f_res_230855 = 0.0;
            } else {
                int64_t i_230856 = add64(x_230782, i_230851);
                double defunc_0_add_arg_230857;
                
                defunc_0_add_arg_230857 =
                    ((double *) mem_219411.mem)[gtid_213060 * n_203572 +
                                                i_230856];
                defunc_0_f_res_230855 = defunc_0_add_arg_230857;
            }
            
            double x_230858 = a0_230813 * x_230853;
            double defunc_9_fit_fun_res_230859 = defunc_0_f_res_230855 *
                   x_230858;
            double defunc_1_op_res_230860 = defunc_9_fit_fun_res_230859 +
                   redout_230852;
            double redout_tmp_230865 = defunc_1_op_res_230860;
            
            redout_230852 = redout_tmp_230865;
        }
        defunc_2_reduce_res_230814 = redout_230852;
        ((double *) mem_219554.mem)[gtid_230781] = defunc_2_reduce_res_230814;
    }
    
  cleanup:
    { }
    free(mem_230787);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236334_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236334_end -
                 futhark_mc_segmap_parloop_236334_start;
        
        ctx->futhark_mc_segmap_parloop_236334_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236334_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236334_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236332(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230780 = tid;
    int num_tasks_230827 = info.nsubtasks;
    struct futhark_mc_task_236331 *futhark_mc_task_236331 =
                                  (struct futhark_mc_task_236331 *) args;
    struct futhark_context *ctx = futhark_mc_task_236331->ctx;
    uint64_t futhark_mc_segmap_task_236332_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236332_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236331->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236331->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236331->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236331->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236331->free_i_203760;
    int64_t gtid_213060 = futhark_mc_task_236331->free_gtid_213060;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236331->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236331->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236331->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236331->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236331->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236331->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236331->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219535 = futhark_mc_task_236331->free_bytes_219535;
    struct memblock mem_219554 = {.desc ="mem_219554", .mem =
                                  futhark_mc_task_236331->free_mem_219554,
                                  .size =0, .references =NULL};
    int64_t iter_230828;
    struct futhark_mc_segmap_parloop_struct_236333
    futhark_mc_segmap_parloop_struct_236333;
    
    futhark_mc_segmap_parloop_struct_236333.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236333.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236333.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236333.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236333.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236333.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236333.free_gtid_213060 = gtid_213060;
    futhark_mc_segmap_parloop_struct_236333.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236333.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236333.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236333.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236333.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236333.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236333.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236333.free_bytes_219535 = bytes_219535;
    futhark_mc_segmap_parloop_struct_236333.free_mem_219554 = mem_219554.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236334_task;
    
    futhark_mc_segmap_parloop_236334_task.name =
        "futhark_mc_segmap_parloop_236334";
    futhark_mc_segmap_parloop_236334_task.fn = futhark_mc_segmap_parloop_236334;
    futhark_mc_segmap_parloop_236334_task.args =
        &futhark_mc_segmap_parloop_struct_236333;
    futhark_mc_segmap_parloop_236334_task.iterations = iterations;
    futhark_mc_segmap_parloop_236334_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236334_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236334_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236334_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236334_task);
    
    if (futhark_mc_segmap_parloop_236334_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236334_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236334_total_end -
                 futhark_mc_segmap_parloop_236334_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236334_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236334_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236334_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236332_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236332_end -
                 futhark_mc_segmap_task_236332_start;
        
        ctx->futhark_mc_segmap_task_236332_runs[tid]++;
        ctx->futhark_mc_segmap_task_236332_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236332_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236337 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_213060;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219535;
    unsigned char *free_mem_219554;
};
struct futhark_mc_task_236340 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213060;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_230736;
    double free_x_230737;
    int64_t free_defunc_0_g_res_230740;
    double *retval_defunc_2_reduce_res_230742;
    unsigned char *retval_mem_230741;
};
struct futhark_mc_segred_stage_1_parloop_struct_236343 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213060;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_230736;
    double free_x_230737;
    int64_t free_defunc_0_g_res_230740;
    unsigned char *free_mem_230741;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230904;
};
static int futhark_mc_segred_stage_1_parloop_236344(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230867,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236343
    *futhark_mc_segred_stage_1_parloop_struct_236343 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236343 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236343->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236344_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236344_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236343->free_n_203572;
    int64_t gtid_213060 =
            futhark_mc_segred_stage_1_parloop_struct_236343->free_gtid_213060;
    int64_t ctx_param_ext_217984 =
            futhark_mc_segred_stage_1_parloop_struct_236343->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segred_stage_1_parloop_struct_236343->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segred_stage_1_parloop_struct_236343->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236343->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_230736 =
            futhark_mc_segred_stage_1_parloop_struct_236343->free_x_230736;
    double x_230737 =
           futhark_mc_segred_stage_1_parloop_struct_236343->free_x_230737;
    int64_t defunc_0_g_res_230740 =
            futhark_mc_segred_stage_1_parloop_struct_236343->free_defunc_0_g_res_230740;
    struct memblock mem_230741 = {.desc ="mem_230741", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236343->free_mem_230741,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_230904 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230904",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236343->free_reduce_stage_1_tid_res_arr_mem_230904,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230906 = start;
    double x_230869;
    double x_230870;
    double local_acc_230907 = 0.0;
    
    for (; iter_230906 < end; iter_230906++) {
        int64_t gtid_230868 = iter_230906;
        bool cond_230872 = sle64(n_203572, gtid_230868);
        int64_t defunc_0_f_res_230873;
        
        if (cond_230872) {
            defunc_0_f_res_230873 = (int64_t) 0;
        } else {
            int64_t i_230874 = add64(x_230736, gtid_230868);
            int64_t defunc_1_add_res_230875 = add64((int64_t) 1, i_230874);
            
            defunc_0_f_res_230873 = defunc_1_add_res_230875;
        }
        
        double defunc_0_f_res_230876;
        
        if (cond_230872) {
            defunc_0_f_res_230876 = 0.0;
        } else {
            int64_t i_230877 = add64(x_230736, gtid_230868);
            double defunc_0_add_arg_230878;
            
            defunc_0_add_arg_230878 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_213060 *
                                                   ctx_param_ext_217985 +
                                                   i_230877 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_230876 = defunc_0_add_arg_230878;
        }
        
        int64_t binop_p_230879 = sub64(defunc_0_f_res_230873,
                                       defunc_0_g_res_230740);
        double defunc_0_f_res_230880 = sitofp_i64_f64(binop_p_230879);
        double abs_res_230881 = fabs(defunc_0_f_res_230880);
        double tmp1_230882 = abs_res_230881 / x_230737;
        double x_230883 = tmp1_230882 * tmp1_230882;
        double y_230884 = tmp1_230882 * x_230883;
        double tmp2_230885 = 1.0 - y_230884;
        double x_230886 = tmp2_230885 * tmp2_230885;
        double tmp3_230887 = tmp2_230885 * x_230886;
        double tmp4_230888 = defunc_0_f_res_230876 * tmp3_230887;
        
        // save map-out results
        {
            ((double *) mem_230741.mem)[gtid_230868] = tmp4_230888;
        }
        // Load accum params
        {
            x_230869 = local_acc_230907;
        }
        // Load next params
        {
            x_230870 = tmp4_230888;
        }
        // Red body
        {
            double defunc_1_op_res_230871 = x_230869 + x_230870;
            
            local_acc_230907 = defunc_1_op_res_230871;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230904.mem)[flat_tid_230867] =
        local_acc_230907;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236344_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236344_end -
                 futhark_mc_segred_stage_1_parloop_236344_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236344_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236344_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236344_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236341(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230867 = tid;
    int num_tasks_230903 = info.nsubtasks;
    struct futhark_mc_task_236340 *futhark_mc_task_236340 =
                                  (struct futhark_mc_task_236340 *) args;
    struct futhark_context *ctx = futhark_mc_task_236340->ctx;
    uint64_t futhark_mc_segred_task_236341_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236341_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236340->free_n_203572;
    int64_t gtid_213060 = futhark_mc_task_236340->free_gtid_213060;
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236340->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236340->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236340->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236340->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_230736 = futhark_mc_task_236340->free_x_230736;
    double x_230737 = futhark_mc_task_236340->free_x_230737;
    int64_t defunc_0_g_res_230740 =
            futhark_mc_task_236340->free_defunc_0_g_res_230740;
    double defunc_2_reduce_res_230742 =
           *futhark_mc_task_236340->retval_defunc_2_reduce_res_230742;
    struct memblock mem_230741 = {.desc ="mem_230741", .mem =
                                  futhark_mc_task_236340->retval_mem_230741,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_230904_cached_sizze_236342 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230904 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230904_cached_sizze_236342 <
        (size_t) ((int64_t) 8 * num_tasks_230903)) {
        reduce_stage_1_tid_res_arr_mem_230904 =
            realloc(reduce_stage_1_tid_res_arr_mem_230904, (int64_t) 8 *
                    num_tasks_230903);
        reduce_stage_1_tid_res_arr_mem_230904_cached_sizze_236342 =
            (int64_t) 8 * num_tasks_230903;
    }
    
    int64_t iter_230906;
    struct futhark_mc_segred_stage_1_parloop_struct_236343
    futhark_mc_segred_stage_1_parloop_struct_236343;
    
    futhark_mc_segred_stage_1_parloop_struct_236343.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_gtid_213060 =
        gtid_213060;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_x_230736 = x_230736;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_x_230737 = x_230737;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_defunc_0_g_res_230740 =
        defunc_0_g_res_230740;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_mem_230741 =
        mem_230741.mem;
    futhark_mc_segred_stage_1_parloop_struct_236343.free_reduce_stage_1_tid_res_arr_mem_230904 =
        reduce_stage_1_tid_res_arr_mem_230904;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236344_task;
    
    futhark_mc_segred_stage_1_parloop_236344_task.name =
        "futhark_mc_segred_stage_1_parloop_236344";
    futhark_mc_segred_stage_1_parloop_236344_task.fn =
        futhark_mc_segred_stage_1_parloop_236344;
    futhark_mc_segred_stage_1_parloop_236344_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236343;
    futhark_mc_segred_stage_1_parloop_236344_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236344_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236344_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236344_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236344_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236344_task);
    
    if (futhark_mc_segred_stage_1_parloop_236344_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236344_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236344_total_end -
                 futhark_mc_segred_stage_1_parloop_236344_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236344_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236344_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236344_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_230742 = 0.0;
    }
    
    double x_230908;
    double x_230909;
    
    for (int32_t i_230911 = 0; i_230911 < num_tasks_230903; i_230911++) {
        flat_tid_230867 = i_230911;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230908 = defunc_2_reduce_res_230742;
            }
            // load next params
            {
                x_230909 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230904)[flat_tid_230867];
            }
            // red body
            {
                double defunc_1_op_res_230910 = x_230908 + x_230909;
                
                defunc_2_reduce_res_230742 = defunc_1_op_res_230910;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230904);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236341_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236341_end -
                 futhark_mc_segred_task_236341_start;
        
        ctx->futhark_mc_segred_task_236341_runs[tid]++;
        ctx->futhark_mc_segred_task_236341_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236341_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236340->retval_defunc_2_reduce_res_230742 =
            defunc_2_reduce_res_230742;
        futhark_mc_task_236340->retval_mem_230741 = mem_230741.mem;
    }
    return err;
}
struct futhark_mc_task_236345 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213060;
    unsigned char *free_mem_219411;
    int64_t free_x_230736;
    unsigned char *free_mem_230741;
    double free_a0_230766;
    double *retval_defunc_2_reduce_res_230767;
};
struct futhark_mc_segred_stage_1_parloop_struct_236348 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213060;
    unsigned char *free_mem_219411;
    int64_t free_x_230736;
    unsigned char *free_mem_230741;
    double free_a0_230766;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_230913;
};
static int futhark_mc_segred_stage_1_parloop_236349(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_230889,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236348
    *futhark_mc_segred_stage_1_parloop_struct_236348 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236348 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236348->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236349_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236349_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236348->free_n_203572;
    int64_t gtid_213060 =
            futhark_mc_segred_stage_1_parloop_struct_236348->free_gtid_213060;
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236348->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_230736 =
            futhark_mc_segred_stage_1_parloop_struct_236348->free_x_230736;
    struct memblock mem_230741 = {.desc ="mem_230741", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236348->free_mem_230741,
                                  .size =0, .references =NULL};
    double a0_230766 =
           futhark_mc_segred_stage_1_parloop_struct_236348->free_a0_230766;
    struct memblock reduce_stage_1_tid_res_arr_mem_230913 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_230913",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236348->free_reduce_stage_1_tid_res_arr_mem_230913,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_230915 = start;
    double x_230891;
    double x_230892;
    double local_acc_230916 = 0.0;
    
    for (; iter_230915 < end; iter_230915++) {
        int64_t gtid_230890 = iter_230915;
        double x_230894;
        
        x_230894 = ((double *) mem_230741.mem)[gtid_230890];
        
        bool cond_230895 = sle64(n_203572, gtid_230890);
        double defunc_0_f_res_230896;
        
        if (cond_230895) {
            defunc_0_f_res_230896 = 0.0;
        } else {
            int64_t i_230897 = add64(x_230736, gtid_230890);
            double defunc_0_add_arg_230898;
            
            defunc_0_add_arg_230898 = ((double *) mem_219411.mem)[gtid_213060 *
                                                                  n_203572 +
                                                                  i_230897];
            defunc_0_f_res_230896 = defunc_0_add_arg_230898;
        }
        
        double x_230899 = a0_230766 * x_230894;
        double defunc_9_fit_fun_res_230900 = defunc_0_f_res_230896 * x_230899;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_230891 = local_acc_230916;
        }
        // Load next params
        {
            x_230892 = defunc_9_fit_fun_res_230900;
        }
        // Red body
        {
            double defunc_1_op_res_230893 = x_230891 + x_230892;
            
            local_acc_230916 = defunc_1_op_res_230893;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_230913.mem)[flat_tid_230889] =
        local_acc_230916;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236349_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236349_end -
                 futhark_mc_segred_stage_1_parloop_236349_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236349_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236349_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236349_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236346(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230889 = tid;
    int num_tasks_230912 = info.nsubtasks;
    struct futhark_mc_task_236345 *futhark_mc_task_236345 =
                                  (struct futhark_mc_task_236345 *) args;
    struct futhark_context *ctx = futhark_mc_task_236345->ctx;
    uint64_t futhark_mc_segred_task_236346_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236346_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236345->free_n_203572;
    int64_t gtid_213060 = futhark_mc_task_236345->free_gtid_213060;
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236345->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_230736 = futhark_mc_task_236345->free_x_230736;
    struct memblock mem_230741 = {.desc ="mem_230741", .mem =
                                  futhark_mc_task_236345->free_mem_230741,
                                  .size =0, .references =NULL};
    double a0_230766 = futhark_mc_task_236345->free_a0_230766;
    double defunc_2_reduce_res_230767 =
           *futhark_mc_task_236345->retval_defunc_2_reduce_res_230767;
    size_t reduce_stage_1_tid_res_arr_mem_230913_cached_sizze_236347 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_230913 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_230913_cached_sizze_236347 <
        (size_t) ((int64_t) 8 * num_tasks_230912)) {
        reduce_stage_1_tid_res_arr_mem_230913 =
            realloc(reduce_stage_1_tid_res_arr_mem_230913, (int64_t) 8 *
                    num_tasks_230912);
        reduce_stage_1_tid_res_arr_mem_230913_cached_sizze_236347 =
            (int64_t) 8 * num_tasks_230912;
    }
    
    int64_t iter_230915;
    struct futhark_mc_segred_stage_1_parloop_struct_236348
    futhark_mc_segred_stage_1_parloop_struct_236348;
    
    futhark_mc_segred_stage_1_parloop_struct_236348.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236348.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236348.free_gtid_213060 =
        gtid_213060;
    futhark_mc_segred_stage_1_parloop_struct_236348.free_mem_219411 =
        mem_219411.mem;
    futhark_mc_segred_stage_1_parloop_struct_236348.free_x_230736 = x_230736;
    futhark_mc_segred_stage_1_parloop_struct_236348.free_mem_230741 =
        mem_230741.mem;
    futhark_mc_segred_stage_1_parloop_struct_236348.free_a0_230766 = a0_230766;
    futhark_mc_segred_stage_1_parloop_struct_236348.free_reduce_stage_1_tid_res_arr_mem_230913 =
        reduce_stage_1_tid_res_arr_mem_230913;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236349_task;
    
    futhark_mc_segred_stage_1_parloop_236349_task.name =
        "futhark_mc_segred_stage_1_parloop_236349";
    futhark_mc_segred_stage_1_parloop_236349_task.fn =
        futhark_mc_segred_stage_1_parloop_236349;
    futhark_mc_segred_stage_1_parloop_236349_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236348;
    futhark_mc_segred_stage_1_parloop_236349_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236349_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236349_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236349_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236349_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236349_task);
    
    if (futhark_mc_segred_stage_1_parloop_236349_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236349_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236349_total_end -
                 futhark_mc_segred_stage_1_parloop_236349_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236349_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236349_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236349_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_230767 = 0.0;
    }
    
    double x_230917;
    double x_230918;
    
    for (int32_t i_230920 = 0; i_230920 < num_tasks_230912; i_230920++) {
        flat_tid_230889 = i_230920;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_230917 = defunc_2_reduce_res_230767;
            }
            // load next params
            {
                x_230918 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_230913)[flat_tid_230889];
            }
            // red body
            {
                double defunc_1_op_res_230919 = x_230917 + x_230918;
                
                defunc_2_reduce_res_230767 = defunc_1_op_res_230919;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_230913);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236346_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236346_end -
                 futhark_mc_segred_task_236346_start;
        
        ctx->futhark_mc_segred_task_236346_runs[tid]++;
        ctx->futhark_mc_segred_task_236346_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236346_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236345->retval_defunc_2_reduce_res_230767 =
            defunc_2_reduce_res_230767;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236338(void *args, int64_t start,
                                            int64_t end, int flat_tid_230734,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236337
    *futhark_mc_segmap_parloop_struct_236337 =
    (struct futhark_mc_segmap_parloop_struct_236337 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236337->ctx;
    uint64_t futhark_mc_segmap_parloop_236338_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236338_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236337->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236337->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236337->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236337->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236337->free_i_203760;
    int64_t gtid_213060 =
            futhark_mc_segmap_parloop_struct_236337->free_gtid_213060;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236337->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236337->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236337->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236337->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236337->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236337->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236337->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219535 =
            futhark_mc_segmap_parloop_struct_236337->free_bytes_219535;
    struct memblock mem_219554 = {.desc ="mem_219554", .mem =
                                  futhark_mc_segmap_parloop_struct_236337->free_mem_219554,
                                  .size =0, .references =NULL};
    size_t mem_230741_cached_sizze_236339 = 0;
    unsigned char *mem_230741 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230866 = start;
    
    if (mem_230741_cached_sizze_236339 < (size_t) bytes_219535) {
        mem_230741 = realloc(mem_230741, bytes_219535);
        mem_230741_cached_sizze_236339 = bytes_219535;
    }
    for (; iter_230866 < end; iter_230866++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230901 = l_n_m_203733;
        int64_t gtid_230735 = iter_230866;
        int64_t remnant_230902 = iter_230866 - gtid_230735;
        int64_t x_230736;
        
        x_230736 = ((int64_t *) mem_217891.mem)[gtid_213060 * l_n_m_203733 +
                                                gtid_230735];
        
        double x_230737;
        
        x_230737 = ((double *) mem_217895.mem)[gtid_213060 * l_n_m_203733 +
                                               gtid_230735];
        
        int64_t min_arg_230738 = mul64(jump_t_203582, gtid_230735);
        int64_t min_res_230739 = smin64(i_203760, min_arg_230738);
        int64_t defunc_0_g_res_230740 = add64((int64_t) 1, min_res_230739);
        double defunc_2_reduce_res_230742;
        int64_t flat_tid_230867 = (int64_t) 0;
        int32_t num_tasks_230903;
        
        defunc_2_reduce_res_230742 = 0.0;
        
        struct futhark_mc_task_236340 futhark_mc_task_236340;
        
        futhark_mc_task_236340.ctx = ctx;
        futhark_mc_task_236340.free_n_203572 = n_203572;
        futhark_mc_task_236340.free_gtid_213060 = gtid_213060;
        futhark_mc_task_236340.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236340.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236340.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236340.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236340.free_x_230736 = x_230736;
        futhark_mc_task_236340.free_x_230737 = x_230737;
        futhark_mc_task_236340.free_defunc_0_g_res_230740 =
            defunc_0_g_res_230740;
        futhark_mc_task_236340.retval_defunc_2_reduce_res_230742 =
            &defunc_2_reduce_res_230742;
        futhark_mc_task_236340.retval_mem_230741 = mem_230741;
        
        struct scheduler_segop futhark_mc_task_236340_task;
        
        futhark_mc_task_236340_task.args = &futhark_mc_task_236340;
        futhark_mc_task_236340_task.top_level_fn =
            futhark_mc_segred_task_236341;
        futhark_mc_task_236340_task.name = "futhark_mc_segred_task_236341";
        futhark_mc_task_236340_task.iterations = q_l_203577;
        futhark_mc_task_236340_task.task_time =
            &ctx->futhark_mc_segred_task_236341_total_time;
        futhark_mc_task_236340_task.task_iter =
            &ctx->futhark_mc_segred_task_236341_total_iter;
        futhark_mc_task_236340_task.sched = STATIC;
        futhark_mc_task_236340_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236341_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236340_task);
        
        if (futhark_mc_segred_task_236341_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_230766 = 1.0 / defunc_2_reduce_res_230742;
        double defunc_2_reduce_res_230767;
        int64_t flat_tid_230889 = (int64_t) 0;
        int32_t num_tasks_230912;
        
        defunc_2_reduce_res_230767 = 0.0;
        
        struct futhark_mc_task_236345 futhark_mc_task_236345;
        
        futhark_mc_task_236345.ctx = ctx;
        futhark_mc_task_236345.free_n_203572 = n_203572;
        futhark_mc_task_236345.free_gtid_213060 = gtid_213060;
        futhark_mc_task_236345.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236345.free_x_230736 = x_230736;
        futhark_mc_task_236345.free_mem_230741 = mem_230741;
        futhark_mc_task_236345.free_a0_230766 = a0_230766;
        futhark_mc_task_236345.retval_defunc_2_reduce_res_230767 =
            &defunc_2_reduce_res_230767;
        
        struct scheduler_segop futhark_mc_task_236345_task;
        
        futhark_mc_task_236345_task.args = &futhark_mc_task_236345;
        futhark_mc_task_236345_task.top_level_fn =
            futhark_mc_segred_task_236346;
        futhark_mc_task_236345_task.name = "futhark_mc_segred_task_236346";
        futhark_mc_task_236345_task.iterations = q_l_203577;
        futhark_mc_task_236345_task.task_time =
            &ctx->futhark_mc_segred_task_236346_total_time;
        futhark_mc_task_236345_task.task_iter =
            &ctx->futhark_mc_segred_task_236346_total_iter;
        futhark_mc_task_236345_task.sched = STATIC;
        futhark_mc_task_236345_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236346_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236345_task);
        
        if (futhark_mc_segred_task_236346_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219554.mem)[gtid_230735] = defunc_2_reduce_res_230767;
    }
    
  cleanup:
    { }
    free(mem_230741);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236338_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236338_end -
                 futhark_mc_segmap_parloop_236338_start;
        
        ctx->futhark_mc_segmap_parloop_236338_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236338_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236338_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236336(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_230734 = tid;
    int num_tasks_230827 = info.nsubtasks;
    struct futhark_mc_task_236331 *futhark_mc_task_236331 =
                                  (struct futhark_mc_task_236331 *) args;
    struct futhark_context *ctx = futhark_mc_task_236331->ctx;
    uint64_t futhark_mc_segmap_nested_task_236336_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236336_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236331->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236331->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236331->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236331->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236331->free_i_203760;
    int64_t gtid_213060 = futhark_mc_task_236331->free_gtid_213060;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236331->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236331->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236331->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236331->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236331->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236331->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236331->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219535 = futhark_mc_task_236331->free_bytes_219535;
    struct memblock mem_219554 = {.desc ="mem_219554", .mem =
                                  futhark_mc_task_236331->free_mem_219554,
                                  .size =0, .references =NULL};
    int64_t iter_230866;
    struct futhark_mc_segmap_parloop_struct_236337
    futhark_mc_segmap_parloop_struct_236337;
    
    futhark_mc_segmap_parloop_struct_236337.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236337.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236337.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236337.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236337.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236337.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236337.free_gtid_213060 = gtid_213060;
    futhark_mc_segmap_parloop_struct_236337.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236337.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236337.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236337.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236337.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236337.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236337.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236337.free_bytes_219535 = bytes_219535;
    futhark_mc_segmap_parloop_struct_236337.free_mem_219554 = mem_219554.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236338_task;
    
    futhark_mc_segmap_parloop_236338_task.name =
        "futhark_mc_segmap_parloop_236338";
    futhark_mc_segmap_parloop_236338_task.fn = futhark_mc_segmap_parloop_236338;
    futhark_mc_segmap_parloop_236338_task.args =
        &futhark_mc_segmap_parloop_struct_236337;
    futhark_mc_segmap_parloop_236338_task.iterations = iterations;
    futhark_mc_segmap_parloop_236338_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236338_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236338_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236338_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236338_task);
    
    if (futhark_mc_segmap_parloop_236338_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236338_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236338_total_end -
                 futhark_mc_segmap_parloop_236338_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236338_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236338_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236338_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236336_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236336_end -
                 futhark_mc_segmap_nested_task_236336_start;
        
        ctx->futhark_mc_segmap_nested_task_236336_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236336_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236336_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236329(void *args, int64_t start,
                                            int64_t end, int flat_tid_213059,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236328
    *futhark_mc_segmap_parloop_struct_236328 =
    (struct futhark_mc_segmap_parloop_struct_236328 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236328->ctx;
    uint64_t futhark_mc_segmap_parloop_236329_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236329_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236328->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236328->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236328->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236328->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236328->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236328->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236328->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236328->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236328->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236328->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236328->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236328->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236328->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236328->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219535 =
            futhark_mc_segmap_parloop_struct_236328->free_bytes_219535;
    struct memblock mem_219588 = {.desc ="mem_219588", .mem =
                                  futhark_mc_segmap_parloop_struct_236328->free_mem_219588,
                                  .size =0, .references =NULL};
    size_t mem_219554_cached_sizze_236330 = 0;
    unsigned char *mem_219554 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230733 = start;
    
    if (mem_219554_cached_sizze_236330 < (size_t) bytes_217838) {
        mem_219554 = realloc(mem_219554, bytes_217838);
        mem_219554_cached_sizze_236330 = bytes_217838;
    }
    for (; iter_230733 < end; iter_230733++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230825 = partition_sizze_203667;
        int64_t gtid_213060 = iter_230733;
        int64_t remnant_230826 = iter_230733 - gtid_213060;
        int64_t flat_tid_230780 = (int64_t) 0;
        int32_t num_tasks_230827;
        int64_t flat_tid_230734 = (int64_t) 0;
        struct futhark_mc_task_236331 futhark_mc_task_236331;
        
        futhark_mc_task_236331.ctx = ctx;
        futhark_mc_task_236331.free_n_203572 = n_203572;
        futhark_mc_task_236331.free_q_l_203577 = q_l_203577;
        futhark_mc_task_236331.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236331.free_l_n_m_203733 = l_n_m_203733;
        futhark_mc_task_236331.free_i_203760 = i_203760;
        futhark_mc_task_236331.free_gtid_213060 = gtid_213060;
        futhark_mc_task_236331.free_mem_217891 = mem_217891.mem;
        futhark_mc_task_236331.free_mem_217895 = mem_217895.mem;
        futhark_mc_task_236331.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236331.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236331.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236331.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236331.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236331.free_bytes_219535 = bytes_219535;
        futhark_mc_task_236331.free_mem_219554 = mem_219554;
        
        struct scheduler_segop futhark_mc_task_236331_task;
        
        futhark_mc_task_236331_task.args = &futhark_mc_task_236331;
        futhark_mc_task_236331_task.top_level_fn =
            futhark_mc_segmap_task_236332;
        futhark_mc_task_236331_task.name = "futhark_mc_segmap_task_236332";
        futhark_mc_task_236331_task.iterations = l_n_m_203733;
        futhark_mc_task_236331_task.task_time =
            &ctx->futhark_mc_segmap_task_236332_total_time;
        futhark_mc_task_236331_task.task_iter =
            &ctx->futhark_mc_segmap_task_236332_total_iter;
        futhark_mc_task_236331_task.sched = STATIC;
        futhark_mc_task_236331_task.nested_fn =
            futhark_mc_segmap_nested_task_236336;
        
        int futhark_mc_segmap_task_236332_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236331_task);
        
        if (futhark_mc_segmap_task_236332_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219588.mem + gtid_213060 * l_n_m_203733 * (int64_t) 8,
                    mem_219554 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219554);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236329_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236329_end -
                 futhark_mc_segmap_parloop_236329_start;
        
        ctx->futhark_mc_segmap_parloop_236329_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236329_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236329_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236327(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213059 = tid;
    int num_tasks_230680 = 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_236327_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236327_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236321->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236321->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236321->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236321->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236321->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236321->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236321->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236321->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236321->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236321->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236321->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236321->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236321->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236321->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219535 = futhark_mc_task_236321->free_bytes_219535;
    struct memblock mem_219588 = {.desc ="mem_219588", .mem =
                                  futhark_mc_task_236321->free_mem_219588,
                                  .size =0, .references =NULL};
    int64_t iter_230733;
    struct futhark_mc_segmap_parloop_struct_236328
    futhark_mc_segmap_parloop_struct_236328;
    
    futhark_mc_segmap_parloop_struct_236328.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236328.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236328.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236328.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236328.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236328.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236328.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236328.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236328.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236328.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236328.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236328.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236328.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236328.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236328.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236328.free_bytes_219535 = bytes_219535;
    futhark_mc_segmap_parloop_struct_236328.free_mem_219588 = mem_219588.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236329_task;
    
    futhark_mc_segmap_parloop_236329_task.name =
        "futhark_mc_segmap_parloop_236329";
    futhark_mc_segmap_parloop_236329_task.fn = futhark_mc_segmap_parloop_236329;
    futhark_mc_segmap_parloop_236329_task.args =
        &futhark_mc_segmap_parloop_struct_236328;
    futhark_mc_segmap_parloop_236329_task.iterations = iterations;
    futhark_mc_segmap_parloop_236329_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236329_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236329_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236329_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236329_task);
    
    if (futhark_mc_segmap_parloop_236329_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236329_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236329_total_end -
                 futhark_mc_segmap_parloop_236329_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236329_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236329_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236329_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236327_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236327_end -
                 futhark_mc_segmap_nested_task_236327_start;
        
        ctx->futhark_mc_segmap_nested_task_236327_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236327_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236327_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236350 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219590;
    unsigned char *free_mem_219694;
    unsigned char *free_mem_219698;
};
struct futhark_mc_segmap_parloop_struct_236352 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219590;
    unsigned char *free_mem_219694;
    unsigned char *free_mem_219698;
};
static int futhark_mc_segmap_parloop_236353(void *args, int64_t start,
                                            int64_t end, int flat_tid_213158,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236352
    *futhark_mc_segmap_parloop_struct_236352 =
    (struct futhark_mc_segmap_parloop_struct_236352 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236352->ctx;
    uint64_t futhark_mc_segmap_parloop_236353_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236353_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236352->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236352->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236352->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236352->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236352->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236352->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236352->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236352->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236352->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236352->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236352->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236352->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236352->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236352->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219590 =
            futhark_mc_segmap_parloop_struct_236352->free_bytes_219590;
    struct memblock mem_219694 = {.desc ="mem_219694", .mem =
                                  futhark_mc_segmap_parloop_struct_236352->free_mem_219694,
                                  .size =0, .references =NULL};
    struct memblock mem_219698 = {.desc ="mem_219698", .mem =
                                  futhark_mc_segmap_parloop_struct_236352->free_mem_219698,
                                  .size =0, .references =NULL};
    size_t mem_219633_cached_sizze_236354 = 0;
    unsigned char *mem_219633 = NULL;
    size_t mem_219636_cached_sizze_236355 = 0;
    unsigned char *mem_219636 = NULL;
    size_t mem_219653_cached_sizze_236356 = 0;
    unsigned char *mem_219653 = NULL;
    size_t mem_219656_cached_sizze_236357 = 0;
    unsigned char *mem_219656 = NULL;
    int64_t iterations = end - start;
    int64_t iter_230922 = start;
    
    if (mem_219633_cached_sizze_236354 < (size_t) bytes_217838) {
        mem_219633 = realloc(mem_219633, bytes_217838);
        mem_219633_cached_sizze_236354 = bytes_217838;
    }
    if (mem_219636_cached_sizze_236355 < (size_t) bytes_217838) {
        mem_219636 = realloc(mem_219636, bytes_217838);
        mem_219636_cached_sizze_236355 = bytes_217838;
    }
    if (mem_219653_cached_sizze_236356 < (size_t) bytes_219590) {
        mem_219653 = realloc(mem_219653, bytes_219590);
        mem_219653_cached_sizze_236356 = bytes_219590;
    }
    if (mem_219656_cached_sizze_236357 < (size_t) bytes_219590) {
        mem_219656 = realloc(mem_219656, bytes_219590);
        mem_219656_cached_sizze_236357 = bytes_219590;
    }
    for (; iter_230922 < end; iter_230922++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_230999 = partition_sizze_203667;
        int64_t gtid_213159 = iter_230922;
        int64_t remnant_231000 = iter_230922 - gtid_213159;
        
        for (int64_t i_230923 = 0; i_230923 < l_n_m_203733; i_230923++) {
            int64_t x_230926;
            
            x_230926 = ((int64_t *) mem_217891.mem)[gtid_213159 * l_n_m_203733 +
                                                    i_230923];
            
            double x_230927;
            
            x_230927 = ((double *) mem_217895.mem)[gtid_213159 * l_n_m_203733 +
                                                   i_230923];
            
            int64_t min_arg_230928 = mul64(jump_t_203582, i_230923);
            int64_t min_res_230929 = smin64(i_203760, min_arg_230928);
            int64_t defunc_0_g_res_230930 = add64((int64_t) 1, min_res_230929);
            double defunc_2_reduce_res_230933;
            double defunc_2_reduce_res_230934;
            double defunc_2_reduce_res_230935;
            double redout_230939;
            double redout_230940;
            double redout_230941;
            
            redout_230939 = 0.0;
            redout_230940 = 0.0;
            redout_230941 = 0.0;
            for (int64_t i_230938 = 0; i_230938 < q_l_203577; i_230938++) {
                bool cond_230944 = sle64(n_203572, i_230938);
                int64_t defunc_0_f_res_230945;
                
                if (cond_230944) {
                    defunc_0_f_res_230945 = (int64_t) 0;
                } else {
                    int64_t i_230946 = add64(x_230926, i_230938);
                    int64_t defunc_1_add_res_230947 = add64((int64_t) 1,
                                                            i_230946);
                    
                    defunc_0_f_res_230945 = defunc_1_add_res_230947;
                }
                
                double defunc_0_f_res_230948;
                
                if (cond_230944) {
                    defunc_0_f_res_230948 = 0.0;
                } else {
                    int64_t i_230949 = add64(x_230926, i_230938);
                    double defunc_0_add_arg_230950;
                    
                    defunc_0_add_arg_230950 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_213159 *
                                                           ctx_param_ext_217985 +
                                                           i_230949 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_230948 = defunc_0_add_arg_230950;
                }
                
                int64_t binop_p_230951 = sub64(defunc_0_f_res_230945,
                                               defunc_0_g_res_230930);
                double defunc_0_f_res_230952 = sitofp_i64_f64(binop_p_230951);
                double abs_res_230953 = fabs(defunc_0_f_res_230952);
                double tmp1_230954 = abs_res_230953 / x_230927;
                double x_230955 = tmp1_230954 * tmp1_230954;
                double y_230956 = tmp1_230954 * x_230955;
                double tmp2_230957 = 1.0 - y_230956;
                double x_230958 = tmp2_230957 * tmp2_230957;
                double tmp3_230959 = tmp2_230957 * x_230958;
                double tmp4_230960 = defunc_0_f_res_230948 * tmp3_230959;
                double defunc_1_f_res_230961 = defunc_0_f_res_230952 *
                       tmp4_230960;
                double defunc_1_f_res_230962 = defunc_0_f_res_230952 *
                       defunc_1_f_res_230961;
                double defunc_1_op_res_230963 = tmp4_230960 + redout_230939;
                double defunc_1_op_res_230964 = defunc_1_f_res_230961 +
                       redout_230940;
                double defunc_1_op_res_230965 = defunc_1_f_res_230962 +
                       redout_230941;
                
                ((double *) mem_219653)[i_230938] = defunc_1_f_res_230961;
                ((double *) mem_219656)[i_230938] = tmp4_230960;
                
                double redout_tmp_231003 = defunc_1_op_res_230963;
                double redout_tmp_231004 = defunc_1_op_res_230964;
                double redout_tmp_231005 = defunc_1_op_res_230965;
                
                redout_230939 = redout_tmp_231003;
                redout_230940 = redout_tmp_231004;
                redout_230941 = redout_tmp_231005;
            }
            defunc_2_reduce_res_230933 = redout_230939;
            defunc_2_reduce_res_230934 = redout_230940;
            defunc_2_reduce_res_230935 = redout_230941;
            
            double x_230968 = defunc_2_reduce_res_230933 *
                   defunc_2_reduce_res_230935;
            double y_230969 = defunc_2_reduce_res_230934 *
                   defunc_2_reduce_res_230934;
            double y_230970 = x_230968 - y_230969;
            double det1_230971 = 1.0 / y_230970;
            double a11_230972 = defunc_2_reduce_res_230935 * det1_230971;
            double x_230973 = 0.0 - defunc_2_reduce_res_230934;
            double b11_230974 = det1_230971 * x_230973;
            double c11_230975 = defunc_2_reduce_res_230933 * det1_230971;
            double defunc_2_reduce_res_230976;
            double defunc_2_reduce_res_230977;
            double redout_230979;
            double redout_230980;
            
            redout_230979 = 0.0;
            redout_230980 = 0.0;
            for (int64_t i_230978 = 0; i_230978 < q_l_203577; i_230978++) {
                double x_230981;
                
                x_230981 = ((double *) mem_219656)[i_230978];
                
                double x_230982;
                
                x_230982 = ((double *) mem_219653)[i_230978];
                
                bool cond_230983 = sle64(n_203572, i_230978);
                double defunc_0_f_res_230984;
                
                if (cond_230983) {
                    defunc_0_f_res_230984 = 0.0;
                } else {
                    int64_t i_230985 = add64(x_230926, i_230978);
                    double defunc_0_add_arg_230986;
                    
                    defunc_0_add_arg_230986 =
                        ((double *) mem_219411.mem)[gtid_213159 * n_203572 +
                                                    i_230985];
                    defunc_0_f_res_230984 = defunc_0_add_arg_230986;
                }
                
                double x_230987 = a11_230972 * x_230981;
                double y_230988 = b11_230974 * x_230982;
                double x_230989 = x_230987 + y_230988;
                double defunc_9_fit_fun_res_230990 = defunc_0_f_res_230984 *
                       x_230989;
                double x_230991 = b11_230974 * x_230981;
                double y_230992 = c11_230975 * x_230982;
                double x_230993 = x_230991 + y_230992;
                double defunc_9_slope_fun_res_230994 = defunc_0_f_res_230984 *
                       x_230993;
                double defunc_1_op_res_230995 = defunc_9_fit_fun_res_230990 +
                       redout_230979;
                double defunc_1_op_res_230996 = defunc_9_slope_fun_res_230994 +
                       redout_230980;
                double redout_tmp_231008 = defunc_1_op_res_230995;
                double redout_tmp_231009 = defunc_1_op_res_230996;
                
                redout_230979 = redout_tmp_231008;
                redout_230980 = redout_tmp_231009;
            }
            defunc_2_reduce_res_230976 = redout_230979;
            defunc_2_reduce_res_230977 = redout_230980;
            ((double *) mem_219633)[i_230923] = defunc_2_reduce_res_230976;
            ((double *) mem_219636)[i_230923] = defunc_2_reduce_res_230977;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219694.mem + gtid_213159 * l_n_m_203733 * (int64_t) 8,
                    mem_219633 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219698.mem + gtid_213159 * l_n_m_203733 * (int64_t) 8,
                    mem_219636 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219633);
    free(mem_219636);
    free(mem_219653);
    free(mem_219656);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236353_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236353_end -
                 futhark_mc_segmap_parloop_236353_start;
        
        ctx->futhark_mc_segmap_parloop_236353_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236353_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236353_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236351(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213158 = tid;
    int num_tasks_230921 = info.nsubtasks;
    struct futhark_mc_task_236350 *futhark_mc_task_236350 =
                                  (struct futhark_mc_task_236350 *) args;
    struct futhark_context *ctx = futhark_mc_task_236350->ctx;
    uint64_t futhark_mc_segmap_task_236351_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236351_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236350->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236350->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236350->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236350->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236350->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236350->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236350->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236350->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236350->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236350->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236350->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236350->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236350->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236350->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219590 = futhark_mc_task_236350->free_bytes_219590;
    struct memblock mem_219694 = {.desc ="mem_219694", .mem =
                                  futhark_mc_task_236350->free_mem_219694,
                                  .size =0, .references =NULL};
    struct memblock mem_219698 = {.desc ="mem_219698", .mem =
                                  futhark_mc_task_236350->free_mem_219698,
                                  .size =0, .references =NULL};
    int64_t iter_230922;
    struct futhark_mc_segmap_parloop_struct_236352
    futhark_mc_segmap_parloop_struct_236352;
    
    futhark_mc_segmap_parloop_struct_236352.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236352.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236352.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236352.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236352.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236352.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236352.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236352.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236352.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236352.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236352.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236352.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236352.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236352.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236352.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236352.free_bytes_219590 = bytes_219590;
    futhark_mc_segmap_parloop_struct_236352.free_mem_219694 = mem_219694.mem;
    futhark_mc_segmap_parloop_struct_236352.free_mem_219698 = mem_219698.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236353_task;
    
    futhark_mc_segmap_parloop_236353_task.name =
        "futhark_mc_segmap_parloop_236353";
    futhark_mc_segmap_parloop_236353_task.fn = futhark_mc_segmap_parloop_236353;
    futhark_mc_segmap_parloop_236353_task.args =
        &futhark_mc_segmap_parloop_struct_236352;
    futhark_mc_segmap_parloop_236353_task.iterations = iterations;
    futhark_mc_segmap_parloop_236353_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236353_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236353_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236353_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236353_task);
    
    if (futhark_mc_segmap_parloop_236353_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236353_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236353_total_end -
                 futhark_mc_segmap_parloop_236353_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236353_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236353_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236353_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236351_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236351_end -
                 futhark_mc_segmap_task_236351_start;
        
        ctx->futhark_mc_segmap_task_236351_runs[tid]++;
        ctx->futhark_mc_segmap_task_236351_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236351_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236359 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219590;
    unsigned char *free_mem_219694;
    unsigned char *free_mem_219698;
};
struct futhark_mc_task_236363 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_213248;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219590;
    unsigned char *free_mem_219627;
    unsigned char *free_mem_219630;
};
struct futhark_mc_segmap_parloop_struct_236365 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_213248;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219590;
    unsigned char *free_mem_219627;
    unsigned char *free_mem_219630;
};
static int futhark_mc_segmap_parloop_236366(void *args, int64_t start,
                                            int64_t end, int flat_tid_231087,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236365
    *futhark_mc_segmap_parloop_struct_236365 =
    (struct futhark_mc_segmap_parloop_struct_236365 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236365->ctx;
    uint64_t futhark_mc_segmap_parloop_236366_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236366_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236365->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236365->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236365->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236365->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236365->free_i_203760;
    int64_t gtid_213248 =
            futhark_mc_segmap_parloop_struct_236365->free_gtid_213248;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236365->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236365->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236365->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236365->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236365->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236365->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236365->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219590 =
            futhark_mc_segmap_parloop_struct_236365->free_bytes_219590;
    struct memblock mem_219627 = {.desc ="mem_219627", .mem =
                                  futhark_mc_segmap_parloop_struct_236365->free_mem_219627,
                                  .size =0, .references =NULL};
    struct memblock mem_219630 = {.desc ="mem_219630", .mem =
                                  futhark_mc_segmap_parloop_struct_236365->free_mem_219630,
                                  .size =0, .references =NULL};
    size_t mem_231094_cached_sizze_236367 = 0;
    unsigned char *mem_231094 = NULL;
    size_t mem_231096_cached_sizze_236368 = 0;
    unsigned char *mem_231096 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231165 = start;
    
    if (mem_231094_cached_sizze_236367 < (size_t) bytes_219590) {
        mem_231094 = realloc(mem_231094, bytes_219590);
        mem_231094_cached_sizze_236367 = bytes_219590;
    }
    if (mem_231096_cached_sizze_236368 < (size_t) bytes_219590) {
        mem_231096 = realloc(mem_231096, bytes_219590);
        mem_231096_cached_sizze_236368 = bytes_219590;
    }
    for (; iter_231165 < end; iter_231165++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231215 = l_n_m_203733;
        int64_t gtid_231088 = iter_231165;
        int64_t remnant_231216 = iter_231165 - gtid_231088;
        int64_t x_231089;
        
        x_231089 = ((int64_t *) mem_217891.mem)[gtid_213248 * l_n_m_203733 +
                                                gtid_231088];
        
        double x_231090;
        
        x_231090 = ((double *) mem_217895.mem)[gtid_213248 * l_n_m_203733 +
                                               gtid_231088];
        
        int64_t min_arg_231091 = mul64(jump_t_203582, gtid_231088);
        int64_t min_res_231092 = smin64(i_203760, min_arg_231091);
        int64_t defunc_0_g_res_231093 = add64((int64_t) 1, min_res_231092);
        double defunc_2_reduce_res_231098;
        double defunc_2_reduce_res_231099;
        double defunc_2_reduce_res_231100;
        double redout_231167;
        double redout_231168;
        double redout_231169;
        
        redout_231167 = 0.0;
        redout_231168 = 0.0;
        redout_231169 = 0.0;
        for (int64_t i_231166 = 0; i_231166 < q_l_203577; i_231166++) {
            bool cond_231172 = sle64(n_203572, i_231166);
            int64_t defunc_0_f_res_231173;
            
            if (cond_231172) {
                defunc_0_f_res_231173 = (int64_t) 0;
            } else {
                int64_t i_231174 = add64(x_231089, i_231166);
                int64_t defunc_1_add_res_231175 = add64((int64_t) 1, i_231174);
                
                defunc_0_f_res_231173 = defunc_1_add_res_231175;
            }
            
            double defunc_0_f_res_231176;
            
            if (cond_231172) {
                defunc_0_f_res_231176 = 0.0;
            } else {
                int64_t i_231177 = add64(x_231089, i_231166);
                double defunc_0_add_arg_231178;
                
                defunc_0_add_arg_231178 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_213248 *
                                                       ctx_param_ext_217985 +
                                                       i_231177 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_231176 = defunc_0_add_arg_231178;
            }
            
            int64_t binop_p_231179 = sub64(defunc_0_f_res_231173,
                                           defunc_0_g_res_231093);
            double defunc_0_f_res_231180 = sitofp_i64_f64(binop_p_231179);
            double abs_res_231181 = fabs(defunc_0_f_res_231180);
            double tmp1_231182 = abs_res_231181 / x_231090;
            double x_231183 = tmp1_231182 * tmp1_231182;
            double y_231184 = tmp1_231182 * x_231183;
            double tmp2_231185 = 1.0 - y_231184;
            double x_231186 = tmp2_231185 * tmp2_231185;
            double tmp3_231187 = tmp2_231185 * x_231186;
            double tmp4_231188 = defunc_0_f_res_231176 * tmp3_231187;
            double defunc_1_f_res_231189 = defunc_0_f_res_231180 * tmp4_231188;
            double defunc_1_f_res_231190 = defunc_0_f_res_231180 *
                   defunc_1_f_res_231189;
            double defunc_1_op_res_231191 = tmp4_231188 + redout_231167;
            double defunc_1_op_res_231192 = defunc_1_f_res_231189 +
                   redout_231168;
            double defunc_1_op_res_231193 = defunc_1_f_res_231190 +
                   redout_231169;
            
            ((double *) mem_231094)[i_231166] = defunc_1_f_res_231189;
            ((double *) mem_231096)[i_231166] = tmp4_231188;
            
            double redout_tmp_231217 = defunc_1_op_res_231191;
            double redout_tmp_231218 = defunc_1_op_res_231192;
            double redout_tmp_231219 = defunc_1_op_res_231193;
            
            redout_231167 = redout_tmp_231217;
            redout_231168 = redout_tmp_231218;
            redout_231169 = redout_tmp_231219;
        }
        defunc_2_reduce_res_231098 = redout_231167;
        defunc_2_reduce_res_231099 = redout_231168;
        defunc_2_reduce_res_231100 = redout_231169;
        
        double x_231133 = defunc_2_reduce_res_231098 *
               defunc_2_reduce_res_231100;
        double y_231134 = defunc_2_reduce_res_231099 *
               defunc_2_reduce_res_231099;
        double y_231135 = x_231133 - y_231134;
        double det1_231136 = 1.0 / y_231135;
        double a11_231137 = defunc_2_reduce_res_231100 * det1_231136;
        double x_231138 = 0.0 - defunc_2_reduce_res_231099;
        double b11_231139 = det1_231136 * x_231138;
        double c11_231140 = defunc_2_reduce_res_231098 * det1_231136;
        double defunc_2_reduce_res_231141;
        double defunc_2_reduce_res_231142;
        double redout_231197;
        double redout_231198;
        
        redout_231197 = 0.0;
        redout_231198 = 0.0;
        for (int64_t i_231196 = 0; i_231196 < q_l_203577; i_231196++) {
            double x_231199;
            
            x_231199 = ((double *) mem_231096)[i_231196];
            
            double x_231200;
            
            x_231200 = ((double *) mem_231094)[i_231196];
            
            bool cond_231201 = sle64(n_203572, i_231196);
            double defunc_0_f_res_231202;
            
            if (cond_231201) {
                defunc_0_f_res_231202 = 0.0;
            } else {
                int64_t i_231203 = add64(x_231089, i_231196);
                double defunc_0_add_arg_231204;
                
                defunc_0_add_arg_231204 =
                    ((double *) mem_219411.mem)[gtid_213248 * n_203572 +
                                                i_231203];
                defunc_0_f_res_231202 = defunc_0_add_arg_231204;
            }
            
            double x_231205 = a11_231137 * x_231199;
            double y_231206 = b11_231139 * x_231200;
            double x_231207 = x_231205 + y_231206;
            double defunc_9_fit_fun_res_231208 = defunc_0_f_res_231202 *
                   x_231207;
            double x_231209 = b11_231139 * x_231199;
            double y_231210 = c11_231140 * x_231200;
            double x_231211 = x_231209 + y_231210;
            double defunc_9_slope_fun_res_231212 = defunc_0_f_res_231202 *
                   x_231211;
            double defunc_1_op_res_231213 = defunc_9_fit_fun_res_231208 +
                   redout_231197;
            double defunc_1_op_res_231214 = defunc_9_slope_fun_res_231212 +
                   redout_231198;
            double redout_tmp_231222 = defunc_1_op_res_231213;
            double redout_tmp_231223 = defunc_1_op_res_231214;
            
            redout_231197 = redout_tmp_231222;
            redout_231198 = redout_tmp_231223;
        }
        defunc_2_reduce_res_231141 = redout_231197;
        defunc_2_reduce_res_231142 = redout_231198;
        ((double *) mem_219627.mem)[gtid_231088] = defunc_2_reduce_res_231141;
        ((double *) mem_219630.mem)[gtid_231088] = defunc_2_reduce_res_231142;
    }
    
  cleanup:
    { }
    free(mem_231094);
    free(mem_231096);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236366_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236366_end -
                 futhark_mc_segmap_parloop_236366_start;
        
        ctx->futhark_mc_segmap_parloop_236366_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236366_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236366_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236364(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231087 = tid;
    int num_tasks_231164 = info.nsubtasks;
    struct futhark_mc_task_236363 *futhark_mc_task_236363 =
                                  (struct futhark_mc_task_236363 *) args;
    struct futhark_context *ctx = futhark_mc_task_236363->ctx;
    uint64_t futhark_mc_segmap_task_236364_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236364_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236363->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236363->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236363->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236363->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236363->free_i_203760;
    int64_t gtid_213248 = futhark_mc_task_236363->free_gtid_213248;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236363->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236363->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236363->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236363->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236363->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236363->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236363->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219590 = futhark_mc_task_236363->free_bytes_219590;
    struct memblock mem_219627 = {.desc ="mem_219627", .mem =
                                  futhark_mc_task_236363->free_mem_219627,
                                  .size =0, .references =NULL};
    struct memblock mem_219630 = {.desc ="mem_219630", .mem =
                                  futhark_mc_task_236363->free_mem_219630,
                                  .size =0, .references =NULL};
    int64_t iter_231165;
    struct futhark_mc_segmap_parloop_struct_236365
    futhark_mc_segmap_parloop_struct_236365;
    
    futhark_mc_segmap_parloop_struct_236365.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236365.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236365.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236365.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236365.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236365.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236365.free_gtid_213248 = gtid_213248;
    futhark_mc_segmap_parloop_struct_236365.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236365.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236365.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236365.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236365.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236365.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236365.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236365.free_bytes_219590 = bytes_219590;
    futhark_mc_segmap_parloop_struct_236365.free_mem_219627 = mem_219627.mem;
    futhark_mc_segmap_parloop_struct_236365.free_mem_219630 = mem_219630.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236366_task;
    
    futhark_mc_segmap_parloop_236366_task.name =
        "futhark_mc_segmap_parloop_236366";
    futhark_mc_segmap_parloop_236366_task.fn = futhark_mc_segmap_parloop_236366;
    futhark_mc_segmap_parloop_236366_task.args =
        &futhark_mc_segmap_parloop_struct_236365;
    futhark_mc_segmap_parloop_236366_task.iterations = iterations;
    futhark_mc_segmap_parloop_236366_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236366_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236366_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236366_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236366_task);
    
    if (futhark_mc_segmap_parloop_236366_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236366_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236366_total_end -
                 futhark_mc_segmap_parloop_236366_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236366_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236366_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236366_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236364_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236364_end -
                 futhark_mc_segmap_task_236364_start;
        
        ctx->futhark_mc_segmap_task_236364_runs[tid]++;
        ctx->futhark_mc_segmap_task_236364_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236364_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236370 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_213248;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219590;
    unsigned char *free_mem_219627;
    unsigned char *free_mem_219630;
};
struct futhark_mc_task_236374 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213248;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_231013;
    double free_x_231014;
    int64_t free_defunc_0_g_res_231017;
    double *retval_defunc_2_reduce_res_231020;
    double *retval_defunc_2_reduce_res_231021;
    double *retval_defunc_2_reduce_res_231022;
    unsigned char *retval_mem_231018;
    unsigned char *retval_mem_231019;
};
struct futhark_mc_segred_stage_1_parloop_struct_236379 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213248;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_231013;
    double free_x_231014;
    int64_t free_defunc_0_g_res_231017;
    unsigned char *free_mem_231018;
    unsigned char *free_mem_231019;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231280;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231282;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231284;
};
static int futhark_mc_segred_stage_1_parloop_236380(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_231225,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236379
    *futhark_mc_segred_stage_1_parloop_struct_236379 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236379 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236379->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236380_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236380_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236379->free_n_203572;
    int64_t gtid_213248 =
            futhark_mc_segred_stage_1_parloop_struct_236379->free_gtid_213248;
    int64_t ctx_param_ext_217984 =
            futhark_mc_segred_stage_1_parloop_struct_236379->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segred_stage_1_parloop_struct_236379->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segred_stage_1_parloop_struct_236379->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segred_stage_1_parloop_struct_236379->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_231013 =
            futhark_mc_segred_stage_1_parloop_struct_236379->free_x_231013;
    double x_231014 =
           futhark_mc_segred_stage_1_parloop_struct_236379->free_x_231014;
    int64_t defunc_0_g_res_231017 =
            futhark_mc_segred_stage_1_parloop_struct_236379->free_defunc_0_g_res_231017;
    struct memblock mem_231018 = {.desc ="mem_231018", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236379->free_mem_231018,
                                  .size =0, .references =NULL};
    struct memblock mem_231019 = {.desc ="mem_231019", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236379->free_mem_231019,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231280 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231280",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236379->free_reduce_stage_1_tid_res_arr_mem_231280,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231282 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231282",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236379->free_reduce_stage_1_tid_res_arr_mem_231282,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231284 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231284",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236379->free_reduce_stage_1_tid_res_arr_mem_231284,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231286 = start;
    double x_231227;
    double x_231228;
    double x_231230;
    double x_231231;
    double x_231233;
    double x_231234;
    double local_acc_231287 = 0.0;
    double local_acc_231288 = 0.0;
    double local_acc_231289 = 0.0;
    
    for (; iter_231286 < end; iter_231286++) {
        int64_t gtid_231226 = iter_231286;
        bool cond_231236 = sle64(n_203572, gtid_231226);
        int64_t defunc_0_f_res_231237;
        
        if (cond_231236) {
            defunc_0_f_res_231237 = (int64_t) 0;
        } else {
            int64_t i_231238 = add64(x_231013, gtid_231226);
            int64_t defunc_1_add_res_231239 = add64((int64_t) 1, i_231238);
            
            defunc_0_f_res_231237 = defunc_1_add_res_231239;
        }
        
        double defunc_0_f_res_231240;
        
        if (cond_231236) {
            defunc_0_f_res_231240 = 0.0;
        } else {
            int64_t i_231241 = add64(x_231013, gtid_231226);
            double defunc_0_add_arg_231242;
            
            defunc_0_add_arg_231242 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_213248 *
                                                   ctx_param_ext_217985 +
                                                   i_231241 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_231240 = defunc_0_add_arg_231242;
        }
        
        int64_t binop_p_231243 = sub64(defunc_0_f_res_231237,
                                       defunc_0_g_res_231017);
        double defunc_0_f_res_231244 = sitofp_i64_f64(binop_p_231243);
        double abs_res_231245 = fabs(defunc_0_f_res_231244);
        double tmp1_231246 = abs_res_231245 / x_231014;
        double x_231247 = tmp1_231246 * tmp1_231246;
        double y_231248 = tmp1_231246 * x_231247;
        double tmp2_231249 = 1.0 - y_231248;
        double x_231250 = tmp2_231249 * tmp2_231249;
        double tmp3_231251 = tmp2_231249 * x_231250;
        double tmp4_231252 = defunc_0_f_res_231240 * tmp3_231251;
        double defunc_1_f_res_231253 = defunc_0_f_res_231244 * tmp4_231252;
        double defunc_1_f_res_231254 = defunc_0_f_res_231244 *
               defunc_1_f_res_231253;
        
        // save map-out results
        {
            ((double *) mem_231018.mem)[gtid_231226] = defunc_1_f_res_231253;
            ((double *) mem_231019.mem)[gtid_231226] = tmp4_231252;
        }
        // Load accum params
        {
            x_231227 = local_acc_231287;
        }
        // Load next params
        {
            x_231228 = tmp4_231252;
        }
        // Red body
        {
            double defunc_1_op_res_231229 = x_231227 + x_231228;
            
            local_acc_231287 = defunc_1_op_res_231229;
        }
        // Load accum params
        {
            x_231230 = local_acc_231288;
        }
        // Load next params
        {
            x_231231 = defunc_1_f_res_231253;
        }
        // Red body
        {
            double defunc_1_op_res_231232 = x_231230 + x_231231;
            
            local_acc_231288 = defunc_1_op_res_231232;
        }
        // Load accum params
        {
            x_231233 = local_acc_231289;
        }
        // Load next params
        {
            x_231234 = defunc_1_f_res_231254;
        }
        // Red body
        {
            double defunc_1_op_res_231235 = x_231233 + x_231234;
            
            local_acc_231289 = defunc_1_op_res_231235;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_231280.mem)[flat_tid_231225] =
        local_acc_231287;
    ((double *) reduce_stage_1_tid_res_arr_mem_231282.mem)[flat_tid_231225] =
        local_acc_231288;
    ((double *) reduce_stage_1_tid_res_arr_mem_231284.mem)[flat_tid_231225] =
        local_acc_231289;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236380_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236380_end -
                 futhark_mc_segred_stage_1_parloop_236380_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236380_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236380_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236380_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236375(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231225 = tid;
    int num_tasks_231279 = info.nsubtasks;
    struct futhark_mc_task_236374 *futhark_mc_task_236374 =
                                  (struct futhark_mc_task_236374 *) args;
    struct futhark_context *ctx = futhark_mc_task_236374->ctx;
    uint64_t futhark_mc_segred_task_236375_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236375_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236374->free_n_203572;
    int64_t gtid_213248 = futhark_mc_task_236374->free_gtid_213248;
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236374->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236374->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236374->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236374->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_231013 = futhark_mc_task_236374->free_x_231013;
    double x_231014 = futhark_mc_task_236374->free_x_231014;
    int64_t defunc_0_g_res_231017 =
            futhark_mc_task_236374->free_defunc_0_g_res_231017;
    double defunc_2_reduce_res_231020 =
           *futhark_mc_task_236374->retval_defunc_2_reduce_res_231020;
    double defunc_2_reduce_res_231021 =
           *futhark_mc_task_236374->retval_defunc_2_reduce_res_231021;
    double defunc_2_reduce_res_231022 =
           *futhark_mc_task_236374->retval_defunc_2_reduce_res_231022;
    struct memblock mem_231018 = {.desc ="mem_231018", .mem =
                                  futhark_mc_task_236374->retval_mem_231018,
                                  .size =0, .references =NULL};
    struct memblock mem_231019 = {.desc ="mem_231019", .mem =
                                  futhark_mc_task_236374->retval_mem_231019,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_231280_cached_sizze_236376 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231280 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231282_cached_sizze_236377 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231282 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231284_cached_sizze_236378 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231284 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_231280_cached_sizze_236376 <
        (size_t) ((int64_t) 8 * num_tasks_231279)) {
        reduce_stage_1_tid_res_arr_mem_231280 =
            realloc(reduce_stage_1_tid_res_arr_mem_231280, (int64_t) 8 *
                    num_tasks_231279);
        reduce_stage_1_tid_res_arr_mem_231280_cached_sizze_236376 =
            (int64_t) 8 * num_tasks_231279;
    }
    if (reduce_stage_1_tid_res_arr_mem_231282_cached_sizze_236377 <
        (size_t) ((int64_t) 8 * num_tasks_231279)) {
        reduce_stage_1_tid_res_arr_mem_231282 =
            realloc(reduce_stage_1_tid_res_arr_mem_231282, (int64_t) 8 *
                    num_tasks_231279);
        reduce_stage_1_tid_res_arr_mem_231282_cached_sizze_236377 =
            (int64_t) 8 * num_tasks_231279;
    }
    if (reduce_stage_1_tid_res_arr_mem_231284_cached_sizze_236378 <
        (size_t) ((int64_t) 8 * num_tasks_231279)) {
        reduce_stage_1_tid_res_arr_mem_231284 =
            realloc(reduce_stage_1_tid_res_arr_mem_231284, (int64_t) 8 *
                    num_tasks_231279);
        reduce_stage_1_tid_res_arr_mem_231284_cached_sizze_236378 =
            (int64_t) 8 * num_tasks_231279;
    }
    
    int64_t iter_231286;
    struct futhark_mc_segred_stage_1_parloop_struct_236379
    futhark_mc_segred_stage_1_parloop_struct_236379;
    
    futhark_mc_segred_stage_1_parloop_struct_236379.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_gtid_213248 =
        gtid_213248;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_x_231013 = x_231013;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_x_231014 = x_231014;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_defunc_0_g_res_231017 =
        defunc_0_g_res_231017;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_mem_231018 =
        mem_231018.mem;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_mem_231019 =
        mem_231019.mem;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_reduce_stage_1_tid_res_arr_mem_231280 =
        reduce_stage_1_tid_res_arr_mem_231280;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_reduce_stage_1_tid_res_arr_mem_231282 =
        reduce_stage_1_tid_res_arr_mem_231282;
    futhark_mc_segred_stage_1_parloop_struct_236379.free_reduce_stage_1_tid_res_arr_mem_231284 =
        reduce_stage_1_tid_res_arr_mem_231284;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236380_task;
    
    futhark_mc_segred_stage_1_parloop_236380_task.name =
        "futhark_mc_segred_stage_1_parloop_236380";
    futhark_mc_segred_stage_1_parloop_236380_task.fn =
        futhark_mc_segred_stage_1_parloop_236380;
    futhark_mc_segred_stage_1_parloop_236380_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236379;
    futhark_mc_segred_stage_1_parloop_236380_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236380_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236380_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236380_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236380_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236380_task);
    
    if (futhark_mc_segred_stage_1_parloop_236380_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236380_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236380_total_end -
                 futhark_mc_segred_stage_1_parloop_236380_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236380_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236380_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236380_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_231020 = 0.0;
        defunc_2_reduce_res_231021 = 0.0;
        defunc_2_reduce_res_231022 = 0.0;
    }
    
    double x_231290;
    double x_231291;
    double x_231293;
    double x_231294;
    double x_231296;
    double x_231297;
    
    for (int32_t i_231299 = 0; i_231299 < num_tasks_231279; i_231299++) {
        flat_tid_231225 = i_231299;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_231290 = defunc_2_reduce_res_231020;
            }
            // load next params
            {
                x_231291 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231280)[flat_tid_231225];
            }
            // red body
            {
                double defunc_1_op_res_231292 = x_231290 + x_231291;
                
                defunc_2_reduce_res_231020 = defunc_1_op_res_231292;
            }
            // load acc params
            {
                x_231293 = defunc_2_reduce_res_231021;
            }
            // load next params
            {
                x_231294 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231282)[flat_tid_231225];
            }
            // red body
            {
                double defunc_1_op_res_231295 = x_231293 + x_231294;
                
                defunc_2_reduce_res_231021 = defunc_1_op_res_231295;
            }
            // load acc params
            {
                x_231296 = defunc_2_reduce_res_231022;
            }
            // load next params
            {
                x_231297 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231284)[flat_tid_231225];
            }
            // red body
            {
                double defunc_1_op_res_231298 = x_231296 + x_231297;
                
                defunc_2_reduce_res_231022 = defunc_1_op_res_231298;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_231280);
        free(reduce_stage_1_tid_res_arr_mem_231282);
        free(reduce_stage_1_tid_res_arr_mem_231284);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236375_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236375_end -
                 futhark_mc_segred_task_236375_start;
        
        ctx->futhark_mc_segred_task_236375_runs[tid]++;
        ctx->futhark_mc_segred_task_236375_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236375_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236374->retval_defunc_2_reduce_res_231020 =
            defunc_2_reduce_res_231020;
        *futhark_mc_task_236374->retval_defunc_2_reduce_res_231021 =
            defunc_2_reduce_res_231021;
        *futhark_mc_task_236374->retval_defunc_2_reduce_res_231022 =
            defunc_2_reduce_res_231022;
        futhark_mc_task_236374->retval_mem_231018 = mem_231018.mem;
        futhark_mc_task_236374->retval_mem_231019 = mem_231019.mem;
    }
    return err;
}
struct futhark_mc_task_236381 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213248;
    unsigned char *free_mem_219411;
    int64_t free_x_231013;
    unsigned char *free_mem_231018;
    unsigned char *free_mem_231019;
    double free_a11_231059;
    double free_b11_231061;
    double free_c11_231062;
    double *retval_defunc_2_reduce_res_231063;
    double *retval_defunc_2_reduce_res_231064;
};
struct futhark_mc_segred_stage_1_parloop_struct_236385 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213248;
    unsigned char *free_mem_219411;
    int64_t free_x_231013;
    unsigned char *free_mem_231018;
    unsigned char *free_mem_231019;
    double free_a11_231059;
    double free_b11_231061;
    double free_c11_231062;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231301;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231303;
};
static int futhark_mc_segred_stage_1_parloop_236386(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_231255,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236385
    *futhark_mc_segred_stage_1_parloop_struct_236385 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236385 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236385->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236386_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236386_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236385->free_n_203572;
    int64_t gtid_213248 =
            futhark_mc_segred_stage_1_parloop_struct_236385->free_gtid_213248;
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236385->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_231013 =
            futhark_mc_segred_stage_1_parloop_struct_236385->free_x_231013;
    struct memblock mem_231018 = {.desc ="mem_231018", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236385->free_mem_231018,
                                  .size =0, .references =NULL};
    struct memblock mem_231019 = {.desc ="mem_231019", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236385->free_mem_231019,
                                  .size =0, .references =NULL};
    double a11_231059 =
           futhark_mc_segred_stage_1_parloop_struct_236385->free_a11_231059;
    double b11_231061 =
           futhark_mc_segred_stage_1_parloop_struct_236385->free_b11_231061;
    double c11_231062 =
           futhark_mc_segred_stage_1_parloop_struct_236385->free_c11_231062;
    struct memblock reduce_stage_1_tid_res_arr_mem_231301 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231301",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236385->free_reduce_stage_1_tid_res_arr_mem_231301,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231303 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231303",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236385->free_reduce_stage_1_tid_res_arr_mem_231303,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231305 = start;
    double x_231257;
    double x_231258;
    double x_231260;
    double x_231261;
    double local_acc_231306 = 0.0;
    double local_acc_231307 = 0.0;
    
    for (; iter_231305 < end; iter_231305++) {
        int64_t gtid_231256 = iter_231305;
        double x_231263;
        
        x_231263 = ((double *) mem_231019.mem)[gtid_231256];
        
        double x_231264;
        
        x_231264 = ((double *) mem_231018.mem)[gtid_231256];
        
        bool cond_231265 = sle64(n_203572, gtid_231256);
        double defunc_0_f_res_231266;
        
        if (cond_231265) {
            defunc_0_f_res_231266 = 0.0;
        } else {
            int64_t i_231267 = add64(x_231013, gtid_231256);
            double defunc_0_add_arg_231268;
            
            defunc_0_add_arg_231268 = ((double *) mem_219411.mem)[gtid_213248 *
                                                                  n_203572 +
                                                                  i_231267];
            defunc_0_f_res_231266 = defunc_0_add_arg_231268;
        }
        
        double x_231269 = a11_231059 * x_231263;
        double y_231270 = b11_231061 * x_231264;
        double x_231271 = x_231269 + y_231270;
        double defunc_9_fit_fun_res_231272 = defunc_0_f_res_231266 * x_231271;
        double x_231273 = b11_231061 * x_231263;
        double y_231274 = c11_231062 * x_231264;
        double x_231275 = x_231273 + y_231274;
        double defunc_9_slope_fun_res_231276 = defunc_0_f_res_231266 * x_231275;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_231257 = local_acc_231306;
        }
        // Load next params
        {
            x_231258 = defunc_9_fit_fun_res_231272;
        }
        // Red body
        {
            double defunc_1_op_res_231259 = x_231257 + x_231258;
            
            local_acc_231306 = defunc_1_op_res_231259;
        }
        // Load accum params
        {
            x_231260 = local_acc_231307;
        }
        // Load next params
        {
            x_231261 = defunc_9_slope_fun_res_231276;
        }
        // Red body
        {
            double defunc_1_op_res_231262 = x_231260 + x_231261;
            
            local_acc_231307 = defunc_1_op_res_231262;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_231301.mem)[flat_tid_231255] =
        local_acc_231306;
    ((double *) reduce_stage_1_tid_res_arr_mem_231303.mem)[flat_tid_231255] =
        local_acc_231307;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236386_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236386_end -
                 futhark_mc_segred_stage_1_parloop_236386_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236386_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236386_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236386_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236382(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231255 = tid;
    int num_tasks_231300 = info.nsubtasks;
    struct futhark_mc_task_236381 *futhark_mc_task_236381 =
                                  (struct futhark_mc_task_236381 *) args;
    struct futhark_context *ctx = futhark_mc_task_236381->ctx;
    uint64_t futhark_mc_segred_task_236382_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236382_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236381->free_n_203572;
    int64_t gtid_213248 = futhark_mc_task_236381->free_gtid_213248;
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236381->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_231013 = futhark_mc_task_236381->free_x_231013;
    struct memblock mem_231018 = {.desc ="mem_231018", .mem =
                                  futhark_mc_task_236381->free_mem_231018,
                                  .size =0, .references =NULL};
    struct memblock mem_231019 = {.desc ="mem_231019", .mem =
                                  futhark_mc_task_236381->free_mem_231019,
                                  .size =0, .references =NULL};
    double a11_231059 = futhark_mc_task_236381->free_a11_231059;
    double b11_231061 = futhark_mc_task_236381->free_b11_231061;
    double c11_231062 = futhark_mc_task_236381->free_c11_231062;
    double defunc_2_reduce_res_231063 =
           *futhark_mc_task_236381->retval_defunc_2_reduce_res_231063;
    double defunc_2_reduce_res_231064 =
           *futhark_mc_task_236381->retval_defunc_2_reduce_res_231064;
    size_t reduce_stage_1_tid_res_arr_mem_231301_cached_sizze_236383 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231301 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231303_cached_sizze_236384 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231303 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_231301_cached_sizze_236383 <
        (size_t) ((int64_t) 8 * num_tasks_231300)) {
        reduce_stage_1_tid_res_arr_mem_231301 =
            realloc(reduce_stage_1_tid_res_arr_mem_231301, (int64_t) 8 *
                    num_tasks_231300);
        reduce_stage_1_tid_res_arr_mem_231301_cached_sizze_236383 =
            (int64_t) 8 * num_tasks_231300;
    }
    if (reduce_stage_1_tid_res_arr_mem_231303_cached_sizze_236384 <
        (size_t) ((int64_t) 8 * num_tasks_231300)) {
        reduce_stage_1_tid_res_arr_mem_231303 =
            realloc(reduce_stage_1_tid_res_arr_mem_231303, (int64_t) 8 *
                    num_tasks_231300);
        reduce_stage_1_tid_res_arr_mem_231303_cached_sizze_236384 =
            (int64_t) 8 * num_tasks_231300;
    }
    
    int64_t iter_231305;
    struct futhark_mc_segred_stage_1_parloop_struct_236385
    futhark_mc_segred_stage_1_parloop_struct_236385;
    
    futhark_mc_segred_stage_1_parloop_struct_236385.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_gtid_213248 =
        gtid_213248;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_mem_219411 =
        mem_219411.mem;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_x_231013 = x_231013;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_mem_231018 =
        mem_231018.mem;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_mem_231019 =
        mem_231019.mem;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_a11_231059 =
        a11_231059;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_b11_231061 =
        b11_231061;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_c11_231062 =
        c11_231062;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_reduce_stage_1_tid_res_arr_mem_231301 =
        reduce_stage_1_tid_res_arr_mem_231301;
    futhark_mc_segred_stage_1_parloop_struct_236385.free_reduce_stage_1_tid_res_arr_mem_231303 =
        reduce_stage_1_tid_res_arr_mem_231303;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236386_task;
    
    futhark_mc_segred_stage_1_parloop_236386_task.name =
        "futhark_mc_segred_stage_1_parloop_236386";
    futhark_mc_segred_stage_1_parloop_236386_task.fn =
        futhark_mc_segred_stage_1_parloop_236386;
    futhark_mc_segred_stage_1_parloop_236386_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236385;
    futhark_mc_segred_stage_1_parloop_236386_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236386_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236386_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236386_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236386_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236386_task);
    
    if (futhark_mc_segred_stage_1_parloop_236386_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236386_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236386_total_end -
                 futhark_mc_segred_stage_1_parloop_236386_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236386_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236386_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236386_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_231063 = 0.0;
        defunc_2_reduce_res_231064 = 0.0;
    }
    
    double x_231308;
    double x_231309;
    double x_231311;
    double x_231312;
    
    for (int32_t i_231314 = 0; i_231314 < num_tasks_231300; i_231314++) {
        flat_tid_231255 = i_231314;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_231308 = defunc_2_reduce_res_231063;
            }
            // load next params
            {
                x_231309 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231301)[flat_tid_231255];
            }
            // red body
            {
                double defunc_1_op_res_231310 = x_231308 + x_231309;
                
                defunc_2_reduce_res_231063 = defunc_1_op_res_231310;
            }
            // load acc params
            {
                x_231311 = defunc_2_reduce_res_231064;
            }
            // load next params
            {
                x_231312 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231303)[flat_tid_231255];
            }
            // red body
            {
                double defunc_1_op_res_231313 = x_231311 + x_231312;
                
                defunc_2_reduce_res_231064 = defunc_1_op_res_231313;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_231301);
        free(reduce_stage_1_tid_res_arr_mem_231303);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236382_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236382_end -
                 futhark_mc_segred_task_236382_start;
        
        ctx->futhark_mc_segred_task_236382_runs[tid]++;
        ctx->futhark_mc_segred_task_236382_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236382_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236381->retval_defunc_2_reduce_res_231063 =
            defunc_2_reduce_res_231063;
        *futhark_mc_task_236381->retval_defunc_2_reduce_res_231064 =
            defunc_2_reduce_res_231064;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236371(void *args, int64_t start,
                                            int64_t end, int flat_tid_231011,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236370
    *futhark_mc_segmap_parloop_struct_236370 =
    (struct futhark_mc_segmap_parloop_struct_236370 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236370->ctx;
    uint64_t futhark_mc_segmap_parloop_236371_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236371_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236370->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236370->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236370->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236370->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236370->free_i_203760;
    int64_t gtid_213248 =
            futhark_mc_segmap_parloop_struct_236370->free_gtid_213248;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236370->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236370->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236370->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236370->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236370->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236370->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236370->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219590 =
            futhark_mc_segmap_parloop_struct_236370->free_bytes_219590;
    struct memblock mem_219627 = {.desc ="mem_219627", .mem =
                                  futhark_mc_segmap_parloop_struct_236370->free_mem_219627,
                                  .size =0, .references =NULL};
    struct memblock mem_219630 = {.desc ="mem_219630", .mem =
                                  futhark_mc_segmap_parloop_struct_236370->free_mem_219630,
                                  .size =0, .references =NULL};
    size_t mem_231018_cached_sizze_236372 = 0;
    unsigned char *mem_231018 = NULL;
    size_t mem_231019_cached_sizze_236373 = 0;
    unsigned char *mem_231019 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231224 = start;
    
    if (mem_231018_cached_sizze_236372 < (size_t) bytes_219590) {
        mem_231018 = realloc(mem_231018, bytes_219590);
        mem_231018_cached_sizze_236372 = bytes_219590;
    }
    if (mem_231019_cached_sizze_236373 < (size_t) bytes_219590) {
        mem_231019 = realloc(mem_231019, bytes_219590);
        mem_231019_cached_sizze_236373 = bytes_219590;
    }
    for (; iter_231224 < end; iter_231224++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231277 = l_n_m_203733;
        int64_t gtid_231012 = iter_231224;
        int64_t remnant_231278 = iter_231224 - gtid_231012;
        int64_t x_231013;
        
        x_231013 = ((int64_t *) mem_217891.mem)[gtid_213248 * l_n_m_203733 +
                                                gtid_231012];
        
        double x_231014;
        
        x_231014 = ((double *) mem_217895.mem)[gtid_213248 * l_n_m_203733 +
                                               gtid_231012];
        
        int64_t min_arg_231015 = mul64(jump_t_203582, gtid_231012);
        int64_t min_res_231016 = smin64(i_203760, min_arg_231015);
        int64_t defunc_0_g_res_231017 = add64((int64_t) 1, min_res_231016);
        double defunc_2_reduce_res_231020;
        double defunc_2_reduce_res_231021;
        double defunc_2_reduce_res_231022;
        int64_t flat_tid_231225 = (int64_t) 0;
        int32_t num_tasks_231279;
        
        defunc_2_reduce_res_231020 = 0.0;
        defunc_2_reduce_res_231021 = 0.0;
        defunc_2_reduce_res_231022 = 0.0;
        
        struct futhark_mc_task_236374 futhark_mc_task_236374;
        
        futhark_mc_task_236374.ctx = ctx;
        futhark_mc_task_236374.free_n_203572 = n_203572;
        futhark_mc_task_236374.free_gtid_213248 = gtid_213248;
        futhark_mc_task_236374.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236374.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236374.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236374.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236374.free_x_231013 = x_231013;
        futhark_mc_task_236374.free_x_231014 = x_231014;
        futhark_mc_task_236374.free_defunc_0_g_res_231017 =
            defunc_0_g_res_231017;
        futhark_mc_task_236374.retval_defunc_2_reduce_res_231020 =
            &defunc_2_reduce_res_231020;
        futhark_mc_task_236374.retval_defunc_2_reduce_res_231021 =
            &defunc_2_reduce_res_231021;
        futhark_mc_task_236374.retval_defunc_2_reduce_res_231022 =
            &defunc_2_reduce_res_231022;
        futhark_mc_task_236374.retval_mem_231018 = mem_231018;
        futhark_mc_task_236374.retval_mem_231019 = mem_231019;
        
        struct scheduler_segop futhark_mc_task_236374_task;
        
        futhark_mc_task_236374_task.args = &futhark_mc_task_236374;
        futhark_mc_task_236374_task.top_level_fn =
            futhark_mc_segred_task_236375;
        futhark_mc_task_236374_task.name = "futhark_mc_segred_task_236375";
        futhark_mc_task_236374_task.iterations = q_l_203577;
        futhark_mc_task_236374_task.task_time =
            &ctx->futhark_mc_segred_task_236375_total_time;
        futhark_mc_task_236374_task.task_iter =
            &ctx->futhark_mc_segred_task_236375_total_iter;
        futhark_mc_task_236374_task.sched = STATIC;
        futhark_mc_task_236374_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236375_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236374_task);
        
        if (futhark_mc_segred_task_236375_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_231055 = defunc_2_reduce_res_231020 *
               defunc_2_reduce_res_231022;
        double y_231056 = defunc_2_reduce_res_231021 *
               defunc_2_reduce_res_231021;
        double y_231057 = x_231055 - y_231056;
        double det1_231058 = 1.0 / y_231057;
        double a11_231059 = defunc_2_reduce_res_231022 * det1_231058;
        double x_231060 = 0.0 - defunc_2_reduce_res_231021;
        double b11_231061 = det1_231058 * x_231060;
        double c11_231062 = defunc_2_reduce_res_231020 * det1_231058;
        double defunc_2_reduce_res_231063;
        double defunc_2_reduce_res_231064;
        int64_t flat_tid_231255 = (int64_t) 0;
        int32_t num_tasks_231300;
        
        defunc_2_reduce_res_231063 = 0.0;
        defunc_2_reduce_res_231064 = 0.0;
        
        struct futhark_mc_task_236381 futhark_mc_task_236381;
        
        futhark_mc_task_236381.ctx = ctx;
        futhark_mc_task_236381.free_n_203572 = n_203572;
        futhark_mc_task_236381.free_gtid_213248 = gtid_213248;
        futhark_mc_task_236381.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236381.free_x_231013 = x_231013;
        futhark_mc_task_236381.free_mem_231018 = mem_231018;
        futhark_mc_task_236381.free_mem_231019 = mem_231019;
        futhark_mc_task_236381.free_a11_231059 = a11_231059;
        futhark_mc_task_236381.free_b11_231061 = b11_231061;
        futhark_mc_task_236381.free_c11_231062 = c11_231062;
        futhark_mc_task_236381.retval_defunc_2_reduce_res_231063 =
            &defunc_2_reduce_res_231063;
        futhark_mc_task_236381.retval_defunc_2_reduce_res_231064 =
            &defunc_2_reduce_res_231064;
        
        struct scheduler_segop futhark_mc_task_236381_task;
        
        futhark_mc_task_236381_task.args = &futhark_mc_task_236381;
        futhark_mc_task_236381_task.top_level_fn =
            futhark_mc_segred_task_236382;
        futhark_mc_task_236381_task.name = "futhark_mc_segred_task_236382";
        futhark_mc_task_236381_task.iterations = q_l_203577;
        futhark_mc_task_236381_task.task_time =
            &ctx->futhark_mc_segred_task_236382_total_time;
        futhark_mc_task_236381_task.task_iter =
            &ctx->futhark_mc_segred_task_236382_total_iter;
        futhark_mc_task_236381_task.sched = STATIC;
        futhark_mc_task_236381_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236382_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236381_task);
        
        if (futhark_mc_segred_task_236382_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219627.mem)[gtid_231012] = defunc_2_reduce_res_231063;
        ((double *) mem_219630.mem)[gtid_231012] = defunc_2_reduce_res_231064;
    }
    
  cleanup:
    { }
    free(mem_231018);
    free(mem_231019);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236371_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236371_end -
                 futhark_mc_segmap_parloop_236371_start;
        
        ctx->futhark_mc_segmap_parloop_236371_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236371_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236371_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236369(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231011 = tid;
    int num_tasks_231164 = info.nsubtasks;
    struct futhark_mc_task_236363 *futhark_mc_task_236363 =
                                  (struct futhark_mc_task_236363 *) args;
    struct futhark_context *ctx = futhark_mc_task_236363->ctx;
    uint64_t futhark_mc_segmap_nested_task_236369_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236369_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236363->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236363->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236363->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236363->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236363->free_i_203760;
    int64_t gtid_213248 = futhark_mc_task_236363->free_gtid_213248;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236363->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236363->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236363->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236363->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236363->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236363->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236363->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219590 = futhark_mc_task_236363->free_bytes_219590;
    struct memblock mem_219627 = {.desc ="mem_219627", .mem =
                                  futhark_mc_task_236363->free_mem_219627,
                                  .size =0, .references =NULL};
    struct memblock mem_219630 = {.desc ="mem_219630", .mem =
                                  futhark_mc_task_236363->free_mem_219630,
                                  .size =0, .references =NULL};
    int64_t iter_231224;
    struct futhark_mc_segmap_parloop_struct_236370
    futhark_mc_segmap_parloop_struct_236370;
    
    futhark_mc_segmap_parloop_struct_236370.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236370.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236370.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236370.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236370.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236370.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236370.free_gtid_213248 = gtid_213248;
    futhark_mc_segmap_parloop_struct_236370.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236370.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236370.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236370.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236370.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236370.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236370.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236370.free_bytes_219590 = bytes_219590;
    futhark_mc_segmap_parloop_struct_236370.free_mem_219627 = mem_219627.mem;
    futhark_mc_segmap_parloop_struct_236370.free_mem_219630 = mem_219630.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236371_task;
    
    futhark_mc_segmap_parloop_236371_task.name =
        "futhark_mc_segmap_parloop_236371";
    futhark_mc_segmap_parloop_236371_task.fn = futhark_mc_segmap_parloop_236371;
    futhark_mc_segmap_parloop_236371_task.args =
        &futhark_mc_segmap_parloop_struct_236370;
    futhark_mc_segmap_parloop_236371_task.iterations = iterations;
    futhark_mc_segmap_parloop_236371_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236371_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236371_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236371_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236371_task);
    
    if (futhark_mc_segmap_parloop_236371_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236371_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236371_total_end -
                 futhark_mc_segmap_parloop_236371_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236371_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236371_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236371_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236369_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236369_end -
                 futhark_mc_segmap_nested_task_236369_start;
        
        ctx->futhark_mc_segmap_nested_task_236369_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236369_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236369_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236360(void *args, int64_t start,
                                            int64_t end, int flat_tid_213247,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236359
    *futhark_mc_segmap_parloop_struct_236359 =
    (struct futhark_mc_segmap_parloop_struct_236359 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236359->ctx;
    uint64_t futhark_mc_segmap_parloop_236360_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236360_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236359->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236359->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236359->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236359->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236359->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236359->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236359->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236359->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236359->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236359->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236359->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236359->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236359->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236359->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219590 =
            futhark_mc_segmap_parloop_struct_236359->free_bytes_219590;
    struct memblock mem_219694 = {.desc ="mem_219694", .mem =
                                  futhark_mc_segmap_parloop_struct_236359->free_mem_219694,
                                  .size =0, .references =NULL};
    struct memblock mem_219698 = {.desc ="mem_219698", .mem =
                                  futhark_mc_segmap_parloop_struct_236359->free_mem_219698,
                                  .size =0, .references =NULL};
    size_t mem_219627_cached_sizze_236361 = 0;
    unsigned char *mem_219627 = NULL;
    size_t mem_219630_cached_sizze_236362 = 0;
    unsigned char *mem_219630 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231010 = start;
    
    if (mem_219627_cached_sizze_236361 < (size_t) bytes_217838) {
        mem_219627 = realloc(mem_219627, bytes_217838);
        mem_219627_cached_sizze_236361 = bytes_217838;
    }
    if (mem_219630_cached_sizze_236362 < (size_t) bytes_217838) {
        mem_219630 = realloc(mem_219630, bytes_217838);
        mem_219630_cached_sizze_236362 = bytes_217838;
    }
    for (; iter_231010 < end; iter_231010++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231162 = partition_sizze_203667;
        int64_t gtid_213248 = iter_231010;
        int64_t remnant_231163 = iter_231010 - gtid_213248;
        int64_t flat_tid_231087 = (int64_t) 0;
        int32_t num_tasks_231164;
        int64_t flat_tid_231011 = (int64_t) 0;
        struct futhark_mc_task_236363 futhark_mc_task_236363;
        
        futhark_mc_task_236363.ctx = ctx;
        futhark_mc_task_236363.free_n_203572 = n_203572;
        futhark_mc_task_236363.free_q_l_203577 = q_l_203577;
        futhark_mc_task_236363.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236363.free_l_n_m_203733 = l_n_m_203733;
        futhark_mc_task_236363.free_i_203760 = i_203760;
        futhark_mc_task_236363.free_gtid_213248 = gtid_213248;
        futhark_mc_task_236363.free_mem_217891 = mem_217891.mem;
        futhark_mc_task_236363.free_mem_217895 = mem_217895.mem;
        futhark_mc_task_236363.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236363.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236363.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236363.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236363.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236363.free_bytes_219590 = bytes_219590;
        futhark_mc_task_236363.free_mem_219627 = mem_219627;
        futhark_mc_task_236363.free_mem_219630 = mem_219630;
        
        struct scheduler_segop futhark_mc_task_236363_task;
        
        futhark_mc_task_236363_task.args = &futhark_mc_task_236363;
        futhark_mc_task_236363_task.top_level_fn =
            futhark_mc_segmap_task_236364;
        futhark_mc_task_236363_task.name = "futhark_mc_segmap_task_236364";
        futhark_mc_task_236363_task.iterations = l_n_m_203733;
        futhark_mc_task_236363_task.task_time =
            &ctx->futhark_mc_segmap_task_236364_total_time;
        futhark_mc_task_236363_task.task_iter =
            &ctx->futhark_mc_segmap_task_236364_total_iter;
        futhark_mc_task_236363_task.sched = STATIC;
        futhark_mc_task_236363_task.nested_fn =
            futhark_mc_segmap_nested_task_236369;
        
        int futhark_mc_segmap_task_236364_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236363_task);
        
        if (futhark_mc_segmap_task_236364_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219694.mem + gtid_213248 * l_n_m_203733 * (int64_t) 8,
                    mem_219627 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219698.mem + gtid_213248 * l_n_m_203733 * (int64_t) 8,
                    mem_219630 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219627);
    free(mem_219630);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236360_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236360_end -
                 futhark_mc_segmap_parloop_236360_start;
        
        ctx->futhark_mc_segmap_parloop_236360_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236360_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236360_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236358(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213247 = tid;
    int num_tasks_230921 = info.nsubtasks;
    struct futhark_mc_task_236350 *futhark_mc_task_236350 =
                                  (struct futhark_mc_task_236350 *) args;
    struct futhark_context *ctx = futhark_mc_task_236350->ctx;
    uint64_t futhark_mc_segmap_nested_task_236358_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236358_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236350->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236350->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236350->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236350->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236350->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236350->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236350->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236350->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236350->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236350->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236350->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236350->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236350->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236350->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219590 = futhark_mc_task_236350->free_bytes_219590;
    struct memblock mem_219694 = {.desc ="mem_219694", .mem =
                                  futhark_mc_task_236350->free_mem_219694,
                                  .size =0, .references =NULL};
    struct memblock mem_219698 = {.desc ="mem_219698", .mem =
                                  futhark_mc_task_236350->free_mem_219698,
                                  .size =0, .references =NULL};
    int64_t iter_231010;
    struct futhark_mc_segmap_parloop_struct_236359
    futhark_mc_segmap_parloop_struct_236359;
    
    futhark_mc_segmap_parloop_struct_236359.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236359.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236359.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236359.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236359.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236359.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236359.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236359.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236359.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236359.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236359.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236359.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236359.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236359.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236359.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236359.free_bytes_219590 = bytes_219590;
    futhark_mc_segmap_parloop_struct_236359.free_mem_219694 = mem_219694.mem;
    futhark_mc_segmap_parloop_struct_236359.free_mem_219698 = mem_219698.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236360_task;
    
    futhark_mc_segmap_parloop_236360_task.name =
        "futhark_mc_segmap_parloop_236360";
    futhark_mc_segmap_parloop_236360_task.fn = futhark_mc_segmap_parloop_236360;
    futhark_mc_segmap_parloop_236360_task.args =
        &futhark_mc_segmap_parloop_struct_236359;
    futhark_mc_segmap_parloop_236360_task.iterations = iterations;
    futhark_mc_segmap_parloop_236360_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236360_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236360_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236360_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236360_task);
    
    if (futhark_mc_segmap_parloop_236360_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236360_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236360_total_end -
                 futhark_mc_segmap_parloop_236360_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236360_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236360_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236360_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236358_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236358_end -
                 futhark_mc_segmap_nested_task_236358_start;
        
        ctx->futhark_mc_segmap_nested_task_236358_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236358_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236358_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236387 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219700;
    unsigned char *free_mem_219870;
    unsigned char *free_mem_219874;
};
struct futhark_mc_segmap_parloop_struct_236389 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219700;
    unsigned char *free_mem_219870;
    unsigned char *free_mem_219874;
};
static int futhark_mc_segmap_parloop_236390(void *args, int64_t start,
                                            int64_t end, int flat_tid_213405,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236389->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236389->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236389->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236389->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236389->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236389->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236389->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236389->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236389->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236389->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236389->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236389->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236389->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236389->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219700 =
            futhark_mc_segmap_parloop_struct_236389->free_bytes_219700;
    struct memblock mem_219870 = {.desc ="mem_219870", .mem =
                                  futhark_mc_segmap_parloop_struct_236389->free_mem_219870,
                                  .size =0, .references =NULL};
    struct memblock mem_219874 = {.desc ="mem_219874", .mem =
                                  futhark_mc_segmap_parloop_struct_236389->free_mem_219874,
                                  .size =0, .references =NULL};
    size_t mem_219779_cached_sizze_236391 = 0;
    unsigned char *mem_219779 = NULL;
    size_t mem_219782_cached_sizze_236392 = 0;
    unsigned char *mem_219782 = NULL;
    size_t mem_219799_cached_sizze_236393 = 0;
    unsigned char *mem_219799 = NULL;
    size_t mem_219802_cached_sizze_236394 = 0;
    unsigned char *mem_219802 = NULL;
    size_t mem_219829_cached_sizze_236395 = 0;
    unsigned char *mem_219829 = NULL;
    size_t mem_219832_cached_sizze_236396 = 0;
    unsigned char *mem_219832 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231316 = start;
    
    if (mem_219779_cached_sizze_236391 < (size_t) bytes_217838) {
        mem_219779 = realloc(mem_219779, bytes_217838);
        mem_219779_cached_sizze_236391 = bytes_217838;
    }
    if (mem_219782_cached_sizze_236392 < (size_t) bytes_217838) {
        mem_219782 = realloc(mem_219782, bytes_217838);
        mem_219782_cached_sizze_236392 = bytes_217838;
    }
    if (mem_219799_cached_sizze_236393 < (size_t) bytes_219700) {
        mem_219799 = realloc(mem_219799, bytes_219700);
        mem_219799_cached_sizze_236393 = bytes_219700;
    }
    if (mem_219802_cached_sizze_236394 < (size_t) bytes_219700) {
        mem_219802 = realloc(mem_219802, bytes_219700);
        mem_219802_cached_sizze_236394 = bytes_219700;
    }
    if (mem_219829_cached_sizze_236395 < (size_t) bytes_219700) {
        mem_219829 = realloc(mem_219829, bytes_219700);
        mem_219829_cached_sizze_236395 = bytes_219700;
    }
    if (mem_219832_cached_sizze_236396 < (size_t) bytes_219700) {
        mem_219832 = realloc(mem_219832, bytes_219700);
        mem_219832_cached_sizze_236396 = bytes_219700;
    }
    for (; iter_231316 < end; iter_231316++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231434 = partition_sizze_203667;
        int64_t gtid_213406 = iter_231316;
        int64_t remnant_231435 = iter_231316 - gtid_213406;
        
        for (int64_t i_231317 = 0; i_231317 < l_n_m_203733; i_231317++) {
            int64_t x_231320;
            
            x_231320 = ((int64_t *) mem_217891.mem)[gtid_213406 * l_n_m_203733 +
                                                    i_231317];
            
            double x_231321;
            
            x_231321 = ((double *) mem_217895.mem)[gtid_213406 * l_n_m_203733 +
                                                   i_231317];
            
            int64_t min_arg_231322 = mul64(jump_t_203582, i_231317);
            int64_t min_res_231323 = smin64(i_203760, min_arg_231322);
            int64_t defunc_0_g_res_231324 = add64((int64_t) 1, min_res_231323);
            
            for (int64_t i_231329 = 0; i_231329 < q_l_203577; i_231329++) {
                bool cond_231332 = sle64(n_203572, i_231329);
                int64_t defunc_0_f_res_231333;
                
                if (cond_231332) {
                    defunc_0_f_res_231333 = (int64_t) 0;
                } else {
                    int64_t i_231334 = add64(x_231320, i_231329);
                    int64_t defunc_1_add_res_231335 = add64((int64_t) 1,
                                                            i_231334);
                    
                    defunc_0_f_res_231333 = defunc_1_add_res_231335;
                }
                
                double defunc_0_f_res_231336;
                
                if (cond_231332) {
                    defunc_0_f_res_231336 = 0.0;
                } else {
                    int64_t i_231337 = add64(x_231320, i_231329);
                    double defunc_0_add_arg_231338;
                    
                    defunc_0_add_arg_231338 =
                        ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                          (gtid_213406 *
                                                           ctx_param_ext_217985 +
                                                           i_231337 *
                                                           ctx_param_ext_217987)];
                    defunc_0_f_res_231336 = defunc_0_add_arg_231338;
                }
                
                int64_t binop_p_231339 = sub64(defunc_0_f_res_231333,
                                               defunc_0_g_res_231324);
                double defunc_0_f_res_231340 = sitofp_i64_f64(binop_p_231339);
                double abs_res_231341 = fabs(defunc_0_f_res_231340);
                double tmp1_231342 = abs_res_231341 / x_231321;
                double x_231343 = tmp1_231342 * tmp1_231342;
                double y_231344 = tmp1_231342 * x_231343;
                double tmp2_231345 = 1.0 - y_231344;
                double x_231346 = tmp2_231345 * tmp2_231345;
                double tmp3_231347 = tmp2_231345 * x_231346;
                double tmp4_231348 = defunc_0_f_res_231336 * tmp3_231347;
                
                ((double *) mem_219799)[i_231329] = defunc_0_f_res_231340;
                ((double *) mem_219802)[i_231329] = tmp4_231348;
            }
            
            double defunc_2_reduce_res_231353;
            double defunc_2_reduce_res_231354;
            double defunc_2_reduce_res_231355;
            double defunc_2_reduce_res_231356;
            double defunc_2_reduce_res_231357;
            double redout_231361;
            double redout_231362;
            double redout_231363;
            double redout_231364;
            double redout_231365;
            
            redout_231361 = 0.0;
            redout_231362 = 0.0;
            redout_231363 = 0.0;
            redout_231364 = 0.0;
            redout_231365 = 0.0;
            for (int64_t i_231360 = 0; i_231360 < q_l_203577; i_231360++) {
                double x_231368;
                
                x_231368 = ((double *) mem_219799)[i_231360];
                
                double x_231369;
                
                x_231369 = ((double *) mem_219802)[i_231360];
                
                double defunc_1_f_res_231370 = x_231368 * x_231369;
                double defunc_1_f_res_231371 = x_231368 * defunc_1_f_res_231370;
                double defunc_1_f_res_231372 = x_231368 * defunc_1_f_res_231371;
                double defunc_1_f_res_231373 = x_231368 * defunc_1_f_res_231372;
                double defunc_1_op_res_231374 = x_231369 + redout_231361;
                double defunc_1_op_res_231375 = defunc_1_f_res_231370 +
                       redout_231362;
                double defunc_1_op_res_231376 = defunc_1_f_res_231371 +
                       redout_231363;
                double defunc_1_op_res_231377 = defunc_1_f_res_231372 +
                       redout_231364;
                double defunc_1_op_res_231378 = defunc_1_f_res_231373 +
                       redout_231365;
                
                ((double *) mem_219829)[i_231360] = defunc_1_f_res_231371;
                ((double *) mem_219832)[i_231360] = defunc_1_f_res_231370;
                
                double redout_tmp_231440 = defunc_1_op_res_231374;
                double redout_tmp_231441 = defunc_1_op_res_231375;
                double redout_tmp_231442 = defunc_1_op_res_231376;
                double redout_tmp_231443 = defunc_1_op_res_231377;
                double redout_tmp_231444 = defunc_1_op_res_231378;
                
                redout_231361 = redout_tmp_231440;
                redout_231362 = redout_tmp_231441;
                redout_231363 = redout_tmp_231442;
                redout_231364 = redout_tmp_231443;
                redout_231365 = redout_tmp_231444;
            }
            defunc_2_reduce_res_231353 = redout_231361;
            defunc_2_reduce_res_231354 = redout_231362;
            defunc_2_reduce_res_231355 = redout_231363;
            defunc_2_reduce_res_231356 = redout_231364;
            defunc_2_reduce_res_231357 = redout_231365;
            
            double x_231381 = defunc_2_reduce_res_231355 *
                   defunc_2_reduce_res_231357;
            double y_231382 = defunc_2_reduce_res_231356 *
                   defunc_2_reduce_res_231356;
            double a12_231383 = x_231381 - y_231382;
            double x_231384 = defunc_2_reduce_res_231355 *
                   defunc_2_reduce_res_231356;
            double y_231385 = defunc_2_reduce_res_231354 *
                   defunc_2_reduce_res_231357;
            double b12_231386 = x_231384 - y_231385;
            double x_231387 = defunc_2_reduce_res_231354 *
                   defunc_2_reduce_res_231356;
            double y_231388 = defunc_2_reduce_res_231355 *
                   defunc_2_reduce_res_231355;
            double c12_231389 = x_231387 - y_231388;
            double x_231390 = defunc_2_reduce_res_231353 *
                   defunc_2_reduce_res_231357;
            double b2_231391 = x_231390 - y_231388;
            double x_231392 = defunc_2_reduce_res_231354 *
                   defunc_2_reduce_res_231355;
            double y_231393 = defunc_2_reduce_res_231353 *
                   defunc_2_reduce_res_231356;
            double c2_231394 = x_231392 - y_231393;
            double x_231395 = defunc_2_reduce_res_231353 * a12_231383;
            double y_231396 = defunc_2_reduce_res_231354 * b12_231386;
            double x_231397 = x_231395 + y_231396;
            double y_231398 = defunc_2_reduce_res_231355 * c12_231389;
            double y_231399 = x_231397 + y_231398;
            double det_231400 = 1.0 / y_231399;
            double a12_231401 = a12_231383 * det_231400;
            double b12_231402 = b12_231386 * det_231400;
            double c12_231403 = c12_231389 * det_231400;
            double b2_231404 = b2_231391 * det_231400;
            double c2_231405 = c2_231394 * det_231400;
            double defunc_2_reduce_res_231406;
            double defunc_2_reduce_res_231407;
            double redout_231409;
            double redout_231410;
            
            redout_231409 = 0.0;
            redout_231410 = 0.0;
            for (int64_t i_231408 = 0; i_231408 < q_l_203577; i_231408++) {
                double x_231411;
                
                x_231411 = ((double *) mem_219802)[i_231408];
                
                double x_231412;
                
                x_231412 = ((double *) mem_219832)[i_231408];
                
                double x_231413;
                
                x_231413 = ((double *) mem_219829)[i_231408];
                
                bool cond_231414 = sle64(n_203572, i_231408);
                double defunc_0_f_res_231415;
                
                if (cond_231414) {
                    defunc_0_f_res_231415 = 0.0;
                } else {
                    int64_t i_231416 = add64(x_231320, i_231408);
                    double defunc_0_add_arg_231417;
                    
                    defunc_0_add_arg_231417 =
                        ((double *) mem_219411.mem)[gtid_213406 * n_203572 +
                                                    i_231416];
                    defunc_0_f_res_231415 = defunc_0_add_arg_231417;
                }
                
                double x_231418 = a12_231401 * x_231411;
                double y_231419 = b12_231402 * x_231412;
                double x_231420 = x_231418 + y_231419;
                double y_231421 = c12_231403 * x_231413;
                double x_231422 = x_231420 + y_231421;
                double defunc_9_fit_fun_res_231423 = defunc_0_f_res_231415 *
                       x_231422;
                double x_231424 = b12_231402 * x_231411;
                double y_231425 = b2_231404 * x_231412;
                double x_231426 = x_231424 + y_231425;
                double y_231427 = c2_231405 * x_231413;
                double x_231428 = x_231426 + y_231427;
                double defunc_9_slope_fun_res_231429 = defunc_0_f_res_231415 *
                       x_231428;
                double defunc_1_op_res_231430 = defunc_9_fit_fun_res_231423 +
                       redout_231409;
                double defunc_1_op_res_231431 = defunc_9_slope_fun_res_231429 +
                       redout_231410;
                double redout_tmp_231447 = defunc_1_op_res_231430;
                double redout_tmp_231448 = defunc_1_op_res_231431;
                
                redout_231409 = redout_tmp_231447;
                redout_231410 = redout_tmp_231448;
            }
            defunc_2_reduce_res_231406 = redout_231409;
            defunc_2_reduce_res_231407 = redout_231410;
            ((double *) mem_219779)[i_231317] = defunc_2_reduce_res_231406;
            ((double *) mem_219782)[i_231317] = defunc_2_reduce_res_231407;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219870.mem + gtid_213406 * l_n_m_203733 * (int64_t) 8,
                    mem_219779 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219874.mem + gtid_213406 * l_n_m_203733 * (int64_t) 8,
                    mem_219782 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219779);
    free(mem_219782);
    free(mem_219799);
    free(mem_219802);
    free(mem_219829);
    free(mem_219832);
    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_213405 = tid;
    int num_tasks_231315 = 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_203572 = futhark_mc_task_236387->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236387->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236387->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236387->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236387->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236387->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236387->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236387->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236387->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236387->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236387->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236387->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236387->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236387->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219700 = futhark_mc_task_236387->free_bytes_219700;
    struct memblock mem_219870 = {.desc ="mem_219870", .mem =
                                  futhark_mc_task_236387->free_mem_219870,
                                  .size =0, .references =NULL};
    struct memblock mem_219874 = {.desc ="mem_219874", .mem =
                                  futhark_mc_task_236387->free_mem_219874,
                                  .size =0, .references =NULL};
    int64_t iter_231316;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236389.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236389.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236389.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236389.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236389.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236389.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236389.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236389.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236389.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236389.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236389.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236389.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236389.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236389.free_bytes_219700 = bytes_219700;
    futhark_mc_segmap_parloop_struct_236389.free_mem_219870 = mem_219870.mem;
    futhark_mc_segmap_parloop_struct_236389.free_mem_219874 = mem_219874.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_segmap_parloop_struct_236398 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_bytes_217838;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219700;
    unsigned char *free_mem_219870;
    unsigned char *free_mem_219874;
};
struct futhark_mc_task_236402 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_213535;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219700;
    unsigned char *free_mem_219773;
    unsigned char *free_mem_219776;
};
struct futhark_mc_segmap_parloop_struct_236404 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_213535;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219700;
    unsigned char *free_mem_219773;
    unsigned char *free_mem_219776;
};
static int futhark_mc_segmap_parloop_236405(void *args, int64_t start,
                                            int64_t end, int flat_tid_231566,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236404
    *futhark_mc_segmap_parloop_struct_236404 =
    (struct futhark_mc_segmap_parloop_struct_236404 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236404->ctx;
    uint64_t futhark_mc_segmap_parloop_236405_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236405_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236404->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236404->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236404->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236404->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236404->free_i_203760;
    int64_t gtid_213535 =
            futhark_mc_segmap_parloop_struct_236404->free_gtid_213535;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236404->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236404->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236404->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236404->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236404->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236404->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236404->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219700 =
            futhark_mc_segmap_parloop_struct_236404->free_bytes_219700;
    struct memblock mem_219773 = {.desc ="mem_219773", .mem =
                                  futhark_mc_segmap_parloop_struct_236404->free_mem_219773,
                                  .size =0, .references =NULL};
    struct memblock mem_219776 = {.desc ="mem_219776", .mem =
                                  futhark_mc_segmap_parloop_struct_236404->free_mem_219776,
                                  .size =0, .references =NULL};
    size_t mem_231573_cached_sizze_236406 = 0;
    unsigned char *mem_231573 = NULL;
    size_t mem_231575_cached_sizze_236407 = 0;
    unsigned char *mem_231575 = NULL;
    size_t mem_231601_cached_sizze_236408 = 0;
    unsigned char *mem_231601 = NULL;
    size_t mem_231603_cached_sizze_236409 = 0;
    unsigned char *mem_231603 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231687 = start;
    
    if (mem_231573_cached_sizze_236406 < (size_t) bytes_219700) {
        mem_231573 = realloc(mem_231573, bytes_219700);
        mem_231573_cached_sizze_236406 = bytes_219700;
    }
    if (mem_231575_cached_sizze_236407 < (size_t) bytes_219700) {
        mem_231575 = realloc(mem_231575, bytes_219700);
        mem_231575_cached_sizze_236407 = bytes_219700;
    }
    if (mem_231601_cached_sizze_236408 < (size_t) bytes_219700) {
        mem_231601 = realloc(mem_231601, bytes_219700);
        mem_231601_cached_sizze_236408 = bytes_219700;
    }
    if (mem_231603_cached_sizze_236409 < (size_t) bytes_219700) {
        mem_231603 = realloc(mem_231603, bytes_219700);
        mem_231603_cached_sizze_236409 = bytes_219700;
    }
    for (; iter_231687 < end; iter_231687++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231755 = l_n_m_203733;
        int64_t gtid_231567 = iter_231687;
        int64_t remnant_231756 = iter_231687 - gtid_231567;
        int64_t x_231568;
        
        x_231568 = ((int64_t *) mem_217891.mem)[gtid_213535 * l_n_m_203733 +
                                                gtid_231567];
        
        double x_231569;
        
        x_231569 = ((double *) mem_217895.mem)[gtid_213535 * l_n_m_203733 +
                                               gtid_231567];
        
        int64_t min_arg_231570 = mul64(jump_t_203582, gtid_231567);
        int64_t min_res_231571 = smin64(i_203760, min_arg_231570);
        int64_t defunc_0_g_res_231572 = add64((int64_t) 1, min_res_231571);
        
        for (int64_t i_231688 = 0; i_231688 < q_l_203577; i_231688++) {
            bool cond_231691 = sle64(n_203572, i_231688);
            int64_t defunc_0_f_res_231692;
            
            if (cond_231691) {
                defunc_0_f_res_231692 = (int64_t) 0;
            } else {
                int64_t i_231693 = add64(x_231568, i_231688);
                int64_t defunc_1_add_res_231694 = add64((int64_t) 1, i_231693);
                
                defunc_0_f_res_231692 = defunc_1_add_res_231694;
            }
            
            double defunc_0_f_res_231695;
            
            if (cond_231691) {
                defunc_0_f_res_231695 = 0.0;
            } else {
                int64_t i_231696 = add64(x_231568, i_231688);
                double defunc_0_add_arg_231697;
                
                defunc_0_add_arg_231697 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_213535 *
                                                       ctx_param_ext_217985 +
                                                       i_231696 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_231695 = defunc_0_add_arg_231697;
            }
            
            int64_t binop_p_231698 = sub64(defunc_0_f_res_231692,
                                           defunc_0_g_res_231572);
            double defunc_0_f_res_231699 = sitofp_i64_f64(binop_p_231698);
            double abs_res_231700 = fabs(defunc_0_f_res_231699);
            double tmp1_231701 = abs_res_231700 / x_231569;
            double x_231702 = tmp1_231701 * tmp1_231701;
            double y_231703 = tmp1_231701 * x_231702;
            double tmp2_231704 = 1.0 - y_231703;
            double x_231705 = tmp2_231704 * tmp2_231704;
            double tmp3_231706 = tmp2_231704 * x_231705;
            double tmp4_231707 = defunc_0_f_res_231695 * tmp3_231706;
            
            ((double *) mem_231573)[i_231688] = defunc_0_f_res_231699;
            ((double *) mem_231575)[i_231688] = tmp4_231707;
        }
        
        double defunc_2_reduce_res_231605;
        double defunc_2_reduce_res_231606;
        double defunc_2_reduce_res_231607;
        double defunc_2_reduce_res_231608;
        double defunc_2_reduce_res_231609;
        double redout_231711;
        double redout_231712;
        double redout_231713;
        double redout_231714;
        double redout_231715;
        
        redout_231711 = 0.0;
        redout_231712 = 0.0;
        redout_231713 = 0.0;
        redout_231714 = 0.0;
        redout_231715 = 0.0;
        for (int64_t i_231710 = 0; i_231710 < q_l_203577; i_231710++) {
            double x_231718;
            
            x_231718 = ((double *) mem_231573)[i_231710];
            
            double x_231719;
            
            x_231719 = ((double *) mem_231575)[i_231710];
            
            double defunc_1_f_res_231720 = x_231718 * x_231719;
            double defunc_1_f_res_231721 = x_231718 * defunc_1_f_res_231720;
            double defunc_1_f_res_231722 = x_231718 * defunc_1_f_res_231721;
            double defunc_1_f_res_231723 = x_231718 * defunc_1_f_res_231722;
            double defunc_1_op_res_231724 = x_231719 + redout_231711;
            double defunc_1_op_res_231725 = defunc_1_f_res_231720 +
                   redout_231712;
            double defunc_1_op_res_231726 = defunc_1_f_res_231721 +
                   redout_231713;
            double defunc_1_op_res_231727 = defunc_1_f_res_231722 +
                   redout_231714;
            double defunc_1_op_res_231728 = defunc_1_f_res_231723 +
                   redout_231715;
            
            ((double *) mem_231601)[i_231710] = defunc_1_f_res_231721;
            ((double *) mem_231603)[i_231710] = defunc_1_f_res_231720;
            
            double redout_tmp_231759 = defunc_1_op_res_231724;
            double redout_tmp_231760 = defunc_1_op_res_231725;
            double redout_tmp_231761 = defunc_1_op_res_231726;
            double redout_tmp_231762 = defunc_1_op_res_231727;
            double redout_tmp_231763 = defunc_1_op_res_231728;
            
            redout_231711 = redout_tmp_231759;
            redout_231712 = redout_tmp_231760;
            redout_231713 = redout_tmp_231761;
            redout_231714 = redout_tmp_231762;
            redout_231715 = redout_tmp_231763;
        }
        defunc_2_reduce_res_231605 = redout_231711;
        defunc_2_reduce_res_231606 = redout_231712;
        defunc_2_reduce_res_231607 = redout_231713;
        defunc_2_reduce_res_231608 = redout_231714;
        defunc_2_reduce_res_231609 = redout_231715;
        
        double x_231633 = defunc_2_reduce_res_231607 *
               defunc_2_reduce_res_231609;
        double y_231634 = defunc_2_reduce_res_231608 *
               defunc_2_reduce_res_231608;
        double a12_231635 = x_231633 - y_231634;
        double x_231636 = defunc_2_reduce_res_231607 *
               defunc_2_reduce_res_231608;
        double y_231637 = defunc_2_reduce_res_231606 *
               defunc_2_reduce_res_231609;
        double b12_231638 = x_231636 - y_231637;
        double x_231639 = defunc_2_reduce_res_231606 *
               defunc_2_reduce_res_231608;
        double y_231640 = defunc_2_reduce_res_231607 *
               defunc_2_reduce_res_231607;
        double c12_231641 = x_231639 - y_231640;
        double x_231642 = defunc_2_reduce_res_231605 *
               defunc_2_reduce_res_231609;
        double b2_231643 = x_231642 - y_231640;
        double x_231644 = defunc_2_reduce_res_231606 *
               defunc_2_reduce_res_231607;
        double y_231645 = defunc_2_reduce_res_231605 *
               defunc_2_reduce_res_231608;
        double c2_231646 = x_231644 - y_231645;
        double x_231647 = defunc_2_reduce_res_231605 * a12_231635;
        double y_231648 = defunc_2_reduce_res_231606 * b12_231638;
        double x_231649 = x_231647 + y_231648;
        double y_231650 = defunc_2_reduce_res_231607 * c12_231641;
        double y_231651 = x_231649 + y_231650;
        double det_231652 = 1.0 / y_231651;
        double a12_231653 = a12_231635 * det_231652;
        double b12_231654 = b12_231638 * det_231652;
        double c12_231655 = c12_231641 * det_231652;
        double b2_231656 = b2_231643 * det_231652;
        double c2_231657 = c2_231646 * det_231652;
        double defunc_2_reduce_res_231658;
        double defunc_2_reduce_res_231659;
        double redout_231732;
        double redout_231733;
        
        redout_231732 = 0.0;
        redout_231733 = 0.0;
        for (int64_t i_231731 = 0; i_231731 < q_l_203577; i_231731++) {
            double x_231734;
            
            x_231734 = ((double *) mem_231575)[i_231731];
            
            double x_231735;
            
            x_231735 = ((double *) mem_231603)[i_231731];
            
            double x_231736;
            
            x_231736 = ((double *) mem_231601)[i_231731];
            
            bool cond_231737 = sle64(n_203572, i_231731);
            double defunc_0_f_res_231738;
            
            if (cond_231737) {
                defunc_0_f_res_231738 = 0.0;
            } else {
                int64_t i_231739 = add64(x_231568, i_231731);
                double defunc_0_add_arg_231740;
                
                defunc_0_add_arg_231740 =
                    ((double *) mem_219411.mem)[gtid_213535 * n_203572 +
                                                i_231739];
                defunc_0_f_res_231738 = defunc_0_add_arg_231740;
            }
            
            double x_231741 = a12_231653 * x_231734;
            double y_231742 = b12_231654 * x_231735;
            double x_231743 = x_231741 + y_231742;
            double y_231744 = c12_231655 * x_231736;
            double x_231745 = x_231743 + y_231744;
            double defunc_9_fit_fun_res_231746 = defunc_0_f_res_231738 *
                   x_231745;
            double x_231747 = b12_231654 * x_231734;
            double y_231748 = b2_231656 * x_231735;
            double x_231749 = x_231747 + y_231748;
            double y_231750 = c2_231657 * x_231736;
            double x_231751 = x_231749 + y_231750;
            double defunc_9_slope_fun_res_231752 = defunc_0_f_res_231738 *
                   x_231751;
            double defunc_1_op_res_231753 = defunc_9_fit_fun_res_231746 +
                   redout_231732;
            double defunc_1_op_res_231754 = defunc_9_slope_fun_res_231752 +
                   redout_231733;
            double redout_tmp_231766 = defunc_1_op_res_231753;
            double redout_tmp_231767 = defunc_1_op_res_231754;
            
            redout_231732 = redout_tmp_231766;
            redout_231733 = redout_tmp_231767;
        }
        defunc_2_reduce_res_231658 = redout_231732;
        defunc_2_reduce_res_231659 = redout_231733;
        ((double *) mem_219773.mem)[gtid_231567] = defunc_2_reduce_res_231658;
        ((double *) mem_219776.mem)[gtid_231567] = defunc_2_reduce_res_231659;
    }
    
  cleanup:
    { }
    free(mem_231573);
    free(mem_231575);
    free(mem_231601);
    free(mem_231603);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236405_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236405_end -
                 futhark_mc_segmap_parloop_236405_start;
        
        ctx->futhark_mc_segmap_parloop_236405_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236405_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236405_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236403(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231566 = tid;
    int num_tasks_231686 = info.nsubtasks;
    struct futhark_mc_task_236402 *futhark_mc_task_236402 =
                                  (struct futhark_mc_task_236402 *) args;
    struct futhark_context *ctx = futhark_mc_task_236402->ctx;
    uint64_t futhark_mc_segmap_task_236403_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236403_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236402->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236402->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236402->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236402->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236402->free_i_203760;
    int64_t gtid_213535 = futhark_mc_task_236402->free_gtid_213535;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236402->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236402->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236402->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236402->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236402->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236402->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236402->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219700 = futhark_mc_task_236402->free_bytes_219700;
    struct memblock mem_219773 = {.desc ="mem_219773", .mem =
                                  futhark_mc_task_236402->free_mem_219773,
                                  .size =0, .references =NULL};
    struct memblock mem_219776 = {.desc ="mem_219776", .mem =
                                  futhark_mc_task_236402->free_mem_219776,
                                  .size =0, .references =NULL};
    int64_t iter_231687;
    struct futhark_mc_segmap_parloop_struct_236404
    futhark_mc_segmap_parloop_struct_236404;
    
    futhark_mc_segmap_parloop_struct_236404.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236404.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236404.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236404.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236404.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236404.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236404.free_gtid_213535 = gtid_213535;
    futhark_mc_segmap_parloop_struct_236404.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236404.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236404.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236404.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236404.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236404.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236404.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236404.free_bytes_219700 = bytes_219700;
    futhark_mc_segmap_parloop_struct_236404.free_mem_219773 = mem_219773.mem;
    futhark_mc_segmap_parloop_struct_236404.free_mem_219776 = mem_219776.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236405_task;
    
    futhark_mc_segmap_parloop_236405_task.name =
        "futhark_mc_segmap_parloop_236405";
    futhark_mc_segmap_parloop_236405_task.fn = futhark_mc_segmap_parloop_236405;
    futhark_mc_segmap_parloop_236405_task.args =
        &futhark_mc_segmap_parloop_struct_236404;
    futhark_mc_segmap_parloop_236405_task.iterations = iterations;
    futhark_mc_segmap_parloop_236405_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236405_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236405_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236405_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236405_task);
    
    if (futhark_mc_segmap_parloop_236405_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236405_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236405_total_end -
                 futhark_mc_segmap_parloop_236405_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236405_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236405_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236405_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236403_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236403_end -
                 futhark_mc_segmap_task_236403_start;
        
        ctx->futhark_mc_segmap_task_236403_runs[tid]++;
        ctx->futhark_mc_segmap_task_236403_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236403_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236411 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_jump_t_203582;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_gtid_213535;
    unsigned char *free_mem_217891;
    unsigned char *free_mem_217895;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219411;
    int64_t free_bytes_219700;
    unsigned char *free_mem_219773;
    unsigned char *free_mem_219776;
};
struct futhark_mc_task_236417 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_gtid_213535;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_231452;
    double free_x_231453;
    int64_t free_defunc_0_g_res_231456;
    unsigned char *free_mem_231457;
    unsigned char *free_mem_231458;
};
struct futhark_mc_segmap_parloop_struct_236419 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_l_203577;
    int64_t free_gtid_213535;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    int64_t free_x_231452;
    double free_x_231453;
    int64_t free_defunc_0_g_res_231456;
    unsigned char *free_mem_231457;
    unsigned char *free_mem_231458;
};
static int futhark_mc_segmap_parloop_236420(void *args, int64_t start,
                                            int64_t end, int flat_tid_231769,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236419
    *futhark_mc_segmap_parloop_struct_236419 =
    (struct futhark_mc_segmap_parloop_struct_236419 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236419->ctx;
    uint64_t futhark_mc_segmap_parloop_236420_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236420_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236419->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236419->free_q_l_203577;
    int64_t gtid_213535 =
            futhark_mc_segmap_parloop_struct_236419->free_gtid_213535;
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236419->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236419->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236419->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236419->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_231452 = futhark_mc_segmap_parloop_struct_236419->free_x_231452;
    double x_231453 = futhark_mc_segmap_parloop_struct_236419->free_x_231453;
    int64_t defunc_0_g_res_231456 =
            futhark_mc_segmap_parloop_struct_236419->free_defunc_0_g_res_231456;
    struct memblock mem_231457 = {.desc ="mem_231457", .mem =
                                  futhark_mc_segmap_parloop_struct_236419->free_mem_231457,
                                  .size =0, .references =NULL};
    struct memblock mem_231458 = {.desc ="mem_231458", .mem =
                                  futhark_mc_segmap_parloop_struct_236419->free_mem_231458,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231841 = start;
    
    for (; iter_231841 < end; iter_231841++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231846 = q_l_203577;
        int64_t gtid_231770 = iter_231841;
        int64_t remnant_231847 = iter_231841 - gtid_231770;
        bool cond_231771 = sle64(n_203572, gtid_231770);
        int64_t defunc_0_f_res_231772;
        
        if (cond_231771) {
            defunc_0_f_res_231772 = (int64_t) 0;
        } else {
            int64_t i_231842 = add64(x_231452, gtid_231770);
            int64_t defunc_1_add_res_231843 = add64((int64_t) 1, i_231842);
            
            defunc_0_f_res_231772 = defunc_1_add_res_231843;
        }
        
        double defunc_0_f_res_231775;
        
        if (cond_231771) {
            defunc_0_f_res_231775 = 0.0;
        } else {
            int64_t i_231844 = add64(x_231452, gtid_231770);
            double defunc_0_add_arg_231845;
            
            defunc_0_add_arg_231845 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_213535 *
                                                   ctx_param_ext_217985 +
                                                   i_231844 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_231775 = defunc_0_add_arg_231845;
        }
        
        int64_t binop_p_231778 = sub64(defunc_0_f_res_231772,
                                       defunc_0_g_res_231456);
        double defunc_0_f_res_231779 = sitofp_i64_f64(binop_p_231778);
        double abs_res_231780 = fabs(defunc_0_f_res_231779);
        double tmp1_231781 = abs_res_231780 / x_231453;
        double x_231782 = tmp1_231781 * tmp1_231781;
        double y_231783 = tmp1_231781 * x_231782;
        double tmp2_231784 = 1.0 - y_231783;
        double x_231785 = tmp2_231784 * tmp2_231784;
        double tmp3_231786 = tmp2_231784 * x_231785;
        double tmp4_231787 = defunc_0_f_res_231775 * tmp3_231786;
        
        ((double *) mem_231457.mem)[gtid_231770] = defunc_0_f_res_231779;
        ((double *) mem_231458.mem)[gtid_231770] = tmp4_231787;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236420_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236420_end -
                 futhark_mc_segmap_parloop_236420_start;
        
        ctx->futhark_mc_segmap_parloop_236420_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236420_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236420_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236418(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231769 = tid;
    int num_tasks_231840 = info.nsubtasks;
    struct futhark_mc_task_236417 *futhark_mc_task_236417 =
                                  (struct futhark_mc_task_236417 *) args;
    struct futhark_context *ctx = futhark_mc_task_236417->ctx;
    uint64_t futhark_mc_segmap_task_236418_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236418_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236417->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236417->free_q_l_203577;
    int64_t gtid_213535 = futhark_mc_task_236417->free_gtid_213535;
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236417->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236417->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236417->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236417->free_mem_param_217989,
                                        .size =0, .references =NULL};
    int64_t x_231452 = futhark_mc_task_236417->free_x_231452;
    double x_231453 = futhark_mc_task_236417->free_x_231453;
    int64_t defunc_0_g_res_231456 =
            futhark_mc_task_236417->free_defunc_0_g_res_231456;
    struct memblock mem_231457 = {.desc ="mem_231457", .mem =
                                  futhark_mc_task_236417->free_mem_231457,
                                  .size =0, .references =NULL};
    struct memblock mem_231458 = {.desc ="mem_231458", .mem =
                                  futhark_mc_task_236417->free_mem_231458,
                                  .size =0, .references =NULL};
    int64_t iter_231841;
    struct futhark_mc_segmap_parloop_struct_236419
    futhark_mc_segmap_parloop_struct_236419;
    
    futhark_mc_segmap_parloop_struct_236419.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236419.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236419.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236419.free_gtid_213535 = gtid_213535;
    futhark_mc_segmap_parloop_struct_236419.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236419.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236419.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236419.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236419.free_x_231452 = x_231452;
    futhark_mc_segmap_parloop_struct_236419.free_x_231453 = x_231453;
    futhark_mc_segmap_parloop_struct_236419.free_defunc_0_g_res_231456 =
        defunc_0_g_res_231456;
    futhark_mc_segmap_parloop_struct_236419.free_mem_231457 = mem_231457.mem;
    futhark_mc_segmap_parloop_struct_236419.free_mem_231458 = mem_231458.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236420_task;
    
    futhark_mc_segmap_parloop_236420_task.name =
        "futhark_mc_segmap_parloop_236420";
    futhark_mc_segmap_parloop_236420_task.fn = futhark_mc_segmap_parloop_236420;
    futhark_mc_segmap_parloop_236420_task.args =
        &futhark_mc_segmap_parloop_struct_236419;
    futhark_mc_segmap_parloop_236420_task.iterations = iterations;
    futhark_mc_segmap_parloop_236420_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236420_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236420_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236420_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236420_task);
    
    if (futhark_mc_segmap_parloop_236420_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236420_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236420_total_end -
                 futhark_mc_segmap_parloop_236420_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236420_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236420_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236420_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236418_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236418_end -
                 futhark_mc_segmap_task_236418_start;
        
        ctx->futhark_mc_segmap_task_236418_runs[tid]++;
        ctx->futhark_mc_segmap_task_236418_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236418_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236421 {
    struct futhark_context *ctx;
    unsigned char *free_mem_231457;
    unsigned char *free_mem_231458;
    double *retval_defunc_2_reduce_res_231482;
    double *retval_defunc_2_reduce_res_231483;
    double *retval_defunc_2_reduce_res_231484;
    double *retval_defunc_2_reduce_res_231485;
    double *retval_defunc_2_reduce_res_231486;
    unsigned char *retval_mem_231480;
    unsigned char *retval_mem_231481;
};
struct futhark_mc_segred_stage_1_parloop_struct_236428 {
    struct futhark_context *ctx;
    unsigned char *free_mem_231457;
    unsigned char *free_mem_231458;
    unsigned char *free_mem_231480;
    unsigned char *free_mem_231481;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231849;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231851;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231853;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231855;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231857;
};
static int futhark_mc_segred_stage_1_parloop_236429(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_231788,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236428
    *futhark_mc_segred_stage_1_parloop_struct_236428 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236428 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236428->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236429_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236429_start = get_wall_time();
    
    struct memblock mem_231457 = {.desc ="mem_231457", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236428->free_mem_231457,
                                  .size =0, .references =NULL};
    struct memblock mem_231458 = {.desc ="mem_231458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236428->free_mem_231458,
                                  .size =0, .references =NULL};
    struct memblock mem_231480 = {.desc ="mem_231480", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236428->free_mem_231480,
                                  .size =0, .references =NULL};
    struct memblock mem_231481 = {.desc ="mem_231481", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236428->free_mem_231481,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231849 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231849",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236428->free_reduce_stage_1_tid_res_arr_mem_231849,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231851 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231851",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236428->free_reduce_stage_1_tid_res_arr_mem_231851,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231853 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231853",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236428->free_reduce_stage_1_tid_res_arr_mem_231853,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231855 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231855",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236428->free_reduce_stage_1_tid_res_arr_mem_231855,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231857 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231857",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236428->free_reduce_stage_1_tid_res_arr_mem_231857,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231859 = start;
    double x_231790;
    double x_231791;
    double x_231793;
    double x_231794;
    double x_231796;
    double x_231797;
    double x_231799;
    double x_231800;
    double x_231802;
    double x_231803;
    double local_acc_231860 = 0.0;
    double local_acc_231861 = 0.0;
    double local_acc_231862 = 0.0;
    double local_acc_231863 = 0.0;
    double local_acc_231864 = 0.0;
    
    for (; iter_231859 < end; iter_231859++) {
        int64_t gtid_231789 = iter_231859;
        double x_231805;
        
        x_231805 = ((double *) mem_231457.mem)[gtid_231789];
        
        double x_231806;
        
        x_231806 = ((double *) mem_231458.mem)[gtid_231789];
        
        double defunc_1_f_res_231807 = x_231805 * x_231806;
        double defunc_1_f_res_231808 = x_231805 * defunc_1_f_res_231807;
        double defunc_1_f_res_231809 = x_231805 * defunc_1_f_res_231808;
        double defunc_1_f_res_231810 = x_231805 * defunc_1_f_res_231809;
        
        // save map-out results
        {
            ((double *) mem_231480.mem)[gtid_231789] = defunc_1_f_res_231808;
            ((double *) mem_231481.mem)[gtid_231789] = defunc_1_f_res_231807;
        }
        // Load accum params
        {
            x_231790 = local_acc_231860;
        }
        // Load next params
        {
            x_231791 = x_231806;
        }
        // Red body
        {
            double defunc_1_op_res_231792 = x_231790 + x_231791;
            
            local_acc_231860 = defunc_1_op_res_231792;
        }
        // Load accum params
        {
            x_231793 = local_acc_231861;
        }
        // Load next params
        {
            x_231794 = defunc_1_f_res_231807;
        }
        // Red body
        {
            double defunc_1_op_res_231795 = x_231793 + x_231794;
            
            local_acc_231861 = defunc_1_op_res_231795;
        }
        // Load accum params
        {
            x_231796 = local_acc_231862;
        }
        // Load next params
        {
            x_231797 = defunc_1_f_res_231808;
        }
        // Red body
        {
            double defunc_1_op_res_231798 = x_231796 + x_231797;
            
            local_acc_231862 = defunc_1_op_res_231798;
        }
        // Load accum params
        {
            x_231799 = local_acc_231863;
        }
        // Load next params
        {
            x_231800 = defunc_1_f_res_231809;
        }
        // Red body
        {
            double defunc_1_op_res_231801 = x_231799 + x_231800;
            
            local_acc_231863 = defunc_1_op_res_231801;
        }
        // Load accum params
        {
            x_231802 = local_acc_231864;
        }
        // Load next params
        {
            x_231803 = defunc_1_f_res_231810;
        }
        // Red body
        {
            double defunc_1_op_res_231804 = x_231802 + x_231803;
            
            local_acc_231864 = defunc_1_op_res_231804;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_231849.mem)[flat_tid_231788] =
        local_acc_231860;
    ((double *) reduce_stage_1_tid_res_arr_mem_231851.mem)[flat_tid_231788] =
        local_acc_231861;
    ((double *) reduce_stage_1_tid_res_arr_mem_231853.mem)[flat_tid_231788] =
        local_acc_231862;
    ((double *) reduce_stage_1_tid_res_arr_mem_231855.mem)[flat_tid_231788] =
        local_acc_231863;
    ((double *) reduce_stage_1_tid_res_arr_mem_231857.mem)[flat_tid_231788] =
        local_acc_231864;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236429_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236429_end -
                 futhark_mc_segred_stage_1_parloop_236429_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236429_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236429_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236429_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236422(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231788 = tid;
    int num_tasks_231848 = info.nsubtasks;
    struct futhark_mc_task_236421 *futhark_mc_task_236421 =
                                  (struct futhark_mc_task_236421 *) args;
    struct futhark_context *ctx = futhark_mc_task_236421->ctx;
    uint64_t futhark_mc_segred_task_236422_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236422_start = get_wall_time();
    
    struct memblock mem_231457 = {.desc ="mem_231457", .mem =
                                  futhark_mc_task_236421->free_mem_231457,
                                  .size =0, .references =NULL};
    struct memblock mem_231458 = {.desc ="mem_231458", .mem =
                                  futhark_mc_task_236421->free_mem_231458,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_231482 =
           *futhark_mc_task_236421->retval_defunc_2_reduce_res_231482;
    double defunc_2_reduce_res_231483 =
           *futhark_mc_task_236421->retval_defunc_2_reduce_res_231483;
    double defunc_2_reduce_res_231484 =
           *futhark_mc_task_236421->retval_defunc_2_reduce_res_231484;
    double defunc_2_reduce_res_231485 =
           *futhark_mc_task_236421->retval_defunc_2_reduce_res_231485;
    double defunc_2_reduce_res_231486 =
           *futhark_mc_task_236421->retval_defunc_2_reduce_res_231486;
    struct memblock mem_231480 = {.desc ="mem_231480", .mem =
                                  futhark_mc_task_236421->retval_mem_231480,
                                  .size =0, .references =NULL};
    struct memblock mem_231481 = {.desc ="mem_231481", .mem =
                                  futhark_mc_task_236421->retval_mem_231481,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_231849_cached_sizze_236423 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231849 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231851_cached_sizze_236424 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231851 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231853_cached_sizze_236425 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231853 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231855_cached_sizze_236426 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231855 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231857_cached_sizze_236427 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231857 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_231849_cached_sizze_236423 <
        (size_t) ((int64_t) 8 * num_tasks_231848)) {
        reduce_stage_1_tid_res_arr_mem_231849 =
            realloc(reduce_stage_1_tid_res_arr_mem_231849, (int64_t) 8 *
                    num_tasks_231848);
        reduce_stage_1_tid_res_arr_mem_231849_cached_sizze_236423 =
            (int64_t) 8 * num_tasks_231848;
    }
    if (reduce_stage_1_tid_res_arr_mem_231851_cached_sizze_236424 <
        (size_t) ((int64_t) 8 * num_tasks_231848)) {
        reduce_stage_1_tid_res_arr_mem_231851 =
            realloc(reduce_stage_1_tid_res_arr_mem_231851, (int64_t) 8 *
                    num_tasks_231848);
        reduce_stage_1_tid_res_arr_mem_231851_cached_sizze_236424 =
            (int64_t) 8 * num_tasks_231848;
    }
    if (reduce_stage_1_tid_res_arr_mem_231853_cached_sizze_236425 <
        (size_t) ((int64_t) 8 * num_tasks_231848)) {
        reduce_stage_1_tid_res_arr_mem_231853 =
            realloc(reduce_stage_1_tid_res_arr_mem_231853, (int64_t) 8 *
                    num_tasks_231848);
        reduce_stage_1_tid_res_arr_mem_231853_cached_sizze_236425 =
            (int64_t) 8 * num_tasks_231848;
    }
    if (reduce_stage_1_tid_res_arr_mem_231855_cached_sizze_236426 <
        (size_t) ((int64_t) 8 * num_tasks_231848)) {
        reduce_stage_1_tid_res_arr_mem_231855 =
            realloc(reduce_stage_1_tid_res_arr_mem_231855, (int64_t) 8 *
                    num_tasks_231848);
        reduce_stage_1_tid_res_arr_mem_231855_cached_sizze_236426 =
            (int64_t) 8 * num_tasks_231848;
    }
    if (reduce_stage_1_tid_res_arr_mem_231857_cached_sizze_236427 <
        (size_t) ((int64_t) 8 * num_tasks_231848)) {
        reduce_stage_1_tid_res_arr_mem_231857 =
            realloc(reduce_stage_1_tid_res_arr_mem_231857, (int64_t) 8 *
                    num_tasks_231848);
        reduce_stage_1_tid_res_arr_mem_231857_cached_sizze_236427 =
            (int64_t) 8 * num_tasks_231848;
    }
    
    int64_t iter_231859;
    struct futhark_mc_segred_stage_1_parloop_struct_236428
    futhark_mc_segred_stage_1_parloop_struct_236428;
    
    futhark_mc_segred_stage_1_parloop_struct_236428.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236428.free_mem_231457 =
        mem_231457.mem;
    futhark_mc_segred_stage_1_parloop_struct_236428.free_mem_231458 =
        mem_231458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236428.free_mem_231480 =
        mem_231480.mem;
    futhark_mc_segred_stage_1_parloop_struct_236428.free_mem_231481 =
        mem_231481.mem;
    futhark_mc_segred_stage_1_parloop_struct_236428.free_reduce_stage_1_tid_res_arr_mem_231849 =
        reduce_stage_1_tid_res_arr_mem_231849;
    futhark_mc_segred_stage_1_parloop_struct_236428.free_reduce_stage_1_tid_res_arr_mem_231851 =
        reduce_stage_1_tid_res_arr_mem_231851;
    futhark_mc_segred_stage_1_parloop_struct_236428.free_reduce_stage_1_tid_res_arr_mem_231853 =
        reduce_stage_1_tid_res_arr_mem_231853;
    futhark_mc_segred_stage_1_parloop_struct_236428.free_reduce_stage_1_tid_res_arr_mem_231855 =
        reduce_stage_1_tid_res_arr_mem_231855;
    futhark_mc_segred_stage_1_parloop_struct_236428.free_reduce_stage_1_tid_res_arr_mem_231857 =
        reduce_stage_1_tid_res_arr_mem_231857;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236429_task;
    
    futhark_mc_segred_stage_1_parloop_236429_task.name =
        "futhark_mc_segred_stage_1_parloop_236429";
    futhark_mc_segred_stage_1_parloop_236429_task.fn =
        futhark_mc_segred_stage_1_parloop_236429;
    futhark_mc_segred_stage_1_parloop_236429_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236428;
    futhark_mc_segred_stage_1_parloop_236429_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236429_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236429_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236429_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236429_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236429_task);
    
    if (futhark_mc_segred_stage_1_parloop_236429_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236429_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236429_total_end -
                 futhark_mc_segred_stage_1_parloop_236429_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236429_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236429_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236429_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_231482 = 0.0;
        defunc_2_reduce_res_231483 = 0.0;
        defunc_2_reduce_res_231484 = 0.0;
        defunc_2_reduce_res_231485 = 0.0;
        defunc_2_reduce_res_231486 = 0.0;
    }
    
    double x_231865;
    double x_231866;
    double x_231868;
    double x_231869;
    double x_231871;
    double x_231872;
    double x_231874;
    double x_231875;
    double x_231877;
    double x_231878;
    
    for (int32_t i_231880 = 0; i_231880 < num_tasks_231848; i_231880++) {
        flat_tid_231788 = i_231880;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_231865 = defunc_2_reduce_res_231482;
            }
            // load next params
            {
                x_231866 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231849)[flat_tid_231788];
            }
            // red body
            {
                double defunc_1_op_res_231867 = x_231865 + x_231866;
                
                defunc_2_reduce_res_231482 = defunc_1_op_res_231867;
            }
            // load acc params
            {
                x_231868 = defunc_2_reduce_res_231483;
            }
            // load next params
            {
                x_231869 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231851)[flat_tid_231788];
            }
            // red body
            {
                double defunc_1_op_res_231870 = x_231868 + x_231869;
                
                defunc_2_reduce_res_231483 = defunc_1_op_res_231870;
            }
            // load acc params
            {
                x_231871 = defunc_2_reduce_res_231484;
            }
            // load next params
            {
                x_231872 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231853)[flat_tid_231788];
            }
            // red body
            {
                double defunc_1_op_res_231873 = x_231871 + x_231872;
                
                defunc_2_reduce_res_231484 = defunc_1_op_res_231873;
            }
            // load acc params
            {
                x_231874 = defunc_2_reduce_res_231485;
            }
            // load next params
            {
                x_231875 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231855)[flat_tid_231788];
            }
            // red body
            {
                double defunc_1_op_res_231876 = x_231874 + x_231875;
                
                defunc_2_reduce_res_231485 = defunc_1_op_res_231876;
            }
            // load acc params
            {
                x_231877 = defunc_2_reduce_res_231486;
            }
            // load next params
            {
                x_231878 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231857)[flat_tid_231788];
            }
            // red body
            {
                double defunc_1_op_res_231879 = x_231877 + x_231878;
                
                defunc_2_reduce_res_231486 = defunc_1_op_res_231879;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_231849);
        free(reduce_stage_1_tid_res_arr_mem_231851);
        free(reduce_stage_1_tid_res_arr_mem_231853);
        free(reduce_stage_1_tid_res_arr_mem_231855);
        free(reduce_stage_1_tid_res_arr_mem_231857);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236422_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236422_end -
                 futhark_mc_segred_task_236422_start;
        
        ctx->futhark_mc_segred_task_236422_runs[tid]++;
        ctx->futhark_mc_segred_task_236422_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236422_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236421->retval_defunc_2_reduce_res_231482 =
            defunc_2_reduce_res_231482;
        *futhark_mc_task_236421->retval_defunc_2_reduce_res_231483 =
            defunc_2_reduce_res_231483;
        *futhark_mc_task_236421->retval_defunc_2_reduce_res_231484 =
            defunc_2_reduce_res_231484;
        *futhark_mc_task_236421->retval_defunc_2_reduce_res_231485 =
            defunc_2_reduce_res_231485;
        *futhark_mc_task_236421->retval_defunc_2_reduce_res_231486 =
            defunc_2_reduce_res_231486;
        futhark_mc_task_236421->retval_mem_231480 = mem_231480.mem;
        futhark_mc_task_236421->retval_mem_231481 = mem_231481.mem;
    }
    return err;
}
struct futhark_mc_task_236430 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213535;
    unsigned char *free_mem_219411;
    int64_t free_x_231452;
    unsigned char *free_mem_231458;
    unsigned char *free_mem_231480;
    unsigned char *free_mem_231481;
    double free_a12_231532;
    double free_b12_231533;
    double free_c12_231534;
    double free_b2_231535;
    double free_c2_231536;
    double *retval_defunc_2_reduce_res_231537;
    double *retval_defunc_2_reduce_res_231538;
};
struct futhark_mc_segred_stage_1_parloop_struct_236434 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213535;
    unsigned char *free_mem_219411;
    int64_t free_x_231452;
    unsigned char *free_mem_231458;
    unsigned char *free_mem_231480;
    unsigned char *free_mem_231481;
    double free_a12_231532;
    double free_b12_231533;
    double free_c12_231534;
    double free_b2_231535;
    double free_c2_231536;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231882;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_231884;
};
static int futhark_mc_segred_stage_1_parloop_236435(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_231811,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236434
    *futhark_mc_segred_stage_1_parloop_struct_236434 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236434 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236434->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236435_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236435_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236434->free_n_203572;
    int64_t gtid_213535 =
            futhark_mc_segred_stage_1_parloop_struct_236434->free_gtid_213535;
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236434->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_231452 =
            futhark_mc_segred_stage_1_parloop_struct_236434->free_x_231452;
    struct memblock mem_231458 = {.desc ="mem_231458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236434->free_mem_231458,
                                  .size =0, .references =NULL};
    struct memblock mem_231480 = {.desc ="mem_231480", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236434->free_mem_231480,
                                  .size =0, .references =NULL};
    struct memblock mem_231481 = {.desc ="mem_231481", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236434->free_mem_231481,
                                  .size =0, .references =NULL};
    double a12_231532 =
           futhark_mc_segred_stage_1_parloop_struct_236434->free_a12_231532;
    double b12_231533 =
           futhark_mc_segred_stage_1_parloop_struct_236434->free_b12_231533;
    double c12_231534 =
           futhark_mc_segred_stage_1_parloop_struct_236434->free_c12_231534;
    double b2_231535 =
           futhark_mc_segred_stage_1_parloop_struct_236434->free_b2_231535;
    double c2_231536 =
           futhark_mc_segred_stage_1_parloop_struct_236434->free_c2_231536;
    struct memblock reduce_stage_1_tid_res_arr_mem_231882 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231882",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236434->free_reduce_stage_1_tid_res_arr_mem_231882,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_231884 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_231884",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236434->free_reduce_stage_1_tid_res_arr_mem_231884,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_231886 = start;
    double x_231813;
    double x_231814;
    double x_231816;
    double x_231817;
    double local_acc_231887 = 0.0;
    double local_acc_231888 = 0.0;
    
    for (; iter_231886 < end; iter_231886++) {
        int64_t gtid_231812 = iter_231886;
        double x_231819;
        
        x_231819 = ((double *) mem_231458.mem)[gtid_231812];
        
        double x_231820;
        
        x_231820 = ((double *) mem_231481.mem)[gtid_231812];
        
        double x_231821;
        
        x_231821 = ((double *) mem_231480.mem)[gtid_231812];
        
        bool cond_231822 = sle64(n_203572, gtid_231812);
        double defunc_0_f_res_231823;
        
        if (cond_231822) {
            defunc_0_f_res_231823 = 0.0;
        } else {
            int64_t i_231824 = add64(x_231452, gtid_231812);
            double defunc_0_add_arg_231825;
            
            defunc_0_add_arg_231825 = ((double *) mem_219411.mem)[gtid_213535 *
                                                                  n_203572 +
                                                                  i_231824];
            defunc_0_f_res_231823 = defunc_0_add_arg_231825;
        }
        
        double x_231826 = a12_231532 * x_231819;
        double y_231827 = b12_231533 * x_231820;
        double x_231828 = x_231826 + y_231827;
        double y_231829 = c12_231534 * x_231821;
        double x_231830 = x_231828 + y_231829;
        double defunc_9_fit_fun_res_231831 = defunc_0_f_res_231823 * x_231830;
        double x_231832 = b12_231533 * x_231819;
        double y_231833 = b2_231535 * x_231820;
        double x_231834 = x_231832 + y_231833;
        double y_231835 = c2_231536 * x_231821;
        double x_231836 = x_231834 + y_231835;
        double defunc_9_slope_fun_res_231837 = defunc_0_f_res_231823 * x_231836;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_231813 = local_acc_231887;
        }
        // Load next params
        {
            x_231814 = defunc_9_fit_fun_res_231831;
        }
        // Red body
        {
            double defunc_1_op_res_231815 = x_231813 + x_231814;
            
            local_acc_231887 = defunc_1_op_res_231815;
        }
        // Load accum params
        {
            x_231816 = local_acc_231888;
        }
        // Load next params
        {
            x_231817 = defunc_9_slope_fun_res_231837;
        }
        // Red body
        {
            double defunc_1_op_res_231818 = x_231816 + x_231817;
            
            local_acc_231888 = defunc_1_op_res_231818;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_231882.mem)[flat_tid_231811] =
        local_acc_231887;
    ((double *) reduce_stage_1_tid_res_arr_mem_231884.mem)[flat_tid_231811] =
        local_acc_231888;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236435_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236435_end -
                 futhark_mc_segred_stage_1_parloop_236435_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236435_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236435_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236435_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236431(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231811 = tid;
    int num_tasks_231881 = info.nsubtasks;
    struct futhark_mc_task_236430 *futhark_mc_task_236430 =
                                  (struct futhark_mc_task_236430 *) args;
    struct futhark_context *ctx = futhark_mc_task_236430->ctx;
    uint64_t futhark_mc_segred_task_236431_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236431_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236430->free_n_203572;
    int64_t gtid_213535 = futhark_mc_task_236430->free_gtid_213535;
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236430->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t x_231452 = futhark_mc_task_236430->free_x_231452;
    struct memblock mem_231458 = {.desc ="mem_231458", .mem =
                                  futhark_mc_task_236430->free_mem_231458,
                                  .size =0, .references =NULL};
    struct memblock mem_231480 = {.desc ="mem_231480", .mem =
                                  futhark_mc_task_236430->free_mem_231480,
                                  .size =0, .references =NULL};
    struct memblock mem_231481 = {.desc ="mem_231481", .mem =
                                  futhark_mc_task_236430->free_mem_231481,
                                  .size =0, .references =NULL};
    double a12_231532 = futhark_mc_task_236430->free_a12_231532;
    double b12_231533 = futhark_mc_task_236430->free_b12_231533;
    double c12_231534 = futhark_mc_task_236430->free_c12_231534;
    double b2_231535 = futhark_mc_task_236430->free_b2_231535;
    double c2_231536 = futhark_mc_task_236430->free_c2_231536;
    double defunc_2_reduce_res_231537 =
           *futhark_mc_task_236430->retval_defunc_2_reduce_res_231537;
    double defunc_2_reduce_res_231538 =
           *futhark_mc_task_236430->retval_defunc_2_reduce_res_231538;
    size_t reduce_stage_1_tid_res_arr_mem_231882_cached_sizze_236432 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231882 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_231884_cached_sizze_236433 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_231884 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_231882_cached_sizze_236432 <
        (size_t) ((int64_t) 8 * num_tasks_231881)) {
        reduce_stage_1_tid_res_arr_mem_231882 =
            realloc(reduce_stage_1_tid_res_arr_mem_231882, (int64_t) 8 *
                    num_tasks_231881);
        reduce_stage_1_tid_res_arr_mem_231882_cached_sizze_236432 =
            (int64_t) 8 * num_tasks_231881;
    }
    if (reduce_stage_1_tid_res_arr_mem_231884_cached_sizze_236433 <
        (size_t) ((int64_t) 8 * num_tasks_231881)) {
        reduce_stage_1_tid_res_arr_mem_231884 =
            realloc(reduce_stage_1_tid_res_arr_mem_231884, (int64_t) 8 *
                    num_tasks_231881);
        reduce_stage_1_tid_res_arr_mem_231884_cached_sizze_236433 =
            (int64_t) 8 * num_tasks_231881;
    }
    
    int64_t iter_231886;
    struct futhark_mc_segred_stage_1_parloop_struct_236434
    futhark_mc_segred_stage_1_parloop_struct_236434;
    
    futhark_mc_segred_stage_1_parloop_struct_236434.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_gtid_213535 =
        gtid_213535;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_mem_219411 =
        mem_219411.mem;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_x_231452 = x_231452;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_mem_231458 =
        mem_231458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_mem_231480 =
        mem_231480.mem;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_mem_231481 =
        mem_231481.mem;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_a12_231532 =
        a12_231532;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_b12_231533 =
        b12_231533;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_c12_231534 =
        c12_231534;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_b2_231535 = b2_231535;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_c2_231536 = c2_231536;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_reduce_stage_1_tid_res_arr_mem_231882 =
        reduce_stage_1_tid_res_arr_mem_231882;
    futhark_mc_segred_stage_1_parloop_struct_236434.free_reduce_stage_1_tid_res_arr_mem_231884 =
        reduce_stage_1_tid_res_arr_mem_231884;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236435_task;
    
    futhark_mc_segred_stage_1_parloop_236435_task.name =
        "futhark_mc_segred_stage_1_parloop_236435";
    futhark_mc_segred_stage_1_parloop_236435_task.fn =
        futhark_mc_segred_stage_1_parloop_236435;
    futhark_mc_segred_stage_1_parloop_236435_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236434;
    futhark_mc_segred_stage_1_parloop_236435_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236435_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236435_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236435_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236435_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236435_task);
    
    if (futhark_mc_segred_stage_1_parloop_236435_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236435_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236435_total_end -
                 futhark_mc_segred_stage_1_parloop_236435_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236435_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236435_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236435_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_231537 = 0.0;
        defunc_2_reduce_res_231538 = 0.0;
    }
    
    double x_231889;
    double x_231890;
    double x_231892;
    double x_231893;
    
    for (int32_t i_231895 = 0; i_231895 < num_tasks_231881; i_231895++) {
        flat_tid_231811 = i_231895;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_231889 = defunc_2_reduce_res_231537;
            }
            // load next params
            {
                x_231890 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231882)[flat_tid_231811];
            }
            // red body
            {
                double defunc_1_op_res_231891 = x_231889 + x_231890;
                
                defunc_2_reduce_res_231537 = defunc_1_op_res_231891;
            }
            // load acc params
            {
                x_231892 = defunc_2_reduce_res_231538;
            }
            // load next params
            {
                x_231893 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_231884)[flat_tid_231811];
            }
            // red body
            {
                double defunc_1_op_res_231894 = x_231892 + x_231893;
                
                defunc_2_reduce_res_231538 = defunc_1_op_res_231894;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_231882);
        free(reduce_stage_1_tid_res_arr_mem_231884);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236431_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236431_end -
                 futhark_mc_segred_task_236431_start;
        
        ctx->futhark_mc_segred_task_236431_runs[tid]++;
        ctx->futhark_mc_segred_task_236431_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236431_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236430->retval_defunc_2_reduce_res_231537 =
            defunc_2_reduce_res_231537;
        *futhark_mc_task_236430->retval_defunc_2_reduce_res_231538 =
            defunc_2_reduce_res_231538;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236412(void *args, int64_t start,
                                            int64_t end, int flat_tid_231450,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236411
    *futhark_mc_segmap_parloop_struct_236411 =
    (struct futhark_mc_segmap_parloop_struct_236411 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236411->ctx;
    uint64_t futhark_mc_segmap_parloop_236412_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236412_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236411->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236411->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236411->free_jump_t_203582;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236411->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236411->free_i_203760;
    int64_t gtid_213535 =
            futhark_mc_segmap_parloop_struct_236411->free_gtid_213535;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236411->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236411->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236411->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236411->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236411->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236411->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236411->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219700 =
            futhark_mc_segmap_parloop_struct_236411->free_bytes_219700;
    struct memblock mem_219773 = {.desc ="mem_219773", .mem =
                                  futhark_mc_segmap_parloop_struct_236411->free_mem_219773,
                                  .size =0, .references =NULL};
    struct memblock mem_219776 = {.desc ="mem_219776", .mem =
                                  futhark_mc_segmap_parloop_struct_236411->free_mem_219776,
                                  .size =0, .references =NULL};
    size_t mem_231457_cached_sizze_236413 = 0;
    unsigned char *mem_231457 = NULL;
    size_t mem_231458_cached_sizze_236414 = 0;
    unsigned char *mem_231458 = NULL;
    size_t mem_231480_cached_sizze_236415 = 0;
    unsigned char *mem_231480 = NULL;
    size_t mem_231481_cached_sizze_236416 = 0;
    unsigned char *mem_231481 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231768 = start;
    
    if (mem_231457_cached_sizze_236413 < (size_t) bytes_219700) {
        mem_231457 = realloc(mem_231457, bytes_219700);
        mem_231457_cached_sizze_236413 = bytes_219700;
    }
    if (mem_231458_cached_sizze_236414 < (size_t) bytes_219700) {
        mem_231458 = realloc(mem_231458, bytes_219700);
        mem_231458_cached_sizze_236414 = bytes_219700;
    }
    if (mem_231480_cached_sizze_236415 < (size_t) bytes_219700) {
        mem_231480 = realloc(mem_231480, bytes_219700);
        mem_231480_cached_sizze_236415 = bytes_219700;
    }
    if (mem_231481_cached_sizze_236416 < (size_t) bytes_219700) {
        mem_231481 = realloc(mem_231481, bytes_219700);
        mem_231481_cached_sizze_236416 = bytes_219700;
    }
    for (; iter_231768 < end; iter_231768++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231838 = l_n_m_203733;
        int64_t gtid_231451 = iter_231768;
        int64_t remnant_231839 = iter_231768 - gtid_231451;
        int64_t x_231452;
        
        x_231452 = ((int64_t *) mem_217891.mem)[gtid_213535 * l_n_m_203733 +
                                                gtid_231451];
        
        double x_231453;
        
        x_231453 = ((double *) mem_217895.mem)[gtid_213535 * l_n_m_203733 +
                                               gtid_231451];
        
        int64_t min_arg_231454 = mul64(jump_t_203582, gtid_231451);
        int64_t min_res_231455 = smin64(i_203760, min_arg_231454);
        int64_t defunc_0_g_res_231456 = add64((int64_t) 1, min_res_231455);
        int64_t flat_tid_231769 = (int64_t) 0;
        int32_t num_tasks_231840;
        struct futhark_mc_task_236417 futhark_mc_task_236417;
        
        futhark_mc_task_236417.ctx = ctx;
        futhark_mc_task_236417.free_n_203572 = n_203572;
        futhark_mc_task_236417.free_q_l_203577 = q_l_203577;
        futhark_mc_task_236417.free_gtid_213535 = gtid_213535;
        futhark_mc_task_236417.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236417.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236417.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236417.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236417.free_x_231452 = x_231452;
        futhark_mc_task_236417.free_x_231453 = x_231453;
        futhark_mc_task_236417.free_defunc_0_g_res_231456 =
            defunc_0_g_res_231456;
        futhark_mc_task_236417.free_mem_231457 = mem_231457;
        futhark_mc_task_236417.free_mem_231458 = mem_231458;
        
        struct scheduler_segop futhark_mc_task_236417_task;
        
        futhark_mc_task_236417_task.args = &futhark_mc_task_236417;
        futhark_mc_task_236417_task.top_level_fn =
            futhark_mc_segmap_task_236418;
        futhark_mc_task_236417_task.name = "futhark_mc_segmap_task_236418";
        futhark_mc_task_236417_task.iterations = q_l_203577;
        futhark_mc_task_236417_task.task_time =
            &ctx->futhark_mc_segmap_task_236418_total_time;
        futhark_mc_task_236417_task.task_iter =
            &ctx->futhark_mc_segmap_task_236418_total_iter;
        futhark_mc_task_236417_task.sched = STATIC;
        futhark_mc_task_236417_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236418_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236417_task);
        
        if (futhark_mc_segmap_task_236418_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double defunc_2_reduce_res_231482;
        double defunc_2_reduce_res_231483;
        double defunc_2_reduce_res_231484;
        double defunc_2_reduce_res_231485;
        double defunc_2_reduce_res_231486;
        int64_t flat_tid_231788 = (int64_t) 0;
        int32_t num_tasks_231848;
        
        defunc_2_reduce_res_231482 = 0.0;
        defunc_2_reduce_res_231483 = 0.0;
        defunc_2_reduce_res_231484 = 0.0;
        defunc_2_reduce_res_231485 = 0.0;
        defunc_2_reduce_res_231486 = 0.0;
        
        struct futhark_mc_task_236421 futhark_mc_task_236421;
        
        futhark_mc_task_236421.ctx = ctx;
        futhark_mc_task_236421.free_mem_231457 = mem_231457;
        futhark_mc_task_236421.free_mem_231458 = mem_231458;
        futhark_mc_task_236421.retval_defunc_2_reduce_res_231482 =
            &defunc_2_reduce_res_231482;
        futhark_mc_task_236421.retval_defunc_2_reduce_res_231483 =
            &defunc_2_reduce_res_231483;
        futhark_mc_task_236421.retval_defunc_2_reduce_res_231484 =
            &defunc_2_reduce_res_231484;
        futhark_mc_task_236421.retval_defunc_2_reduce_res_231485 =
            &defunc_2_reduce_res_231485;
        futhark_mc_task_236421.retval_defunc_2_reduce_res_231486 =
            &defunc_2_reduce_res_231486;
        futhark_mc_task_236421.retval_mem_231480 = mem_231480;
        futhark_mc_task_236421.retval_mem_231481 = mem_231481;
        
        struct scheduler_segop futhark_mc_task_236421_task;
        
        futhark_mc_task_236421_task.args = &futhark_mc_task_236421;
        futhark_mc_task_236421_task.top_level_fn =
            futhark_mc_segred_task_236422;
        futhark_mc_task_236421_task.name = "futhark_mc_segred_task_236422";
        futhark_mc_task_236421_task.iterations = q_l_203577;
        futhark_mc_task_236421_task.task_time =
            &ctx->futhark_mc_segred_task_236422_total_time;
        futhark_mc_task_236421_task.task_iter =
            &ctx->futhark_mc_segred_task_236422_total_iter;
        futhark_mc_task_236421_task.sched = STATIC;
        futhark_mc_task_236421_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236422_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236421_task);
        
        if (futhark_mc_segred_task_236422_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_231512 = defunc_2_reduce_res_231484 *
               defunc_2_reduce_res_231486;
        double y_231513 = defunc_2_reduce_res_231485 *
               defunc_2_reduce_res_231485;
        double a12_231514 = x_231512 - y_231513;
        double x_231515 = defunc_2_reduce_res_231484 *
               defunc_2_reduce_res_231485;
        double y_231516 = defunc_2_reduce_res_231483 *
               defunc_2_reduce_res_231486;
        double b12_231517 = x_231515 - y_231516;
        double x_231518 = defunc_2_reduce_res_231483 *
               defunc_2_reduce_res_231485;
        double y_231519 = defunc_2_reduce_res_231484 *
               defunc_2_reduce_res_231484;
        double c12_231520 = x_231518 - y_231519;
        double x_231521 = defunc_2_reduce_res_231482 *
               defunc_2_reduce_res_231486;
        double b2_231522 = x_231521 - y_231519;
        double x_231523 = defunc_2_reduce_res_231483 *
               defunc_2_reduce_res_231484;
        double y_231524 = defunc_2_reduce_res_231482 *
               defunc_2_reduce_res_231485;
        double c2_231525 = x_231523 - y_231524;
        double x_231526 = defunc_2_reduce_res_231482 * a12_231514;
        double y_231527 = defunc_2_reduce_res_231483 * b12_231517;
        double x_231528 = x_231526 + y_231527;
        double y_231529 = defunc_2_reduce_res_231484 * c12_231520;
        double y_231530 = x_231528 + y_231529;
        double det_231531 = 1.0 / y_231530;
        double a12_231532 = a12_231514 * det_231531;
        double b12_231533 = b12_231517 * det_231531;
        double c12_231534 = c12_231520 * det_231531;
        double b2_231535 = b2_231522 * det_231531;
        double c2_231536 = c2_231525 * det_231531;
        double defunc_2_reduce_res_231537;
        double defunc_2_reduce_res_231538;
        int64_t flat_tid_231811 = (int64_t) 0;
        int32_t num_tasks_231881;
        
        defunc_2_reduce_res_231537 = 0.0;
        defunc_2_reduce_res_231538 = 0.0;
        
        struct futhark_mc_task_236430 futhark_mc_task_236430;
        
        futhark_mc_task_236430.ctx = ctx;
        futhark_mc_task_236430.free_n_203572 = n_203572;
        futhark_mc_task_236430.free_gtid_213535 = gtid_213535;
        futhark_mc_task_236430.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236430.free_x_231452 = x_231452;
        futhark_mc_task_236430.free_mem_231458 = mem_231458;
        futhark_mc_task_236430.free_mem_231480 = mem_231480;
        futhark_mc_task_236430.free_mem_231481 = mem_231481;
        futhark_mc_task_236430.free_a12_231532 = a12_231532;
        futhark_mc_task_236430.free_b12_231533 = b12_231533;
        futhark_mc_task_236430.free_c12_231534 = c12_231534;
        futhark_mc_task_236430.free_b2_231535 = b2_231535;
        futhark_mc_task_236430.free_c2_231536 = c2_231536;
        futhark_mc_task_236430.retval_defunc_2_reduce_res_231537 =
            &defunc_2_reduce_res_231537;
        futhark_mc_task_236430.retval_defunc_2_reduce_res_231538 =
            &defunc_2_reduce_res_231538;
        
        struct scheduler_segop futhark_mc_task_236430_task;
        
        futhark_mc_task_236430_task.args = &futhark_mc_task_236430;
        futhark_mc_task_236430_task.top_level_fn =
            futhark_mc_segred_task_236431;
        futhark_mc_task_236430_task.name = "futhark_mc_segred_task_236431";
        futhark_mc_task_236430_task.iterations = q_l_203577;
        futhark_mc_task_236430_task.task_time =
            &ctx->futhark_mc_segred_task_236431_total_time;
        futhark_mc_task_236430_task.task_iter =
            &ctx->futhark_mc_segred_task_236431_total_iter;
        futhark_mc_task_236430_task.sched = STATIC;
        futhark_mc_task_236430_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236431_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236430_task);
        
        if (futhark_mc_segred_task_236431_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219773.mem)[gtid_231451] = defunc_2_reduce_res_231537;
        ((double *) mem_219776.mem)[gtid_231451] = defunc_2_reduce_res_231538;
    }
    
  cleanup:
    { }
    free(mem_231457);
    free(mem_231458);
    free(mem_231480);
    free(mem_231481);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236412_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236412_end -
                 futhark_mc_segmap_parloop_236412_start;
        
        ctx->futhark_mc_segmap_parloop_236412_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236412_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236412_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236410(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231450 = tid;
    int num_tasks_231686 = info.nsubtasks;
    struct futhark_mc_task_236402 *futhark_mc_task_236402 =
                                  (struct futhark_mc_task_236402 *) args;
    struct futhark_context *ctx = futhark_mc_task_236402->ctx;
    uint64_t futhark_mc_segmap_nested_task_236410_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236410_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236402->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236402->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236402->free_jump_t_203582;
    int64_t l_n_m_203733 = futhark_mc_task_236402->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236402->free_i_203760;
    int64_t gtid_213535 = futhark_mc_task_236402->free_gtid_213535;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236402->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236402->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236402->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236402->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236402->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236402->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236402->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219700 = futhark_mc_task_236402->free_bytes_219700;
    struct memblock mem_219773 = {.desc ="mem_219773", .mem =
                                  futhark_mc_task_236402->free_mem_219773,
                                  .size =0, .references =NULL};
    struct memblock mem_219776 = {.desc ="mem_219776", .mem =
                                  futhark_mc_task_236402->free_mem_219776,
                                  .size =0, .references =NULL};
    int64_t iter_231768;
    struct futhark_mc_segmap_parloop_struct_236411
    futhark_mc_segmap_parloop_struct_236411;
    
    futhark_mc_segmap_parloop_struct_236411.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236411.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236411.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236411.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236411.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236411.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236411.free_gtid_213535 = gtid_213535;
    futhark_mc_segmap_parloop_struct_236411.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236411.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236411.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236411.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236411.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236411.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236411.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236411.free_bytes_219700 = bytes_219700;
    futhark_mc_segmap_parloop_struct_236411.free_mem_219773 = mem_219773.mem;
    futhark_mc_segmap_parloop_struct_236411.free_mem_219776 = mem_219776.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236412_task;
    
    futhark_mc_segmap_parloop_236412_task.name =
        "futhark_mc_segmap_parloop_236412";
    futhark_mc_segmap_parloop_236412_task.fn = futhark_mc_segmap_parloop_236412;
    futhark_mc_segmap_parloop_236412_task.args =
        &futhark_mc_segmap_parloop_struct_236411;
    futhark_mc_segmap_parloop_236412_task.iterations = iterations;
    futhark_mc_segmap_parloop_236412_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236412_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236412_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236412_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236412_task);
    
    if (futhark_mc_segmap_parloop_236412_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236412_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236412_total_end -
                 futhark_mc_segmap_parloop_236412_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236412_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236412_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236412_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236410_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236410_end -
                 futhark_mc_segmap_nested_task_236410_start;
        
        ctx->futhark_mc_segmap_nested_task_236410_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236410_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236410_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236399(void *args, int64_t start,
                                            int64_t end, int flat_tid_213534,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236398
    *futhark_mc_segmap_parloop_struct_236398 =
    (struct futhark_mc_segmap_parloop_struct_236398 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236398->ctx;
    uint64_t futhark_mc_segmap_parloop_236399_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236399_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236398->free_n_203572;
    int64_t q_l_203577 =
            futhark_mc_segmap_parloop_struct_236398->free_q_l_203577;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236398->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236398->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236398->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236398->free_i_203760;
    int64_t bytes_217838 =
            futhark_mc_segmap_parloop_struct_236398->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_segmap_parloop_struct_236398->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_segmap_parloop_struct_236398->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236398->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236398->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236398->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236398->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_segmap_parloop_struct_236398->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219700 =
            futhark_mc_segmap_parloop_struct_236398->free_bytes_219700;
    struct memblock mem_219870 = {.desc ="mem_219870", .mem =
                                  futhark_mc_segmap_parloop_struct_236398->free_mem_219870,
                                  .size =0, .references =NULL};
    struct memblock mem_219874 = {.desc ="mem_219874", .mem =
                                  futhark_mc_segmap_parloop_struct_236398->free_mem_219874,
                                  .size =0, .references =NULL};
    size_t mem_219773_cached_sizze_236400 = 0;
    unsigned char *mem_219773 = NULL;
    size_t mem_219776_cached_sizze_236401 = 0;
    unsigned char *mem_219776 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231449 = start;
    
    if (mem_219773_cached_sizze_236400 < (size_t) bytes_217838) {
        mem_219773 = realloc(mem_219773, bytes_217838);
        mem_219773_cached_sizze_236400 = bytes_217838;
    }
    if (mem_219776_cached_sizze_236401 < (size_t) bytes_217838) {
        mem_219776 = realloc(mem_219776, bytes_217838);
        mem_219776_cached_sizze_236401 = bytes_217838;
    }
    for (; iter_231449 < end; iter_231449++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231684 = partition_sizze_203667;
        int64_t gtid_213535 = iter_231449;
        int64_t remnant_231685 = iter_231449 - gtid_213535;
        int64_t flat_tid_231566 = (int64_t) 0;
        int32_t num_tasks_231686;
        int64_t flat_tid_231450 = (int64_t) 0;
        struct futhark_mc_task_236402 futhark_mc_task_236402;
        
        futhark_mc_task_236402.ctx = ctx;
        futhark_mc_task_236402.free_n_203572 = n_203572;
        futhark_mc_task_236402.free_q_l_203577 = q_l_203577;
        futhark_mc_task_236402.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236402.free_l_n_m_203733 = l_n_m_203733;
        futhark_mc_task_236402.free_i_203760 = i_203760;
        futhark_mc_task_236402.free_gtid_213535 = gtid_213535;
        futhark_mc_task_236402.free_mem_217891 = mem_217891.mem;
        futhark_mc_task_236402.free_mem_217895 = mem_217895.mem;
        futhark_mc_task_236402.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236402.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236402.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236402.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236402.free_mem_219411 = mem_219411.mem;
        futhark_mc_task_236402.free_bytes_219700 = bytes_219700;
        futhark_mc_task_236402.free_mem_219773 = mem_219773;
        futhark_mc_task_236402.free_mem_219776 = mem_219776;
        
        struct scheduler_segop futhark_mc_task_236402_task;
        
        futhark_mc_task_236402_task.args = &futhark_mc_task_236402;
        futhark_mc_task_236402_task.top_level_fn =
            futhark_mc_segmap_task_236403;
        futhark_mc_task_236402_task.name = "futhark_mc_segmap_task_236403";
        futhark_mc_task_236402_task.iterations = l_n_m_203733;
        futhark_mc_task_236402_task.task_time =
            &ctx->futhark_mc_segmap_task_236403_total_time;
        futhark_mc_task_236402_task.task_iter =
            &ctx->futhark_mc_segmap_task_236403_total_iter;
        futhark_mc_task_236402_task.sched = STATIC;
        futhark_mc_task_236402_task.nested_fn =
            futhark_mc_segmap_nested_task_236410;
        
        int futhark_mc_segmap_task_236403_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236402_task);
        
        if (futhark_mc_segmap_task_236403_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219870.mem + gtid_213535 * l_n_m_203733 * (int64_t) 8,
                    mem_219773 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
        if (l_n_m_203733 * (int64_t) 8 > 0)
            memmove(mem_219874.mem + gtid_213535 * l_n_m_203733 * (int64_t) 8,
                    mem_219776 + (int64_t) 0, l_n_m_203733 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219773);
    free(mem_219776);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236399_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236399_end -
                 futhark_mc_segmap_parloop_236399_start;
        
        ctx->futhark_mc_segmap_parloop_236399_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236399_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236399_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236397(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213534 = tid;
    int num_tasks_231315 = 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_nested_task_236397_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236397_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236387->free_n_203572;
    int64_t q_l_203577 = futhark_mc_task_236387->free_q_l_203577;
    int64_t jump_t_203582 = futhark_mc_task_236387->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236387->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236387->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236387->free_i_203760;
    int64_t bytes_217838 = futhark_mc_task_236387->free_bytes_217838;
    struct memblock mem_217891 = {.desc ="mem_217891", .mem =
                                  futhark_mc_task_236387->free_mem_217891,
                                  .size =0, .references =NULL};
    struct memblock mem_217895 = {.desc ="mem_217895", .mem =
                                  futhark_mc_task_236387->free_mem_217895,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236387->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236387->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236387->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236387->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219411 = {.desc ="mem_219411", .mem =
                                  futhark_mc_task_236387->free_mem_219411,
                                  .size =0, .references =NULL};
    int64_t bytes_219700 = futhark_mc_task_236387->free_bytes_219700;
    struct memblock mem_219870 = {.desc ="mem_219870", .mem =
                                  futhark_mc_task_236387->free_mem_219870,
                                  .size =0, .references =NULL};
    struct memblock mem_219874 = {.desc ="mem_219874", .mem =
                                  futhark_mc_task_236387->free_mem_219874,
                                  .size =0, .references =NULL};
    int64_t iter_231449;
    struct futhark_mc_segmap_parloop_struct_236398
    futhark_mc_segmap_parloop_struct_236398;
    
    futhark_mc_segmap_parloop_struct_236398.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236398.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236398.free_q_l_203577 = q_l_203577;
    futhark_mc_segmap_parloop_struct_236398.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236398.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236398.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236398.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236398.free_bytes_217838 = bytes_217838;
    futhark_mc_segmap_parloop_struct_236398.free_mem_217891 = mem_217891.mem;
    futhark_mc_segmap_parloop_struct_236398.free_mem_217895 = mem_217895.mem;
    futhark_mc_segmap_parloop_struct_236398.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236398.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236398.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236398.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236398.free_mem_219411 = mem_219411.mem;
    futhark_mc_segmap_parloop_struct_236398.free_bytes_219700 = bytes_219700;
    futhark_mc_segmap_parloop_struct_236398.free_mem_219870 = mem_219870.mem;
    futhark_mc_segmap_parloop_struct_236398.free_mem_219874 = mem_219874.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236399_task;
    
    futhark_mc_segmap_parloop_236399_task.name =
        "futhark_mc_segmap_parloop_236399";
    futhark_mc_segmap_parloop_236399_task.fn = futhark_mc_segmap_parloop_236399;
    futhark_mc_segmap_parloop_236399_task.args =
        &futhark_mc_segmap_parloop_struct_236398;
    futhark_mc_segmap_parloop_236399_task.iterations = iterations;
    futhark_mc_segmap_parloop_236399_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236399_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236399_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236399_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236399_task);
    
    if (futhark_mc_segmap_parloop_236399_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236399_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236399_total_end -
                 futhark_mc_segmap_parloop_236399_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236399_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236399_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236399_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236397_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236397_end -
                 futhark_mc_segmap_nested_task_236397_start;
        
        ctx->futhark_mc_segmap_nested_task_236397_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236397_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236397_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236436 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_l_203583;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_y_205876;
    int64_t free_bytes_217420;
    unsigned char *free_ext_mem_219879;
    unsigned char *free_ext_mem_219880;
    unsigned char *free_mem_219902;
};
struct futhark_mc_segmap_parloop_struct_236438 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_l_203583;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_y_205876;
    int64_t free_bytes_217420;
    unsigned char *free_ext_mem_219879;
    unsigned char *free_ext_mem_219880;
    unsigned char *free_mem_219902;
};
static int futhark_mc_segmap_parloop_236439(void *args, int64_t start,
                                            int64_t end, int flat_tid_213766,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236438
    *futhark_mc_segmap_parloop_struct_236438 =
    (struct futhark_mc_segmap_parloop_struct_236438 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236438->ctx;
    uint64_t futhark_mc_segmap_parloop_236439_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236439_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236438->free_n_203572;
    int64_t jump_l_203583 =
            futhark_mc_segmap_parloop_struct_236438->free_jump_l_203583;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236438->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236438->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236438->free_i_203760;
    int64_t y_205876 = futhark_mc_segmap_parloop_struct_236438->free_y_205876;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236438->free_bytes_217420;
    struct memblock ext_mem_219879 = {.desc ="ext_mem_219879", .mem =
                                      futhark_mc_segmap_parloop_struct_236438->free_ext_mem_219879,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219880 = {.desc ="ext_mem_219880", .mem =
                                      futhark_mc_segmap_parloop_struct_236438->free_ext_mem_219880,
                                      .size =0, .references =NULL};
    struct memblock mem_219902 = {.desc ="mem_219902", .mem =
                                  futhark_mc_segmap_parloop_struct_236438->free_mem_219902,
                                  .size =0, .references =NULL};
    size_t mem_219886_cached_sizze_236440 = 0;
    unsigned char *mem_219886 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231897 = start;
    
    if (mem_219886_cached_sizze_236440 < (size_t) bytes_217420) {
        mem_219886 = realloc(mem_219886, bytes_217420);
        mem_219886_cached_sizze_236440 = bytes_217420;
    }
    for (; iter_231897 < end; iter_231897++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231947 = partition_sizze_203667;
        int64_t gtid_213767 = iter_231897;
        int64_t remnant_231948 = iter_231897 - gtid_213767;
        
        for (int64_t i_231898 = 0; i_231898 < n_203572; i_231898++) {
            int64_t m_v_231900 = sdiv64(i_231898, jump_l_203583);
            bool cond_231901 = m_v_231900 == y_205876;
            int64_t j_231902;
            
            if (cond_231901) {
                int64_t j_t_res_231903 = sub64(m_v_231900, (int64_t) 1);
                
                j_231902 = j_t_res_231903;
            } else {
                j_231902 = m_v_231900;
            }
            
            int64_t min_arg_231904 = mul64(jump_l_203583, j_231902);
            int64_t min_res_231905 = smin64(i_203760, min_arg_231904);
            int64_t defunc_0_m_fun_arg_231906 = add64((int64_t) 1, j_231902);
            int64_t min_arg_231907 = mul64(jump_l_203583,
                                           defunc_0_m_fun_arg_231906);
            int64_t min_res_231908 = smin64(i_203760, min_arg_231907);
            int64_t i64_arg_231909 = sub64(min_res_231908, min_res_231905);
            double i64_res_231910 = sitofp_i64_f64(i64_arg_231909);
            int64_t i64_arg_231911 = sub64(i_231898, min_res_231905);
            double i64_res_231912 = sitofp_i64_f64(i64_arg_231911);
            double u_231913 = i64_res_231912 / i64_res_231910;
            double u2_231914 = u_231913 * u_231913;
            double u3_231915 = u_231913 * u2_231914;
            double x_231916 = 2.0 * u3_231915;
            double y_231917 = 3.0 * u2_231914;
            double x_231918 = x_231916 - y_231917;
            double x_231919 = 1.0 + x_231918;
            bool x_231920 = sle64((int64_t) 0, j_231902);
            bool y_231921 = slt64(j_231902, l_n_m_203733);
            bool bounds_check_231922 = x_231920 && y_231921;
            bool index_certs_231923;
            
            if (!bounds_check_231922) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) j_231902,
                              "] out of bounds for array of shape [",
                              (long long) l_n_m_203733, "].",
                              "-> #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_231924;
            
            y_231924 = ((double *) ext_mem_219880.mem)[gtid_213767 *
                                                       l_n_m_203733 + j_231902];
            
            double x_231925 = x_231919 * y_231924;
            double x_231926 = y_231917 - x_231916;
            bool x_231927 = sle64((int64_t) 0, defunc_0_m_fun_arg_231906);
            bool y_231928 = slt64(defunc_0_m_fun_arg_231906, l_n_m_203733);
            bool bounds_check_231929 = x_231927 && y_231928;
            bool index_certs_231930;
            
            if (!bounds_check_231929) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) defunc_0_m_fun_arg_231906,
                              "] out of bounds for array of shape [",
                              (long long) l_n_m_203733, "].",
                              "-> #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_231931;
            
            y_231931 = ((double *) ext_mem_219880.mem)[gtid_213767 *
                                                       l_n_m_203733 +
                                                       defunc_0_m_fun_arg_231906];
            
            double y_231932 = x_231926 * y_231931;
            double x_231933 = x_231925 + y_231932;
            double y_231934 = 2.0 * u2_231914;
            double x_231935 = u3_231915 - y_231934;
            double x_231936 = u_231913 + x_231935;
            double y_231937;
            
            y_231937 = ((double *) ext_mem_219879.mem)[gtid_213767 *
                                                       l_n_m_203733 + j_231902];
            
            double x_231938 = x_231936 * y_231937;
            double y_231939 = i64_res_231910 * x_231938;
            double x_231940 = x_231933 + y_231939;
            double x_231941 = u3_231915 - u2_231914;
            double y_231942;
            
            y_231942 = ((double *) ext_mem_219879.mem)[gtid_213767 *
                                                       l_n_m_203733 +
                                                       defunc_0_m_fun_arg_231906];
            
            double x_231943 = x_231941 * y_231942;
            double y_231944 = i64_res_231910 * x_231943;
            double defunc_4_interpolate_proc_res_231945 = x_231940 + y_231944;
            
            ((double *) mem_219886)[i_231898] =
                defunc_4_interpolate_proc_res_231945;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_219902.mem + gtid_213767 * n_203572 * (int64_t) 8,
                    mem_219886 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219886);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236439_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236439_end -
                 futhark_mc_segmap_parloop_236439_start;
        
        ctx->futhark_mc_segmap_parloop_236439_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236439_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236439_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236437(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213766 = tid;
    int num_tasks_231896 = info.nsubtasks;
    struct futhark_mc_task_236436 *futhark_mc_task_236436 =
                                  (struct futhark_mc_task_236436 *) args;
    struct futhark_context *ctx = futhark_mc_task_236436->ctx;
    uint64_t futhark_mc_segmap_task_236437_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236437_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236436->free_n_203572;
    int64_t jump_l_203583 = futhark_mc_task_236436->free_jump_l_203583;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236436->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236436->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236436->free_i_203760;
    int64_t y_205876 = futhark_mc_task_236436->free_y_205876;
    int64_t bytes_217420 = futhark_mc_task_236436->free_bytes_217420;
    struct memblock ext_mem_219879 = {.desc ="ext_mem_219879", .mem =
                                      futhark_mc_task_236436->free_ext_mem_219879,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219880 = {.desc ="ext_mem_219880", .mem =
                                      futhark_mc_task_236436->free_ext_mem_219880,
                                      .size =0, .references =NULL};
    struct memblock mem_219902 = {.desc ="mem_219902", .mem =
                                  futhark_mc_task_236436->free_mem_219902,
                                  .size =0, .references =NULL};
    int64_t iter_231897;
    struct futhark_mc_segmap_parloop_struct_236438
    futhark_mc_segmap_parloop_struct_236438;
    
    futhark_mc_segmap_parloop_struct_236438.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236438.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236438.free_jump_l_203583 = jump_l_203583;
    futhark_mc_segmap_parloop_struct_236438.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236438.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236438.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236438.free_y_205876 = y_205876;
    futhark_mc_segmap_parloop_struct_236438.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236438.free_ext_mem_219879 =
        ext_mem_219879.mem;
    futhark_mc_segmap_parloop_struct_236438.free_ext_mem_219880 =
        ext_mem_219880.mem;
    futhark_mc_segmap_parloop_struct_236438.free_mem_219902 = mem_219902.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236439_task;
    
    futhark_mc_segmap_parloop_236439_task.name =
        "futhark_mc_segmap_parloop_236439";
    futhark_mc_segmap_parloop_236439_task.fn = futhark_mc_segmap_parloop_236439;
    futhark_mc_segmap_parloop_236439_task.args =
        &futhark_mc_segmap_parloop_struct_236438;
    futhark_mc_segmap_parloop_236439_task.iterations = iterations;
    futhark_mc_segmap_parloop_236439_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236439_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236439_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236439_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236439_task);
    
    if (futhark_mc_segmap_parloop_236439_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236439_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236439_total_end -
                 futhark_mc_segmap_parloop_236439_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236439_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236439_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236439_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236437_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236437_end -
                 futhark_mc_segmap_task_236437_start;
        
        ctx->futhark_mc_segmap_task_236437_runs[tid]++;
        ctx->futhark_mc_segmap_task_236437_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236437_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236442 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_l_203583;
    int64_t free_partition_sizze_203667;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_y_205876;
    int64_t free_bytes_217420;
    unsigned char *free_ext_mem_219879;
    unsigned char *free_ext_mem_219880;
    unsigned char *free_mem_219902;
};
struct futhark_mc_task_236445 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_l_203583;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_y_205876;
    int64_t free_gtid_213773;
    unsigned char *free_ext_mem_219879;
    unsigned char *free_ext_mem_219880;
    unsigned char *free_mem_219883;
};
struct futhark_mc_segmap_parloop_struct_236447 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_l_203583;
    int64_t free_l_n_m_203733;
    int64_t free_i_203760;
    int64_t free_y_205876;
    int64_t free_gtid_213773;
    unsigned char *free_ext_mem_219879;
    unsigned char *free_ext_mem_219880;
    unsigned char *free_mem_219883;
};
static int futhark_mc_segmap_parloop_236448(void *args, int64_t start,
                                            int64_t end, int flat_tid_231951,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236447
    *futhark_mc_segmap_parloop_struct_236447 =
    (struct futhark_mc_segmap_parloop_struct_236447 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236447->ctx;
    uint64_t futhark_mc_segmap_parloop_236448_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236448_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236447->free_n_203572;
    int64_t jump_l_203583 =
            futhark_mc_segmap_parloop_struct_236447->free_jump_l_203583;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236447->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236447->free_i_203760;
    int64_t y_205876 = futhark_mc_segmap_parloop_struct_236447->free_y_205876;
    int64_t gtid_213773 =
            futhark_mc_segmap_parloop_struct_236447->free_gtid_213773;
    struct memblock ext_mem_219879 = {.desc ="ext_mem_219879", .mem =
                                      futhark_mc_segmap_parloop_struct_236447->free_ext_mem_219879,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219880 = {.desc ="ext_mem_219880", .mem =
                                      futhark_mc_segmap_parloop_struct_236447->free_ext_mem_219880,
                                      .size =0, .references =NULL};
    struct memblock mem_219883 = {.desc ="mem_219883", .mem =
                                  futhark_mc_segmap_parloop_struct_236447->free_mem_219883,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232002 = start;
    
    for (; iter_232002 < end; iter_232002++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232004 = n_203572;
        int64_t gtid_231952 = iter_232002;
        int64_t remnant_232005 = iter_232002 - gtid_231952;
        int64_t m_v_231953 = sdiv64(gtid_231952, jump_l_203583);
        bool cond_231954 = m_v_231953 == y_205876;
        int64_t j_231955;
        
        if (cond_231954) {
            int64_t j_t_res_232003 = sub64(m_v_231953, (int64_t) 1);
            
            j_231955 = j_t_res_232003;
        } else {
            j_231955 = m_v_231953;
        }
        
        int64_t min_arg_231957 = mul64(jump_l_203583, j_231955);
        int64_t min_res_231958 = smin64(i_203760, min_arg_231957);
        int64_t defunc_0_m_fun_arg_231959 = add64((int64_t) 1, j_231955);
        int64_t min_arg_231960 = mul64(jump_l_203583,
                                       defunc_0_m_fun_arg_231959);
        int64_t min_res_231961 = smin64(i_203760, min_arg_231960);
        int64_t i64_arg_231962 = sub64(min_res_231961, min_res_231958);
        double i64_res_231963 = sitofp_i64_f64(i64_arg_231962);
        int64_t i64_arg_231964 = sub64(gtid_231952, min_res_231958);
        double i64_res_231965 = sitofp_i64_f64(i64_arg_231964);
        double u_231966 = i64_res_231965 / i64_res_231963;
        double u2_231967 = u_231966 * u_231966;
        double u3_231968 = u_231966 * u2_231967;
        double x_231969 = 2.0 * u3_231968;
        double y_231970 = 3.0 * u2_231967;
        double x_231971 = x_231969 - y_231970;
        double x_231972 = 1.0 + x_231971;
        bool x_231973 = sle64((int64_t) 0, j_231955);
        bool y_231974 = slt64(j_231955, l_n_m_203733);
        bool bounds_check_231975 = x_231973 && y_231974;
        bool index_certs_231976;
        
        if (!bounds_check_231975) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) j_231955,
                                   "] out of bounds for array of shape [",
                                   (long long) l_n_m_203733, "].",
                                   "-> #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_231977;
        
        y_231977 = ((double *) ext_mem_219880.mem)[gtid_213773 * l_n_m_203733 +
                                                   j_231955];
        
        double x_231978 = x_231972 * y_231977;
        double x_231979 = y_231970 - x_231969;
        bool x_231980 = sle64((int64_t) 0, defunc_0_m_fun_arg_231959);
        bool y_231981 = slt64(defunc_0_m_fun_arg_231959, l_n_m_203733);
        bool bounds_check_231982 = x_231980 && y_231981;
        bool index_certs_231983;
        
        if (!bounds_check_231982) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [",
                                   (long long) defunc_0_m_fun_arg_231959,
                                   "] out of bounds for array of shape [",
                                   (long long) l_n_m_203733, "].",
                                   "-> #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_231984;
        
        y_231984 = ((double *) ext_mem_219880.mem)[gtid_213773 * l_n_m_203733 +
                                                   defunc_0_m_fun_arg_231959];
        
        double y_231985 = x_231979 * y_231984;
        double x_231986 = x_231978 + y_231985;
        double y_231987 = 2.0 * u2_231967;
        double x_231988 = u3_231968 - y_231987;
        double x_231989 = u_231966 + x_231988;
        double y_231990;
        
        y_231990 = ((double *) ext_mem_219879.mem)[gtid_213773 * l_n_m_203733 +
                                                   j_231955];
        
        double x_231991 = x_231989 * y_231990;
        double y_231992 = i64_res_231963 * x_231991;
        double x_231993 = x_231986 + y_231992;
        double x_231994 = u3_231968 - u2_231967;
        double y_231995;
        
        y_231995 = ((double *) ext_mem_219879.mem)[gtid_213773 * l_n_m_203733 +
                                                   defunc_0_m_fun_arg_231959];
        
        double x_231996 = x_231994 * y_231995;
        double y_231997 = i64_res_231963 * x_231996;
        double defunc_4_interpolate_proc_res_231998 = x_231993 + y_231997;
        
        ((double *) mem_219883.mem)[gtid_231952] =
            defunc_4_interpolate_proc_res_231998;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236448_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236448_end -
                 futhark_mc_segmap_parloop_236448_start;
        
        ctx->futhark_mc_segmap_parloop_236448_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236448_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236448_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236446(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_231951 = tid;
    int num_tasks_232001 = info.nsubtasks;
    struct futhark_mc_task_236445 *futhark_mc_task_236445 =
                                  (struct futhark_mc_task_236445 *) args;
    struct futhark_context *ctx = futhark_mc_task_236445->ctx;
    uint64_t futhark_mc_segmap_task_236446_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236446_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236445->free_n_203572;
    int64_t jump_l_203583 = futhark_mc_task_236445->free_jump_l_203583;
    int64_t l_n_m_203733 = futhark_mc_task_236445->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236445->free_i_203760;
    int64_t y_205876 = futhark_mc_task_236445->free_y_205876;
    int64_t gtid_213773 = futhark_mc_task_236445->free_gtid_213773;
    struct memblock ext_mem_219879 = {.desc ="ext_mem_219879", .mem =
                                      futhark_mc_task_236445->free_ext_mem_219879,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219880 = {.desc ="ext_mem_219880", .mem =
                                      futhark_mc_task_236445->free_ext_mem_219880,
                                      .size =0, .references =NULL};
    struct memblock mem_219883 = {.desc ="mem_219883", .mem =
                                  futhark_mc_task_236445->free_mem_219883,
                                  .size =0, .references =NULL};
    int64_t iter_232002;
    struct futhark_mc_segmap_parloop_struct_236447
    futhark_mc_segmap_parloop_struct_236447;
    
    futhark_mc_segmap_parloop_struct_236447.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236447.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236447.free_jump_l_203583 = jump_l_203583;
    futhark_mc_segmap_parloop_struct_236447.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236447.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236447.free_y_205876 = y_205876;
    futhark_mc_segmap_parloop_struct_236447.free_gtid_213773 = gtid_213773;
    futhark_mc_segmap_parloop_struct_236447.free_ext_mem_219879 =
        ext_mem_219879.mem;
    futhark_mc_segmap_parloop_struct_236447.free_ext_mem_219880 =
        ext_mem_219880.mem;
    futhark_mc_segmap_parloop_struct_236447.free_mem_219883 = mem_219883.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236448_task;
    
    futhark_mc_segmap_parloop_236448_task.name =
        "futhark_mc_segmap_parloop_236448";
    futhark_mc_segmap_parloop_236448_task.fn = futhark_mc_segmap_parloop_236448;
    futhark_mc_segmap_parloop_236448_task.args =
        &futhark_mc_segmap_parloop_struct_236447;
    futhark_mc_segmap_parloop_236448_task.iterations = iterations;
    futhark_mc_segmap_parloop_236448_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236448_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236448_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236448_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236448_task);
    
    if (futhark_mc_segmap_parloop_236448_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236448_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236448_total_end -
                 futhark_mc_segmap_parloop_236448_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236448_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236448_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236448_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236446_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236446_end -
                 futhark_mc_segmap_task_236446_start;
        
        ctx->futhark_mc_segmap_task_236446_runs[tid]++;
        ctx->futhark_mc_segmap_task_236446_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236446_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236443(void *args, int64_t start,
                                            int64_t end, int flat_tid_213772,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236442
    *futhark_mc_segmap_parloop_struct_236442 =
    (struct futhark_mc_segmap_parloop_struct_236442 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236442->ctx;
    uint64_t futhark_mc_segmap_parloop_236443_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236443_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236442->free_n_203572;
    int64_t jump_l_203583 =
            futhark_mc_segmap_parloop_struct_236442->free_jump_l_203583;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236442->free_partition_sizze_203667;
    int64_t l_n_m_203733 =
            futhark_mc_segmap_parloop_struct_236442->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236442->free_i_203760;
    int64_t y_205876 = futhark_mc_segmap_parloop_struct_236442->free_y_205876;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236442->free_bytes_217420;
    struct memblock ext_mem_219879 = {.desc ="ext_mem_219879", .mem =
                                      futhark_mc_segmap_parloop_struct_236442->free_ext_mem_219879,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219880 = {.desc ="ext_mem_219880", .mem =
                                      futhark_mc_segmap_parloop_struct_236442->free_ext_mem_219880,
                                      .size =0, .references =NULL};
    struct memblock mem_219902 = {.desc ="mem_219902", .mem =
                                  futhark_mc_segmap_parloop_struct_236442->free_mem_219902,
                                  .size =0, .references =NULL};
    size_t mem_219883_cached_sizze_236444 = 0;
    unsigned char *mem_219883 = NULL;
    int64_t iterations = end - start;
    int64_t iter_231950 = start;
    
    if (mem_219883_cached_sizze_236444 < (size_t) bytes_217420) {
        mem_219883 = realloc(mem_219883, bytes_217420);
        mem_219883_cached_sizze_236444 = bytes_217420;
    }
    for (; iter_231950 < end; iter_231950++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_231999 = partition_sizze_203667;
        int64_t gtid_213773 = iter_231950;
        int64_t remnant_232000 = iter_231950 - gtid_213773;
        int64_t flat_tid_231951 = (int64_t) 0;
        int32_t num_tasks_232001;
        struct futhark_mc_task_236445 futhark_mc_task_236445;
        
        futhark_mc_task_236445.ctx = ctx;
        futhark_mc_task_236445.free_n_203572 = n_203572;
        futhark_mc_task_236445.free_jump_l_203583 = jump_l_203583;
        futhark_mc_task_236445.free_l_n_m_203733 = l_n_m_203733;
        futhark_mc_task_236445.free_i_203760 = i_203760;
        futhark_mc_task_236445.free_y_205876 = y_205876;
        futhark_mc_task_236445.free_gtid_213773 = gtid_213773;
        futhark_mc_task_236445.free_ext_mem_219879 = ext_mem_219879.mem;
        futhark_mc_task_236445.free_ext_mem_219880 = ext_mem_219880.mem;
        futhark_mc_task_236445.free_mem_219883 = mem_219883;
        
        struct scheduler_segop futhark_mc_task_236445_task;
        
        futhark_mc_task_236445_task.args = &futhark_mc_task_236445;
        futhark_mc_task_236445_task.top_level_fn =
            futhark_mc_segmap_task_236446;
        futhark_mc_task_236445_task.name = "futhark_mc_segmap_task_236446";
        futhark_mc_task_236445_task.iterations = n_203572;
        futhark_mc_task_236445_task.task_time =
            &ctx->futhark_mc_segmap_task_236446_total_time;
        futhark_mc_task_236445_task.task_iter =
            &ctx->futhark_mc_segmap_task_236446_total_iter;
        futhark_mc_task_236445_task.sched = STATIC;
        futhark_mc_task_236445_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236446_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236445_task);
        
        if (futhark_mc_segmap_task_236446_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_219902.mem + gtid_213773 * n_203572 * (int64_t) 8,
                    mem_219883 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219883);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236443_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236443_end -
                 futhark_mc_segmap_parloop_236443_start;
        
        ctx->futhark_mc_segmap_parloop_236443_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236443_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236443_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236441(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213772 = tid;
    int num_tasks_231896 = info.nsubtasks;
    struct futhark_mc_task_236436 *futhark_mc_task_236436 =
                                  (struct futhark_mc_task_236436 *) args;
    struct futhark_context *ctx = futhark_mc_task_236436->ctx;
    uint64_t futhark_mc_segmap_nested_task_236441_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236441_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236436->free_n_203572;
    int64_t jump_l_203583 = futhark_mc_task_236436->free_jump_l_203583;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236436->free_partition_sizze_203667;
    int64_t l_n_m_203733 = futhark_mc_task_236436->free_l_n_m_203733;
    int64_t i_203760 = futhark_mc_task_236436->free_i_203760;
    int64_t y_205876 = futhark_mc_task_236436->free_y_205876;
    int64_t bytes_217420 = futhark_mc_task_236436->free_bytes_217420;
    struct memblock ext_mem_219879 = {.desc ="ext_mem_219879", .mem =
                                      futhark_mc_task_236436->free_ext_mem_219879,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_219880 = {.desc ="ext_mem_219880", .mem =
                                      futhark_mc_task_236436->free_ext_mem_219880,
                                      .size =0, .references =NULL};
    struct memblock mem_219902 = {.desc ="mem_219902", .mem =
                                  futhark_mc_task_236436->free_mem_219902,
                                  .size =0, .references =NULL};
    int64_t iter_231950;
    struct futhark_mc_segmap_parloop_struct_236442
    futhark_mc_segmap_parloop_struct_236442;
    
    futhark_mc_segmap_parloop_struct_236442.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236442.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236442.free_jump_l_203583 = jump_l_203583;
    futhark_mc_segmap_parloop_struct_236442.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236442.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_segmap_parloop_struct_236442.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236442.free_y_205876 = y_205876;
    futhark_mc_segmap_parloop_struct_236442.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236442.free_ext_mem_219879 =
        ext_mem_219879.mem;
    futhark_mc_segmap_parloop_struct_236442.free_ext_mem_219880 =
        ext_mem_219880.mem;
    futhark_mc_segmap_parloop_struct_236442.free_mem_219902 = mem_219902.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236443_task;
    
    futhark_mc_segmap_parloop_236443_task.name =
        "futhark_mc_segmap_parloop_236443";
    futhark_mc_segmap_parloop_236443_task.fn = futhark_mc_segmap_parloop_236443;
    futhark_mc_segmap_parloop_236443_task.args =
        &futhark_mc_segmap_parloop_struct_236442;
    futhark_mc_segmap_parloop_236443_task.iterations = iterations;
    futhark_mc_segmap_parloop_236443_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236443_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236443_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236443_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236443_task);
    
    if (futhark_mc_segmap_parloop_236443_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236443_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236443_total_end -
                 futhark_mc_segmap_parloop_236443_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236443_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236443_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236443_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236441_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236441_end -
                 futhark_mc_segmap_nested_task_236441_start;
        
        ctx->futhark_mc_segmap_nested_task_236441_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236441_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236441_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236449 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    int64_t free_bytes_217420;
    unsigned char *free_mem_219336;
    unsigned char *free_ext_mem_219903;
    int64_t free_ext_219904;
    unsigned char *free_mem_219926;
};
struct futhark_mc_segmap_parloop_struct_236451 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    int64_t free_bytes_217420;
    unsigned char *free_mem_219336;
    unsigned char *free_ext_mem_219903;
    int64_t free_ext_219904;
    unsigned char *free_mem_219926;
};
static int futhark_mc_segmap_parloop_236452(void *args, int64_t start,
                                            int64_t end, int flat_tid_213826,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236451
    *futhark_mc_segmap_parloop_struct_236451 =
    (struct futhark_mc_segmap_parloop_struct_236451 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236451->ctx;
    uint64_t futhark_mc_segmap_parloop_236452_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236452_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236451->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236451->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236451->free_partition_sizze_203667;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236451->free_C_len_203724;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236451->free_bytes_217420;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segmap_parloop_struct_236451->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219903 = {.desc ="ext_mem_219903", .mem =
                                      futhark_mc_segmap_parloop_struct_236451->free_ext_mem_219903,
                                      .size =0, .references =NULL};
    int64_t ext_219904 =
            futhark_mc_segmap_parloop_struct_236451->free_ext_219904;
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236451->free_mem_219926,
                                  .size =0, .references =NULL};
    size_t mem_219910_cached_sizze_236453 = 0;
    unsigned char *mem_219910 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232007 = start;
    
    if (mem_219910_cached_sizze_236453 < (size_t) bytes_217420) {
        mem_219910 = realloc(mem_219910, bytes_217420);
        mem_219910_cached_sizze_236453 = bytes_217420;
    }
    for (; iter_232007 < end; iter_232007++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232015 = partition_sizze_203667;
        int64_t gtid_213827 = iter_232007;
        int64_t remnant_232016 = iter_232007 - gtid_213827;
        
        for (int64_t i_232008 = 0; i_232008 < n_203572; i_232008++) {
            int64_t slice_232010 = n_p_203574 + i_232008;
            double x_232011;
            
            x_232011 = ((double *) mem_219336.mem)[gtid_213827 * C_len_203724 +
                                                   slice_232010];
            
            double x_232012;
            
            x_232012 = ((double *) ext_mem_219903.mem)[gtid_213827 *
                                                       ext_219904 + i_232008];
            
            double defunc_1_f_res_232013 = x_232011 - x_232012;
            
            ((double *) mem_219910)[i_232008] = defunc_1_f_res_232013;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_219926.mem + gtid_213827 * n_203572 * (int64_t) 8,
                    mem_219910 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219910);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236452_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236452_end -
                 futhark_mc_segmap_parloop_236452_start;
        
        ctx->futhark_mc_segmap_parloop_236452_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236452_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236452_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236450(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213826 = tid;
    int num_tasks_232006 = info.nsubtasks;
    struct futhark_mc_task_236449 *futhark_mc_task_236449 =
                                  (struct futhark_mc_task_236449 *) args;
    struct futhark_context *ctx = futhark_mc_task_236449->ctx;
    uint64_t futhark_mc_segmap_task_236450_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236450_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236449->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_236449->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236449->free_partition_sizze_203667;
    int64_t C_len_203724 = futhark_mc_task_236449->free_C_len_203724;
    int64_t bytes_217420 = futhark_mc_task_236449->free_bytes_217420;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236449->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219903 = {.desc ="ext_mem_219903", .mem =
                                      futhark_mc_task_236449->free_ext_mem_219903,
                                      .size =0, .references =NULL};
    int64_t ext_219904 = futhark_mc_task_236449->free_ext_219904;
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236449->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t iter_232007;
    struct futhark_mc_segmap_parloop_struct_236451
    futhark_mc_segmap_parloop_struct_236451;
    
    futhark_mc_segmap_parloop_struct_236451.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236451.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236451.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236451.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236451.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236451.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236451.free_mem_219336 = mem_219336.mem;
    futhark_mc_segmap_parloop_struct_236451.free_ext_mem_219903 =
        ext_mem_219903.mem;
    futhark_mc_segmap_parloop_struct_236451.free_ext_219904 = ext_219904;
    futhark_mc_segmap_parloop_struct_236451.free_mem_219926 = mem_219926.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236452_task;
    
    futhark_mc_segmap_parloop_236452_task.name =
        "futhark_mc_segmap_parloop_236452";
    futhark_mc_segmap_parloop_236452_task.fn = futhark_mc_segmap_parloop_236452;
    futhark_mc_segmap_parloop_236452_task.args =
        &futhark_mc_segmap_parloop_struct_236451;
    futhark_mc_segmap_parloop_236452_task.iterations = iterations;
    futhark_mc_segmap_parloop_236452_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236452_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236452_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236452_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236452_task);
    
    if (futhark_mc_segmap_parloop_236452_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236452_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236452_total_end -
                 futhark_mc_segmap_parloop_236452_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236452_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236452_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236452_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236450_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236450_end -
                 futhark_mc_segmap_task_236450_start;
        
        ctx->futhark_mc_segmap_task_236450_runs[tid]++;
        ctx->futhark_mc_segmap_task_236450_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236450_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236455 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_partition_sizze_203667;
    int64_t free_C_len_203724;
    int64_t free_bytes_217420;
    unsigned char *free_mem_219336;
    unsigned char *free_ext_mem_219903;
    int64_t free_ext_219904;
    unsigned char *free_mem_219926;
};
struct futhark_mc_task_236458 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_C_len_203724;
    int64_t free_gtid_213833;
    unsigned char *free_mem_219336;
    unsigned char *free_ext_mem_219903;
    int64_t free_ext_219904;
    unsigned char *free_mem_219907;
};
struct futhark_mc_segmap_parloop_struct_236460 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_n_p_203574;
    int64_t free_C_len_203724;
    int64_t free_gtid_213833;
    unsigned char *free_mem_219336;
    unsigned char *free_ext_mem_219903;
    int64_t free_ext_219904;
    unsigned char *free_mem_219907;
};
static int futhark_mc_segmap_parloop_236461(void *args, int64_t start,
                                            int64_t end, int flat_tid_232019,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236460
    *futhark_mc_segmap_parloop_struct_236460 =
    (struct futhark_mc_segmap_parloop_struct_236460 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236460->ctx;
    uint64_t futhark_mc_segmap_parloop_236461_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236461_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236460->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236460->free_n_p_203574;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236460->free_C_len_203724;
    int64_t gtid_213833 =
            futhark_mc_segmap_parloop_struct_236460->free_gtid_213833;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segmap_parloop_struct_236460->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219903 = {.desc ="ext_mem_219903", .mem =
                                      futhark_mc_segmap_parloop_struct_236460->free_ext_mem_219903,
                                      .size =0, .references =NULL};
    int64_t ext_219904 =
            futhark_mc_segmap_parloop_struct_236460->free_ext_219904;
    struct memblock mem_219907 = {.desc ="mem_219907", .mem =
                                  futhark_mc_segmap_parloop_struct_236460->free_mem_219907,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232028 = start;
    
    for (; iter_232028 < end; iter_232028++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232029 = n_203572;
        int64_t gtid_232020 = iter_232028;
        int64_t remnant_232030 = iter_232028 - gtid_232020;
        int64_t slice_232021 = n_p_203574 + gtid_232020;
        double x_232022;
        
        x_232022 = ((double *) mem_219336.mem)[gtid_213833 * C_len_203724 +
                                               slice_232021];
        
        double x_232023;
        
        x_232023 = ((double *) ext_mem_219903.mem)[gtid_213833 * ext_219904 +
                                                   gtid_232020];
        
        double defunc_1_f_res_232024 = x_232022 - x_232023;
        
        ((double *) mem_219907.mem)[gtid_232020] = defunc_1_f_res_232024;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236461_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236461_end -
                 futhark_mc_segmap_parloop_236461_start;
        
        ctx->futhark_mc_segmap_parloop_236461_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236461_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236461_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236459(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232019 = tid;
    int num_tasks_232027 = info.nsubtasks;
    struct futhark_mc_task_236458 *futhark_mc_task_236458 =
                                  (struct futhark_mc_task_236458 *) args;
    struct futhark_context *ctx = futhark_mc_task_236458->ctx;
    uint64_t futhark_mc_segmap_task_236459_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236459_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236458->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_236458->free_n_p_203574;
    int64_t C_len_203724 = futhark_mc_task_236458->free_C_len_203724;
    int64_t gtid_213833 = futhark_mc_task_236458->free_gtid_213833;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236458->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219903 = {.desc ="ext_mem_219903", .mem =
                                      futhark_mc_task_236458->free_ext_mem_219903,
                                      .size =0, .references =NULL};
    int64_t ext_219904 = futhark_mc_task_236458->free_ext_219904;
    struct memblock mem_219907 = {.desc ="mem_219907", .mem =
                                  futhark_mc_task_236458->free_mem_219907,
                                  .size =0, .references =NULL};
    int64_t iter_232028;
    struct futhark_mc_segmap_parloop_struct_236460
    futhark_mc_segmap_parloop_struct_236460;
    
    futhark_mc_segmap_parloop_struct_236460.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236460.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236460.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236460.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236460.free_gtid_213833 = gtid_213833;
    futhark_mc_segmap_parloop_struct_236460.free_mem_219336 = mem_219336.mem;
    futhark_mc_segmap_parloop_struct_236460.free_ext_mem_219903 =
        ext_mem_219903.mem;
    futhark_mc_segmap_parloop_struct_236460.free_ext_219904 = ext_219904;
    futhark_mc_segmap_parloop_struct_236460.free_mem_219907 = mem_219907.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236461_task;
    
    futhark_mc_segmap_parloop_236461_task.name =
        "futhark_mc_segmap_parloop_236461";
    futhark_mc_segmap_parloop_236461_task.fn = futhark_mc_segmap_parloop_236461;
    futhark_mc_segmap_parloop_236461_task.args =
        &futhark_mc_segmap_parloop_struct_236460;
    futhark_mc_segmap_parloop_236461_task.iterations = iterations;
    futhark_mc_segmap_parloop_236461_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236461_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236461_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236461_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236461_task);
    
    if (futhark_mc_segmap_parloop_236461_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236461_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236461_total_end -
                 futhark_mc_segmap_parloop_236461_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236461_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236461_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236461_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236459_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236459_end -
                 futhark_mc_segmap_task_236459_start;
        
        ctx->futhark_mc_segmap_task_236459_runs[tid]++;
        ctx->futhark_mc_segmap_task_236459_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236459_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236456(void *args, int64_t start,
                                            int64_t end, int flat_tid_213832,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236455
    *futhark_mc_segmap_parloop_struct_236455 =
    (struct futhark_mc_segmap_parloop_struct_236455 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236455->ctx;
    uint64_t futhark_mc_segmap_parloop_236456_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236456_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236455->free_n_203572;
    int64_t n_p_203574 =
            futhark_mc_segmap_parloop_struct_236455->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236455->free_partition_sizze_203667;
    int64_t C_len_203724 =
            futhark_mc_segmap_parloop_struct_236455->free_C_len_203724;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236455->free_bytes_217420;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_segmap_parloop_struct_236455->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219903 = {.desc ="ext_mem_219903", .mem =
                                      futhark_mc_segmap_parloop_struct_236455->free_ext_mem_219903,
                                      .size =0, .references =NULL};
    int64_t ext_219904 =
            futhark_mc_segmap_parloop_struct_236455->free_ext_219904;
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236455->free_mem_219926,
                                  .size =0, .references =NULL};
    size_t mem_219907_cached_sizze_236457 = 0;
    unsigned char *mem_219907 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232018 = start;
    
    if (mem_219907_cached_sizze_236457 < (size_t) bytes_217420) {
        mem_219907 = realloc(mem_219907, bytes_217420);
        mem_219907_cached_sizze_236457 = bytes_217420;
    }
    for (; iter_232018 < end; iter_232018++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232025 = partition_sizze_203667;
        int64_t gtid_213833 = iter_232018;
        int64_t remnant_232026 = iter_232018 - gtid_213833;
        int64_t flat_tid_232019 = (int64_t) 0;
        int32_t num_tasks_232027;
        struct futhark_mc_task_236458 futhark_mc_task_236458;
        
        futhark_mc_task_236458.ctx = ctx;
        futhark_mc_task_236458.free_n_203572 = n_203572;
        futhark_mc_task_236458.free_n_p_203574 = n_p_203574;
        futhark_mc_task_236458.free_C_len_203724 = C_len_203724;
        futhark_mc_task_236458.free_gtid_213833 = gtid_213833;
        futhark_mc_task_236458.free_mem_219336 = mem_219336.mem;
        futhark_mc_task_236458.free_ext_mem_219903 = ext_mem_219903.mem;
        futhark_mc_task_236458.free_ext_219904 = ext_219904;
        futhark_mc_task_236458.free_mem_219907 = mem_219907;
        
        struct scheduler_segop futhark_mc_task_236458_task;
        
        futhark_mc_task_236458_task.args = &futhark_mc_task_236458;
        futhark_mc_task_236458_task.top_level_fn =
            futhark_mc_segmap_task_236459;
        futhark_mc_task_236458_task.name = "futhark_mc_segmap_task_236459";
        futhark_mc_task_236458_task.iterations = n_203572;
        futhark_mc_task_236458_task.task_time =
            &ctx->futhark_mc_segmap_task_236459_total_time;
        futhark_mc_task_236458_task.task_iter =
            &ctx->futhark_mc_segmap_task_236459_total_iter;
        futhark_mc_task_236458_task.sched = STATIC;
        futhark_mc_task_236458_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236459_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236458_task);
        
        if (futhark_mc_segmap_task_236459_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_219926.mem + gtid_213833 * n_203572 * (int64_t) 8,
                    mem_219907 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219907);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236456_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236456_end -
                 futhark_mc_segmap_parloop_236456_start;
        
        ctx->futhark_mc_segmap_parloop_236456_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236456_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236456_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236454(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213832 = tid;
    int num_tasks_232006 = info.nsubtasks;
    struct futhark_mc_task_236449 *futhark_mc_task_236449 =
                                  (struct futhark_mc_task_236449 *) args;
    struct futhark_context *ctx = futhark_mc_task_236449->ctx;
    uint64_t futhark_mc_segmap_nested_task_236454_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236454_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236449->free_n_203572;
    int64_t n_p_203574 = futhark_mc_task_236449->free_n_p_203574;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236449->free_partition_sizze_203667;
    int64_t C_len_203724 = futhark_mc_task_236449->free_C_len_203724;
    int64_t bytes_217420 = futhark_mc_task_236449->free_bytes_217420;
    struct memblock mem_219336 = {.desc ="mem_219336", .mem =
                                  futhark_mc_task_236449->free_mem_219336,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_219903 = {.desc ="ext_mem_219903", .mem =
                                      futhark_mc_task_236449->free_ext_mem_219903,
                                      .size =0, .references =NULL};
    int64_t ext_219904 = futhark_mc_task_236449->free_ext_219904;
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236449->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t iter_232018;
    struct futhark_mc_segmap_parloop_struct_236455
    futhark_mc_segmap_parloop_struct_236455;
    
    futhark_mc_segmap_parloop_struct_236455.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236455.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236455.free_n_p_203574 = n_p_203574;
    futhark_mc_segmap_parloop_struct_236455.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236455.free_C_len_203724 = C_len_203724;
    futhark_mc_segmap_parloop_struct_236455.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236455.free_mem_219336 = mem_219336.mem;
    futhark_mc_segmap_parloop_struct_236455.free_ext_mem_219903 =
        ext_mem_219903.mem;
    futhark_mc_segmap_parloop_struct_236455.free_ext_219904 = ext_219904;
    futhark_mc_segmap_parloop_struct_236455.free_mem_219926 = mem_219926.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236456_task;
    
    futhark_mc_segmap_parloop_236456_task.name =
        "futhark_mc_segmap_parloop_236456";
    futhark_mc_segmap_parloop_236456_task.fn = futhark_mc_segmap_parloop_236456;
    futhark_mc_segmap_parloop_236456_task.args =
        &futhark_mc_segmap_parloop_struct_236455;
    futhark_mc_segmap_parloop_236456_task.iterations = iterations;
    futhark_mc_segmap_parloop_236456_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236456_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236456_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236456_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236456_task);
    
    if (futhark_mc_segmap_parloop_236456_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236456_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236456_total_end -
                 futhark_mc_segmap_parloop_236456_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236456_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236456_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236456_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236454_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236454_end -
                 futhark_mc_segmap_nested_task_236454_start;
        
        ctx->futhark_mc_segmap_nested_task_236454_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236454_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236454_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236462 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220006;
};
struct futhark_mc_segmap_parloop_struct_236464 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220006;
};
static int futhark_mc_segmap_parloop_236465(void *args, int64_t start,
                                            int64_t end, int flat_tid_213842,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236464
    *futhark_mc_segmap_parloop_struct_236464 =
    (struct futhark_mc_segmap_parloop_struct_236464 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236464->ctx;
    uint64_t futhark_mc_segmap_parloop_236465_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236465_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236464->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236464->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236464->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236464->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236464->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236464->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236464->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236464->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236464->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236464->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236464->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236464->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236464->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236464->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236464->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236464->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236464->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236464->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220006 = {.desc ="mem_220006", .mem =
                                  futhark_mc_segmap_parloop_struct_236464->free_mem_220006,
                                  .size =0, .references =NULL};
    size_t mem_219945_cached_sizze_236466 = 0;
    unsigned char *mem_219945 = NULL;
    size_t mem_219960_cached_sizze_236467 = 0;
    unsigned char *mem_219960 = NULL;
    size_t mem_219963_cached_sizze_236468 = 0;
    unsigned char *mem_219963 = NULL;
    size_t mem_219990_cached_sizze_236469 = 0;
    unsigned char *mem_219990 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232034 = start;
    
    if (mem_219945_cached_sizze_236466 < (size_t) bytes_217420) {
        mem_219945 = realloc(mem_219945, bytes_217420);
        mem_219945_cached_sizze_236466 = bytes_217420;
    }
    if (mem_219960_cached_sizze_236467 < (size_t) bytes_217420) {
        mem_219960 = realloc(mem_219960, bytes_217420);
        mem_219960_cached_sizze_236467 = bytes_217420;
    }
    if (mem_219963_cached_sizze_236468 < (size_t) bytes_217420) {
        mem_219963 = realloc(mem_219963, bytes_217420);
        mem_219963_cached_sizze_236468 = bytes_217420;
    }
    if (mem_219990_cached_sizze_236469 < (size_t) bytes_217900) {
        mem_219990 = realloc(mem_219990, bytes_217900);
        mem_219990_cached_sizze_236469 = bytes_217900;
    }
    for (; iter_232034 < end; iter_232034++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232116 = partition_sizze_203667;
        int64_t gtid_213843 = iter_232034;
        int64_t remnant_232117 = iter_232034 - gtid_213843;
        int64_t x_205951;
        
        x_205951 = ((int64_t *) mem_217461.mem)[gtid_213843];
        for (int64_t i_232035 = 0; i_232035 < n_203572; i_232035++) {
            double x_232037;
            
            x_232037 = ((double *) mem_217415.mem)[gtid_213843 * n_203572 +
                                                   i_232035];
            
            double x_232038;
            
            x_232038 = ((double *) mem_219926.mem)[gtid_213843 * n_203572 +
                                                   i_232035];
            
            double defunc_1_f_res_232039 = x_232037 - x_232038;
            
            ((double *) mem_219945)[i_232035] = defunc_1_f_res_232039;
        }
        for (int64_t i_232041 = 0; i_232041 < n_203572; i_232041++) {
            int64_t x_232044;
            
            x_232044 = ((int64_t *) mem_217458.mem)[gtid_213843 * n_203572 +
                                                    i_232041];
            
            bool cond_232045 = sle64((int64_t) 0, x_232044);
            double defunc_0_f_res_232046;
            
            if (cond_232045) {
                bool y_232047 = slt64(x_232044, n_203572);
                bool bounds_check_232048 = cond_232045 && y_232047;
                bool index_certs_232049;
                
                if (!bounds_check_232048) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232044,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_232050;
                
                defunc_0_f_res_t_res_232050 = ((double *) mem_219945)[x_232044];
                defunc_0_f_res_232046 = defunc_0_f_res_t_res_232050;
            } else {
                defunc_0_f_res_232046 = 0.0;
            }
            
            double defunc_0_f_res_232051;
            
            if (cond_232045) {
                bool y_232052 = slt64(x_232044, n_203572);
                bool bounds_check_232053 = cond_232045 && y_232052;
                bool index_certs_232054;
                
                if (!bounds_check_232053) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232044,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_232055;
                
                defunc_0_f_res_t_res_232055 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_213843 *
                                                       ctx_param_ext_217985 +
                                                       x_232044 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_232051 = defunc_0_f_res_t_res_232055;
            } else {
                defunc_0_f_res_232051 = 0.0;
            }
            ((double *) mem_219960)[i_232041] = defunc_0_f_res_232051;
            ((double *) mem_219963)[i_232041] = defunc_0_f_res_232046;
        }
        for (int64_t i_232058 = 0; i_232058 < t_n_m_203740; i_232058++) {
            int64_t x_232060;
            
            x_232060 = ((int64_t *) mem_217953.mem)[gtid_213843 * t_n_m_203740 +
                                                    i_232058];
            
            double x_232061;
            
            x_232061 = ((double *) mem_217957.mem)[gtid_213843 * t_n_m_203740 +
                                                   i_232058];
            
            int64_t min_arg_232062 = mul64(jump_t_203582, i_232058);
            int64_t min_res_232063 = smin64(i_203760, min_arg_232062);
            int64_t defunc_0_g_res_232064 = add64((int64_t) 1, min_res_232063);
            double defunc_2_reduce_res_232065;
            double redout_232067 = 0.0;
            
            for (int64_t i_232066 = 0; i_232066 < q_t_203576; i_232066++) {
                bool cond_232068 = sle64(x_205951, i_232066);
                int64_t defunc_0_f_res_232069;
                
                if (cond_232068) {
                    defunc_0_f_res_232069 = (int64_t) 0;
                } else {
                    int64_t i_232070 = add64(x_232060, i_232066);
                    int64_t defunc_0_add_arg_232071;
                    
                    defunc_0_add_arg_232071 =
                        ((int64_t *) mem_217458.mem)[gtid_213843 * n_203572 +
                                                     i_232070];
                    
                    int64_t defunc_1_add_res_232072 = add64((int64_t) 1,
                                                            defunc_0_add_arg_232071);
                    
                    defunc_0_f_res_232069 = defunc_1_add_res_232072;
                }
                
                double defunc_0_f_res_232073;
                
                if (cond_232068) {
                    defunc_0_f_res_232073 = 0.0;
                } else {
                    int64_t i_232074 = add64(x_232060, i_232066);
                    double defunc_0_add_arg_232075;
                    
                    defunc_0_add_arg_232075 = ((double *) mem_219960)[i_232074];
                    defunc_0_f_res_232073 = defunc_0_add_arg_232075;
                }
                
                int64_t binop_p_232076 = sub64(defunc_0_f_res_232069,
                                               defunc_0_g_res_232064);
                double defunc_0_f_res_232077 = sitofp_i64_f64(binop_p_232076);
                double abs_res_232078 = fabs(defunc_0_f_res_232077);
                double tmp1_232079 = abs_res_232078 / x_232061;
                double x_232080 = tmp1_232079 * tmp1_232079;
                double y_232081 = tmp1_232079 * x_232080;
                double tmp2_232082 = 1.0 - y_232081;
                double x_232083 = tmp2_232082 * tmp2_232082;
                double tmp3_232084 = tmp2_232082 * x_232083;
                double w_j_232085 = defunc_0_f_res_232073 * tmp3_232084;
                double defunc_1_op_res_232086 = w_j_232085 + redout_232067;
                double redout_tmp_232122 = defunc_1_op_res_232086;
                
                redout_232067 = redout_tmp_232122;
            }
            defunc_2_reduce_res_232065 = redout_232067;
            
            double a0_232087 = 1.0 / defunc_2_reduce_res_232065;
            double defunc_2_reduce_res_232088;
            double redout_232090 = 0.0;
            
            for (int64_t i_232089 = 0; i_232089 < q_t_203576; i_232089++) {
                bool cond_232091 = sle64(x_205951, i_232089);
                int64_t defunc_0_f_res_232092;
                
                if (cond_232091) {
                    defunc_0_f_res_232092 = (int64_t) 0;
                } else {
                    int64_t i_232093 = add64(x_232060, i_232089);
                    int64_t defunc_0_add_arg_232094;
                    
                    defunc_0_add_arg_232094 =
                        ((int64_t *) mem_217458.mem)[gtid_213843 * n_203572 +
                                                     i_232093];
                    
                    int64_t defunc_1_add_res_232095 = add64((int64_t) 1,
                                                            defunc_0_add_arg_232094);
                    
                    defunc_0_f_res_232092 = defunc_1_add_res_232095;
                }
                
                double defunc_0_f_res_232096;
                
                if (cond_232091) {
                    defunc_0_f_res_232096 = 0.0;
                } else {
                    int64_t i_232097 = add64(x_232060, i_232089);
                    double defunc_0_add_arg_232098;
                    
                    defunc_0_add_arg_232098 = ((double *) mem_219960)[i_232097];
                    defunc_0_f_res_232096 = defunc_0_add_arg_232098;
                }
                
                int64_t binop_p_232099 = sub64(defunc_0_f_res_232092,
                                               defunc_0_g_res_232064);
                double defunc_0_f_res_232100 = sitofp_i64_f64(binop_p_232099);
                double abs_res_232101 = fabs(defunc_0_f_res_232100);
                double tmp1_232102 = abs_res_232101 / x_232061;
                double x_232103 = tmp1_232102 * tmp1_232102;
                double y_232104 = tmp1_232102 * x_232103;
                double tmp2_232105 = 1.0 - y_232104;
                double x_232106 = tmp2_232105 * tmp2_232105;
                double tmp3_232107 = tmp2_232105 * x_232106;
                double tmp4_232108 = defunc_0_f_res_232096 * tmp3_232107;
                double defunc_0_f_res_232109;
                
                if (cond_232091) {
                    defunc_0_f_res_232109 = 0.0;
                } else {
                    int64_t i_232110 = add64(x_232060, i_232089);
                    double defunc_0_add_arg_232111;
                    
                    defunc_0_add_arg_232111 = ((double *) mem_219963)[i_232110];
                    defunc_0_f_res_232109 = defunc_0_add_arg_232111;
                }
                
                double x_232112 = a0_232087 * tmp4_232108;
                double defunc_9_fit_fun_res_232113 = defunc_0_f_res_232109 *
                       x_232112;
                double defunc_1_op_res_232114 = defunc_9_fit_fun_res_232113 +
                       redout_232090;
                double redout_tmp_232123 = defunc_1_op_res_232114;
                
                redout_232090 = redout_tmp_232123;
            }
            defunc_2_reduce_res_232088 = redout_232090;
            ((double *) mem_219990)[i_232058] = defunc_2_reduce_res_232088;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220006.mem + gtid_213843 * t_n_m_203740 * (int64_t) 8,
                    mem_219990 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219945);
    free(mem_219960);
    free(mem_219963);
    free(mem_219990);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236465_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236465_end -
                 futhark_mc_segmap_parloop_236465_start;
        
        ctx->futhark_mc_segmap_parloop_236465_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236465_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236465_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236463(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213842 = tid;
    int num_tasks_232033 = info.nsubtasks;
    struct futhark_mc_task_236462 *futhark_mc_task_236462 =
                                  (struct futhark_mc_task_236462 *) args;
    struct futhark_context *ctx = futhark_mc_task_236462->ctx;
    uint64_t futhark_mc_segmap_task_236463_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236463_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236462->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236462->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236462->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236462->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236462->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236462->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236462->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236462->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236462->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236462->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236462->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236462->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236462->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236462->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236462->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236462->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236462->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236462->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220006 = {.desc ="mem_220006", .mem =
                                  futhark_mc_task_236462->free_mem_220006,
                                  .size =0, .references =NULL};
    int64_t iter_232034;
    struct futhark_mc_segmap_parloop_struct_236464
    futhark_mc_segmap_parloop_struct_236464;
    
    futhark_mc_segmap_parloop_struct_236464.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236464.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236464.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236464.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236464.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236464.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236464.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236464.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236464.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236464.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236464.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236464.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236464.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236464.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236464.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236464.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236464.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236464.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236464.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236464.free_mem_220006 = mem_220006.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236465_task;
    
    futhark_mc_segmap_parloop_236465_task.name =
        "futhark_mc_segmap_parloop_236465";
    futhark_mc_segmap_parloop_236465_task.fn = futhark_mc_segmap_parloop_236465;
    futhark_mc_segmap_parloop_236465_task.args =
        &futhark_mc_segmap_parloop_struct_236464;
    futhark_mc_segmap_parloop_236465_task.iterations = iterations;
    futhark_mc_segmap_parloop_236465_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236465_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236465_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236465_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236465_task);
    
    if (futhark_mc_segmap_parloop_236465_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236465_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236465_total_end -
                 futhark_mc_segmap_parloop_236465_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236465_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236465_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236465_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236463_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236463_end -
                 futhark_mc_segmap_task_236463_start;
        
        ctx->futhark_mc_segmap_task_236463_runs[tid]++;
        ctx->futhark_mc_segmap_task_236463_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236463_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236471 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220006;
};
struct futhark_mc_task_236477 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213923;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_219933;
};
struct futhark_mc_segmap_parloop_struct_236479 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213923;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_219933;
};
static int futhark_mc_segmap_parloop_236480(void *args, int64_t start,
                                            int64_t end, int flat_tid_232125,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236479
    *futhark_mc_segmap_parloop_struct_236479 =
    (struct futhark_mc_segmap_parloop_struct_236479 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236479->ctx;
    uint64_t futhark_mc_segmap_parloop_236480_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236480_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236479->free_n_203572;
    int64_t gtid_213923 =
            futhark_mc_segmap_parloop_struct_236479->free_gtid_213923;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236479->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236479->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_219933 = {.desc ="mem_219933", .mem =
                                  futhark_mc_segmap_parloop_struct_236479->free_mem_219933,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232265 = start;
    
    for (; iter_232265 < end; iter_232265++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232266 = n_203572;
        int64_t gtid_232126 = iter_232265;
        int64_t remnant_232267 = iter_232265 - gtid_232126;
        double x_232127;
        
        x_232127 = ((double *) mem_217415.mem)[gtid_213923 * n_203572 +
                                               gtid_232126];
        
        double x_232128;
        
        x_232128 = ((double *) mem_219926.mem)[gtid_213923 * n_203572 +
                                               gtid_232126];
        
        double defunc_1_f_res_232129 = x_232127 - x_232128;
        
        ((double *) mem_219933.mem)[gtid_232126] = defunc_1_f_res_232129;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236480_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236480_end -
                 futhark_mc_segmap_parloop_236480_start;
        
        ctx->futhark_mc_segmap_parloop_236480_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236480_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236480_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236478(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232125 = tid;
    int num_tasks_232264 = info.nsubtasks;
    struct futhark_mc_task_236477 *futhark_mc_task_236477 =
                                  (struct futhark_mc_task_236477 *) args;
    struct futhark_context *ctx = futhark_mc_task_236477->ctx;
    uint64_t futhark_mc_segmap_task_236478_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236478_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236477->free_n_203572;
    int64_t gtid_213923 = futhark_mc_task_236477->free_gtid_213923;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236477->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236477->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_219933 = {.desc ="mem_219933", .mem =
                                  futhark_mc_task_236477->free_mem_219933,
                                  .size =0, .references =NULL};
    int64_t iter_232265;
    struct futhark_mc_segmap_parloop_struct_236479
    futhark_mc_segmap_parloop_struct_236479;
    
    futhark_mc_segmap_parloop_struct_236479.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236479.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236479.free_gtid_213923 = gtid_213923;
    futhark_mc_segmap_parloop_struct_236479.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236479.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236479.free_mem_219933 = mem_219933.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236480_task;
    
    futhark_mc_segmap_parloop_236480_task.name =
        "futhark_mc_segmap_parloop_236480";
    futhark_mc_segmap_parloop_236480_task.fn = futhark_mc_segmap_parloop_236480;
    futhark_mc_segmap_parloop_236480_task.args =
        &futhark_mc_segmap_parloop_struct_236479;
    futhark_mc_segmap_parloop_236480_task.iterations = iterations;
    futhark_mc_segmap_parloop_236480_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236480_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236480_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236480_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236480_task);
    
    if (futhark_mc_segmap_parloop_236480_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236480_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236480_total_end -
                 futhark_mc_segmap_parloop_236480_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236480_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236480_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236480_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236478_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236478_end -
                 futhark_mc_segmap_task_236478_start;
        
        ctx->futhark_mc_segmap_task_236478_runs[tid]++;
        ctx->futhark_mc_segmap_task_236478_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236478_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236481 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213923;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219933;
    unsigned char *free_mem_219936;
    unsigned char *free_mem_219939;
};
struct futhark_mc_segmap_parloop_struct_236483 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213923;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219933;
    unsigned char *free_mem_219936;
    unsigned char *free_mem_219939;
};
static int futhark_mc_segmap_parloop_236484(void *args, int64_t start,
                                            int64_t end, int flat_tid_232130,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236483
    *futhark_mc_segmap_parloop_struct_236483 =
    (struct futhark_mc_segmap_parloop_struct_236483 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236483->ctx;
    uint64_t futhark_mc_segmap_parloop_236484_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236484_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236483->free_n_203572;
    int64_t gtid_213923 =
            futhark_mc_segmap_parloop_struct_236483->free_gtid_213923;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236483->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236483->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236483->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236483->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236483->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219933 = {.desc ="mem_219933", .mem =
                                  futhark_mc_segmap_parloop_struct_236483->free_mem_219933,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_segmap_parloop_struct_236483->free_mem_219936,
                                  .size =0, .references =NULL};
    struct memblock mem_219939 = {.desc ="mem_219939", .mem =
                                  futhark_mc_segmap_parloop_struct_236483->free_mem_219939,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232269 = start;
    
    for (; iter_232269 < end; iter_232269++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232278 = n_203572;
        int64_t gtid_232131 = iter_232269;
        int64_t remnant_232279 = iter_232269 - gtid_232131;
        int64_t x_232132;
        
        x_232132 = ((int64_t *) mem_217458.mem)[gtid_213923 * n_203572 +
                                                gtid_232131];
        
        bool cond_232133 = sle64((int64_t) 0, x_232132);
        double defunc_0_f_res_232134;
        
        if (cond_232133) {
            bool y_232270 = slt64(x_232132, n_203572);
            bool bounds_check_232271 = cond_232133 && y_232270;
            bool index_certs_232272;
            
            if (!bounds_check_232271) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_232132,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_232273;
            
            defunc_0_f_res_t_res_232273 = ((double *) mem_219933.mem)[x_232132];
            defunc_0_f_res_232134 = defunc_0_f_res_t_res_232273;
        } else {
            defunc_0_f_res_232134 = 0.0;
        }
        
        double defunc_0_f_res_232139;
        
        if (cond_232133) {
            bool y_232274 = slt64(x_232132, n_203572);
            bool bounds_check_232275 = cond_232133 && y_232274;
            bool index_certs_232276;
            
            if (!bounds_check_232275) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_232132,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_232277;
            
            defunc_0_f_res_t_res_232277 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_213923 *
                                                   ctx_param_ext_217985 +
                                                   x_232132 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_232139 = defunc_0_f_res_t_res_232277;
        } else {
            defunc_0_f_res_232139 = 0.0;
        }
        ((double *) mem_219936.mem)[gtid_232131] = defunc_0_f_res_232139;
        ((double *) mem_219939.mem)[gtid_232131] = defunc_0_f_res_232134;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236484_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236484_end -
                 futhark_mc_segmap_parloop_236484_start;
        
        ctx->futhark_mc_segmap_parloop_236484_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236484_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236484_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236482(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232130 = tid;
    int num_tasks_232268 = info.nsubtasks;
    struct futhark_mc_task_236481 *futhark_mc_task_236481 =
                                  (struct futhark_mc_task_236481 *) args;
    struct futhark_context *ctx = futhark_mc_task_236481->ctx;
    uint64_t futhark_mc_segmap_task_236482_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236482_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236481->free_n_203572;
    int64_t gtid_213923 = futhark_mc_task_236481->free_gtid_213923;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236481->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236481->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236481->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236481->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236481->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219933 = {.desc ="mem_219933", .mem =
                                  futhark_mc_task_236481->free_mem_219933,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_task_236481->free_mem_219936,
                                  .size =0, .references =NULL};
    struct memblock mem_219939 = {.desc ="mem_219939", .mem =
                                  futhark_mc_task_236481->free_mem_219939,
                                  .size =0, .references =NULL};
    int64_t iter_232269;
    struct futhark_mc_segmap_parloop_struct_236483
    futhark_mc_segmap_parloop_struct_236483;
    
    futhark_mc_segmap_parloop_struct_236483.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236483.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236483.free_gtid_213923 = gtid_213923;
    futhark_mc_segmap_parloop_struct_236483.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236483.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236483.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236483.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236483.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236483.free_mem_219933 = mem_219933.mem;
    futhark_mc_segmap_parloop_struct_236483.free_mem_219936 = mem_219936.mem;
    futhark_mc_segmap_parloop_struct_236483.free_mem_219939 = mem_219939.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236484_task;
    
    futhark_mc_segmap_parloop_236484_task.name =
        "futhark_mc_segmap_parloop_236484";
    futhark_mc_segmap_parloop_236484_task.fn = futhark_mc_segmap_parloop_236484;
    futhark_mc_segmap_parloop_236484_task.args =
        &futhark_mc_segmap_parloop_struct_236483;
    futhark_mc_segmap_parloop_236484_task.iterations = iterations;
    futhark_mc_segmap_parloop_236484_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236484_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236484_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236484_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236484_task);
    
    if (futhark_mc_segmap_parloop_236484_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236484_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236484_total_end -
                 futhark_mc_segmap_parloop_236484_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236484_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236484_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236484_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236482_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236482_end -
                 futhark_mc_segmap_task_236482_start;
        
        ctx->futhark_mc_segmap_task_236482_runs[tid]++;
        ctx->futhark_mc_segmap_task_236482_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236482_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236485 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_213923;
    int64_t free_x_213928;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_219936;
    unsigned char *free_mem_219939;
    unsigned char *free_mem_219942;
};
struct futhark_mc_segmap_parloop_struct_236487 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_213923;
    int64_t free_x_213928;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_219936;
    unsigned char *free_mem_219939;
    unsigned char *free_mem_219942;
};
static int futhark_mc_segmap_parloop_236488(void *args, int64_t start,
                                            int64_t end, int flat_tid_232205,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236487
    *futhark_mc_segmap_parloop_struct_236487 =
    (struct futhark_mc_segmap_parloop_struct_236487 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236487->ctx;
    uint64_t futhark_mc_segmap_parloop_236488_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236488_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236487->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236487->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236487->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236487->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236487->free_i_203760;
    int64_t gtid_213923 =
            futhark_mc_segmap_parloop_struct_236487->free_gtid_213923;
    int64_t x_213928 = futhark_mc_segmap_parloop_struct_236487->free_x_213928;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236487->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236487->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236487->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_segmap_parloop_struct_236487->free_mem_219936,
                                  .size =0, .references =NULL};
    struct memblock mem_219939 = {.desc ="mem_219939", .mem =
                                  futhark_mc_segmap_parloop_struct_236487->free_mem_219939,
                                  .size =0, .references =NULL};
    struct memblock mem_219942 = {.desc ="mem_219942", .mem =
                                  futhark_mc_segmap_parloop_struct_236487->free_mem_219942,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232281 = start;
    
    for (; iter_232281 < end; iter_232281++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232329 = t_n_m_203740;
        int64_t gtid_232206 = iter_232281;
        int64_t remnant_232330 = iter_232281 - gtid_232206;
        int64_t x_232207;
        
        x_232207 = ((int64_t *) mem_217953.mem)[gtid_213923 * t_n_m_203740 +
                                                gtid_232206];
        
        double x_232208;
        
        x_232208 = ((double *) mem_217957.mem)[gtid_213923 * t_n_m_203740 +
                                               gtid_232206];
        
        int64_t min_arg_232209 = mul64(jump_t_203582, gtid_232206);
        int64_t min_res_232210 = smin64(i_203760, min_arg_232209);
        int64_t defunc_0_g_res_232211 = add64((int64_t) 1, min_res_232210);
        double defunc_2_reduce_res_232212;
        double redout_232283 = 0.0;
        
        for (int64_t i_232282 = 0; i_232282 < q_t_203576; i_232282++) {
            bool cond_232284 = sle64(x_213928, i_232282);
            int64_t defunc_0_f_res_232285;
            
            if (cond_232284) {
                defunc_0_f_res_232285 = (int64_t) 0;
            } else {
                int64_t i_232286 = add64(x_232207, i_232282);
                int64_t defunc_0_add_arg_232287;
                
                defunc_0_add_arg_232287 =
                    ((int64_t *) mem_217458.mem)[gtid_213923 * n_203572 +
                                                 i_232286];
                
                int64_t defunc_1_add_res_232288 = add64((int64_t) 1,
                                                        defunc_0_add_arg_232287);
                
                defunc_0_f_res_232285 = defunc_1_add_res_232288;
            }
            
            double defunc_0_f_res_232289;
            
            if (cond_232284) {
                defunc_0_f_res_232289 = 0.0;
            } else {
                int64_t i_232290 = add64(x_232207, i_232282);
                double defunc_0_add_arg_232291;
                
                defunc_0_add_arg_232291 = ((double *) mem_219936.mem)[i_232290];
                defunc_0_f_res_232289 = defunc_0_add_arg_232291;
            }
            
            int64_t binop_p_232292 = sub64(defunc_0_f_res_232285,
                                           defunc_0_g_res_232211);
            double defunc_0_f_res_232293 = sitofp_i64_f64(binop_p_232292);
            double abs_res_232294 = fabs(defunc_0_f_res_232293);
            double tmp1_232295 = abs_res_232294 / x_232208;
            double x_232296 = tmp1_232295 * tmp1_232295;
            double y_232297 = tmp1_232295 * x_232296;
            double tmp2_232298 = 1.0 - y_232297;
            double x_232299 = tmp2_232298 * tmp2_232298;
            double tmp3_232300 = tmp2_232298 * x_232299;
            double w_j_232301 = defunc_0_f_res_232289 * tmp3_232300;
            double defunc_1_op_res_232302 = w_j_232301 + redout_232283;
            double redout_tmp_232331 = defunc_1_op_res_232302;
            
            redout_232283 = redout_tmp_232331;
        }
        defunc_2_reduce_res_232212 = redout_232283;
        
        double a0_232234 = 1.0 / defunc_2_reduce_res_232212;
        double defunc_2_reduce_res_232235;
        double redout_232304 = 0.0;
        
        for (int64_t i_232303 = 0; i_232303 < q_t_203576; i_232303++) {
            bool cond_232305 = sle64(x_213928, i_232303);
            int64_t defunc_0_f_res_232306;
            
            if (cond_232305) {
                defunc_0_f_res_232306 = (int64_t) 0;
            } else {
                int64_t i_232307 = add64(x_232207, i_232303);
                int64_t defunc_0_add_arg_232308;
                
                defunc_0_add_arg_232308 =
                    ((int64_t *) mem_217458.mem)[gtid_213923 * n_203572 +
                                                 i_232307];
                
                int64_t defunc_1_add_res_232309 = add64((int64_t) 1,
                                                        defunc_0_add_arg_232308);
                
                defunc_0_f_res_232306 = defunc_1_add_res_232309;
            }
            
            double defunc_0_f_res_232310;
            
            if (cond_232305) {
                defunc_0_f_res_232310 = 0.0;
            } else {
                int64_t i_232311 = add64(x_232207, i_232303);
                double defunc_0_add_arg_232312;
                
                defunc_0_add_arg_232312 = ((double *) mem_219936.mem)[i_232311];
                defunc_0_f_res_232310 = defunc_0_add_arg_232312;
            }
            
            int64_t binop_p_232313 = sub64(defunc_0_f_res_232306,
                                           defunc_0_g_res_232211);
            double defunc_0_f_res_232314 = sitofp_i64_f64(binop_p_232313);
            double abs_res_232315 = fabs(defunc_0_f_res_232314);
            double tmp1_232316 = abs_res_232315 / x_232208;
            double x_232317 = tmp1_232316 * tmp1_232316;
            double y_232318 = tmp1_232316 * x_232317;
            double tmp2_232319 = 1.0 - y_232318;
            double x_232320 = tmp2_232319 * tmp2_232319;
            double tmp3_232321 = tmp2_232319 * x_232320;
            double tmp4_232322 = defunc_0_f_res_232310 * tmp3_232321;
            double defunc_0_f_res_232323;
            
            if (cond_232305) {
                defunc_0_f_res_232323 = 0.0;
            } else {
                int64_t i_232324 = add64(x_232207, i_232303);
                double defunc_0_add_arg_232325;
                
                defunc_0_add_arg_232325 = ((double *) mem_219939.mem)[i_232324];
                defunc_0_f_res_232323 = defunc_0_add_arg_232325;
            }
            
            double x_232326 = a0_232234 * tmp4_232322;
            double defunc_9_fit_fun_res_232327 = defunc_0_f_res_232323 *
                   x_232326;
            double defunc_1_op_res_232328 = defunc_9_fit_fun_res_232327 +
                   redout_232304;
            double redout_tmp_232332 = defunc_1_op_res_232328;
            
            redout_232304 = redout_tmp_232332;
        }
        defunc_2_reduce_res_232235 = redout_232304;
        ((double *) mem_219942.mem)[gtid_232206] = defunc_2_reduce_res_232235;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236488_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236488_end -
                 futhark_mc_segmap_parloop_236488_start;
        
        ctx->futhark_mc_segmap_parloop_236488_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236488_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236488_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236486(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232205 = tid;
    int num_tasks_232280 = info.nsubtasks;
    struct futhark_mc_task_236485 *futhark_mc_task_236485 =
                                  (struct futhark_mc_task_236485 *) args;
    struct futhark_context *ctx = futhark_mc_task_236485->ctx;
    uint64_t futhark_mc_segmap_task_236486_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236486_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236485->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236485->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236485->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236485->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236485->free_i_203760;
    int64_t gtid_213923 = futhark_mc_task_236485->free_gtid_213923;
    int64_t x_213928 = futhark_mc_task_236485->free_x_213928;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236485->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236485->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236485->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_task_236485->free_mem_219936,
                                  .size =0, .references =NULL};
    struct memblock mem_219939 = {.desc ="mem_219939", .mem =
                                  futhark_mc_task_236485->free_mem_219939,
                                  .size =0, .references =NULL};
    struct memblock mem_219942 = {.desc ="mem_219942", .mem =
                                  futhark_mc_task_236485->free_mem_219942,
                                  .size =0, .references =NULL};
    int64_t iter_232281;
    struct futhark_mc_segmap_parloop_struct_236487
    futhark_mc_segmap_parloop_struct_236487;
    
    futhark_mc_segmap_parloop_struct_236487.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236487.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236487.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236487.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236487.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236487.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236487.free_gtid_213923 = gtid_213923;
    futhark_mc_segmap_parloop_struct_236487.free_x_213928 = x_213928;
    futhark_mc_segmap_parloop_struct_236487.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236487.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236487.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236487.free_mem_219936 = mem_219936.mem;
    futhark_mc_segmap_parloop_struct_236487.free_mem_219939 = mem_219939.mem;
    futhark_mc_segmap_parloop_struct_236487.free_mem_219942 = mem_219942.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236488_task;
    
    futhark_mc_segmap_parloop_236488_task.name =
        "futhark_mc_segmap_parloop_236488";
    futhark_mc_segmap_parloop_236488_task.fn = futhark_mc_segmap_parloop_236488;
    futhark_mc_segmap_parloop_236488_task.args =
        &futhark_mc_segmap_parloop_struct_236487;
    futhark_mc_segmap_parloop_236488_task.iterations = iterations;
    futhark_mc_segmap_parloop_236488_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236488_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236488_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236488_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236488_task);
    
    if (futhark_mc_segmap_parloop_236488_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236488_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236488_total_end -
                 futhark_mc_segmap_parloop_236488_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236488_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236488_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236488_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236486_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236486_end -
                 futhark_mc_segmap_task_236486_start;
        
        ctx->futhark_mc_segmap_task_236486_runs[tid]++;
        ctx->futhark_mc_segmap_task_236486_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236486_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236490 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_213923;
    int64_t free_x_213928;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_219936;
    unsigned char *free_mem_219939;
    unsigned char *free_mem_219942;
};
struct futhark_mc_task_236492 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213923;
    int64_t free_x_213928;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_219936;
    int64_t free_x_232146;
    double free_x_232147;
    int64_t free_defunc_0_g_res_232150;
    double *retval_defunc_2_reduce_res_232151;
};
struct futhark_mc_segred_stage_1_parloop_struct_236495 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213923;
    int64_t free_x_213928;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_219936;
    int64_t free_x_232146;
    double free_x_232147;
    int64_t free_defunc_0_g_res_232150;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232388;
};
static int futhark_mc_segred_stage_1_parloop_236496(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_232334,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236495
    *futhark_mc_segred_stage_1_parloop_struct_236495 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236495 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236495->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236496_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236496_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236495->free_n_203572;
    int64_t gtid_213923 =
            futhark_mc_segred_stage_1_parloop_struct_236495->free_gtid_213923;
    int64_t x_213928 =
            futhark_mc_segred_stage_1_parloop_struct_236495->free_x_213928;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236495->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236495->free_mem_219936,
                                  .size =0, .references =NULL};
    int64_t x_232146 =
            futhark_mc_segred_stage_1_parloop_struct_236495->free_x_232146;
    double x_232147 =
           futhark_mc_segred_stage_1_parloop_struct_236495->free_x_232147;
    int64_t defunc_0_g_res_232150 =
            futhark_mc_segred_stage_1_parloop_struct_236495->free_defunc_0_g_res_232150;
    struct memblock reduce_stage_1_tid_res_arr_mem_232388 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232388",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236495->free_reduce_stage_1_tid_res_arr_mem_232388,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232390 = start;
    double x_232336;
    double x_232337;
    double local_acc_232391 = 0.0;
    
    for (; iter_232390 < end; iter_232390++) {
        int64_t gtid_232335 = iter_232390;
        bool cond_232339 = sle64(x_213928, gtid_232335);
        int64_t defunc_0_f_res_232340;
        
        if (cond_232339) {
            defunc_0_f_res_232340 = (int64_t) 0;
        } else {
            int64_t i_232341 = add64(x_232146, gtid_232335);
            int64_t defunc_0_add_arg_232342;
            
            defunc_0_add_arg_232342 = ((int64_t *) mem_217458.mem)[gtid_213923 *
                                                                   n_203572 +
                                                                   i_232341];
            
            int64_t defunc_1_add_res_232343 = add64((int64_t) 1,
                                                    defunc_0_add_arg_232342);
            
            defunc_0_f_res_232340 = defunc_1_add_res_232343;
        }
        
        double defunc_0_f_res_232344;
        
        if (cond_232339) {
            defunc_0_f_res_232344 = 0.0;
        } else {
            int64_t i_232345 = add64(x_232146, gtid_232335);
            double defunc_0_add_arg_232346;
            
            defunc_0_add_arg_232346 = ((double *) mem_219936.mem)[i_232345];
            defunc_0_f_res_232344 = defunc_0_add_arg_232346;
        }
        
        int64_t binop_p_232347 = sub64(defunc_0_f_res_232340,
                                       defunc_0_g_res_232150);
        double defunc_0_f_res_232348 = sitofp_i64_f64(binop_p_232347);
        double abs_res_232349 = fabs(defunc_0_f_res_232348);
        double tmp1_232350 = abs_res_232349 / x_232147;
        double x_232351 = tmp1_232350 * tmp1_232350;
        double y_232352 = tmp1_232350 * x_232351;
        double tmp2_232353 = 1.0 - y_232352;
        double x_232354 = tmp2_232353 * tmp2_232353;
        double tmp3_232355 = tmp2_232353 * x_232354;
        double w_j_232356 = defunc_0_f_res_232344 * tmp3_232355;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_232336 = local_acc_232391;
        }
        // Load next params
        {
            x_232337 = w_j_232356;
        }
        // Red body
        {
            double defunc_1_op_res_232338 = x_232336 + x_232337;
            
            local_acc_232391 = defunc_1_op_res_232338;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_232388.mem)[flat_tid_232334] =
        local_acc_232391;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236496_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236496_end -
                 futhark_mc_segred_stage_1_parloop_236496_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236496_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236496_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236496_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236493(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232334 = tid;
    int num_tasks_232387 = info.nsubtasks;
    struct futhark_mc_task_236492 *futhark_mc_task_236492 =
                                  (struct futhark_mc_task_236492 *) args;
    struct futhark_context *ctx = futhark_mc_task_236492->ctx;
    uint64_t futhark_mc_segred_task_236493_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236493_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236492->free_n_203572;
    int64_t gtid_213923 = futhark_mc_task_236492->free_gtid_213923;
    int64_t x_213928 = futhark_mc_task_236492->free_x_213928;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236492->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_task_236492->free_mem_219936,
                                  .size =0, .references =NULL};
    int64_t x_232146 = futhark_mc_task_236492->free_x_232146;
    double x_232147 = futhark_mc_task_236492->free_x_232147;
    int64_t defunc_0_g_res_232150 =
            futhark_mc_task_236492->free_defunc_0_g_res_232150;
    double defunc_2_reduce_res_232151 =
           *futhark_mc_task_236492->retval_defunc_2_reduce_res_232151;
    size_t reduce_stage_1_tid_res_arr_mem_232388_cached_sizze_236494 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232388 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_232388_cached_sizze_236494 <
        (size_t) ((int64_t) 8 * num_tasks_232387)) {
        reduce_stage_1_tid_res_arr_mem_232388 =
            realloc(reduce_stage_1_tid_res_arr_mem_232388, (int64_t) 8 *
                    num_tasks_232387);
        reduce_stage_1_tid_res_arr_mem_232388_cached_sizze_236494 =
            (int64_t) 8 * num_tasks_232387;
    }
    
    int64_t iter_232390;
    struct futhark_mc_segred_stage_1_parloop_struct_236495
    futhark_mc_segred_stage_1_parloop_struct_236495;
    
    futhark_mc_segred_stage_1_parloop_struct_236495.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236495.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236495.free_gtid_213923 =
        gtid_213923;
    futhark_mc_segred_stage_1_parloop_struct_236495.free_x_213928 = x_213928;
    futhark_mc_segred_stage_1_parloop_struct_236495.free_mem_217458 =
        mem_217458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236495.free_mem_219936 =
        mem_219936.mem;
    futhark_mc_segred_stage_1_parloop_struct_236495.free_x_232146 = x_232146;
    futhark_mc_segred_stage_1_parloop_struct_236495.free_x_232147 = x_232147;
    futhark_mc_segred_stage_1_parloop_struct_236495.free_defunc_0_g_res_232150 =
        defunc_0_g_res_232150;
    futhark_mc_segred_stage_1_parloop_struct_236495.free_reduce_stage_1_tid_res_arr_mem_232388 =
        reduce_stage_1_tid_res_arr_mem_232388;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236496_task;
    
    futhark_mc_segred_stage_1_parloop_236496_task.name =
        "futhark_mc_segred_stage_1_parloop_236496";
    futhark_mc_segred_stage_1_parloop_236496_task.fn =
        futhark_mc_segred_stage_1_parloop_236496;
    futhark_mc_segred_stage_1_parloop_236496_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236495;
    futhark_mc_segred_stage_1_parloop_236496_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236496_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236496_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236496_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236496_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236496_task);
    
    if (futhark_mc_segred_stage_1_parloop_236496_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236496_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236496_total_end -
                 futhark_mc_segred_stage_1_parloop_236496_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236496_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236496_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236496_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_232151 = 0.0;
    }
    
    double x_232392;
    double x_232393;
    
    for (int32_t i_232395 = 0; i_232395 < num_tasks_232387; i_232395++) {
        flat_tid_232334 = i_232395;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_232392 = defunc_2_reduce_res_232151;
            }
            // load next params
            {
                x_232393 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232388)[flat_tid_232334];
            }
            // red body
            {
                double defunc_1_op_res_232394 = x_232392 + x_232393;
                
                defunc_2_reduce_res_232151 = defunc_1_op_res_232394;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_232388);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236493_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236493_end -
                 futhark_mc_segred_task_236493_start;
        
        ctx->futhark_mc_segred_task_236493_runs[tid]++;
        ctx->futhark_mc_segred_task_236493_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236493_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236492->retval_defunc_2_reduce_res_232151 =
            defunc_2_reduce_res_232151;
    }
    return err;
}
struct futhark_mc_task_236497 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213923;
    int64_t free_x_213928;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_219936;
    unsigned char *free_mem_219939;
    int64_t free_x_232146;
    double free_x_232147;
    int64_t free_defunc_0_g_res_232150;
    double free_a0_232175;
    double *retval_defunc_2_reduce_res_232176;
};
struct futhark_mc_segred_stage_1_parloop_struct_236500 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_213923;
    int64_t free_x_213928;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_219936;
    unsigned char *free_mem_219939;
    int64_t free_x_232146;
    double free_x_232147;
    int64_t free_defunc_0_g_res_232150;
    double free_a0_232175;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232397;
};
static int futhark_mc_segred_stage_1_parloop_236501(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_232357,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236500
    *futhark_mc_segred_stage_1_parloop_struct_236500 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236500 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236500->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236501_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236501_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236500->free_n_203572;
    int64_t gtid_213923 =
            futhark_mc_segred_stage_1_parloop_struct_236500->free_gtid_213923;
    int64_t x_213928 =
            futhark_mc_segred_stage_1_parloop_struct_236500->free_x_213928;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236500->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236500->free_mem_219936,
                                  .size =0, .references =NULL};
    struct memblock mem_219939 = {.desc ="mem_219939", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236500->free_mem_219939,
                                  .size =0, .references =NULL};
    int64_t x_232146 =
            futhark_mc_segred_stage_1_parloop_struct_236500->free_x_232146;
    double x_232147 =
           futhark_mc_segred_stage_1_parloop_struct_236500->free_x_232147;
    int64_t defunc_0_g_res_232150 =
            futhark_mc_segred_stage_1_parloop_struct_236500->free_defunc_0_g_res_232150;
    double a0_232175 =
           futhark_mc_segred_stage_1_parloop_struct_236500->free_a0_232175;
    struct memblock reduce_stage_1_tid_res_arr_mem_232397 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232397",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236500->free_reduce_stage_1_tid_res_arr_mem_232397,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232399 = start;
    double x_232359;
    double x_232360;
    double local_acc_232400 = 0.0;
    
    for (; iter_232399 < end; iter_232399++) {
        int64_t gtid_232358 = iter_232399;
        bool cond_232362 = sle64(x_213928, gtid_232358);
        int64_t defunc_0_f_res_232363;
        
        if (cond_232362) {
            defunc_0_f_res_232363 = (int64_t) 0;
        } else {
            int64_t i_232364 = add64(x_232146, gtid_232358);
            int64_t defunc_0_add_arg_232365;
            
            defunc_0_add_arg_232365 = ((int64_t *) mem_217458.mem)[gtid_213923 *
                                                                   n_203572 +
                                                                   i_232364];
            
            int64_t defunc_1_add_res_232366 = add64((int64_t) 1,
                                                    defunc_0_add_arg_232365);
            
            defunc_0_f_res_232363 = defunc_1_add_res_232366;
        }
        
        double defunc_0_f_res_232367;
        
        if (cond_232362) {
            defunc_0_f_res_232367 = 0.0;
        } else {
            int64_t i_232368 = add64(x_232146, gtid_232358);
            double defunc_0_add_arg_232369;
            
            defunc_0_add_arg_232369 = ((double *) mem_219936.mem)[i_232368];
            defunc_0_f_res_232367 = defunc_0_add_arg_232369;
        }
        
        int64_t binop_p_232370 = sub64(defunc_0_f_res_232363,
                                       defunc_0_g_res_232150);
        double defunc_0_f_res_232371 = sitofp_i64_f64(binop_p_232370);
        double abs_res_232372 = fabs(defunc_0_f_res_232371);
        double tmp1_232373 = abs_res_232372 / x_232147;
        double x_232374 = tmp1_232373 * tmp1_232373;
        double y_232375 = tmp1_232373 * x_232374;
        double tmp2_232376 = 1.0 - y_232375;
        double x_232377 = tmp2_232376 * tmp2_232376;
        double tmp3_232378 = tmp2_232376 * x_232377;
        double tmp4_232379 = defunc_0_f_res_232367 * tmp3_232378;
        double defunc_0_f_res_232380;
        
        if (cond_232362) {
            defunc_0_f_res_232380 = 0.0;
        } else {
            int64_t i_232381 = add64(x_232146, gtid_232358);
            double defunc_0_add_arg_232382;
            
            defunc_0_add_arg_232382 = ((double *) mem_219939.mem)[i_232381];
            defunc_0_f_res_232380 = defunc_0_add_arg_232382;
        }
        
        double x_232383 = a0_232175 * tmp4_232379;
        double defunc_9_fit_fun_res_232384 = defunc_0_f_res_232380 * x_232383;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_232359 = local_acc_232400;
        }
        // Load next params
        {
            x_232360 = defunc_9_fit_fun_res_232384;
        }
        // Red body
        {
            double defunc_1_op_res_232361 = x_232359 + x_232360;
            
            local_acc_232400 = defunc_1_op_res_232361;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_232397.mem)[flat_tid_232357] =
        local_acc_232400;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236501_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236501_end -
                 futhark_mc_segred_stage_1_parloop_236501_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236501_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236501_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236501_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236498(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232357 = tid;
    int num_tasks_232396 = info.nsubtasks;
    struct futhark_mc_task_236497 *futhark_mc_task_236497 =
                                  (struct futhark_mc_task_236497 *) args;
    struct futhark_context *ctx = futhark_mc_task_236497->ctx;
    uint64_t futhark_mc_segred_task_236498_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236498_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236497->free_n_203572;
    int64_t gtid_213923 = futhark_mc_task_236497->free_gtid_213923;
    int64_t x_213928 = futhark_mc_task_236497->free_x_213928;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236497->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_task_236497->free_mem_219936,
                                  .size =0, .references =NULL};
    struct memblock mem_219939 = {.desc ="mem_219939", .mem =
                                  futhark_mc_task_236497->free_mem_219939,
                                  .size =0, .references =NULL};
    int64_t x_232146 = futhark_mc_task_236497->free_x_232146;
    double x_232147 = futhark_mc_task_236497->free_x_232147;
    int64_t defunc_0_g_res_232150 =
            futhark_mc_task_236497->free_defunc_0_g_res_232150;
    double a0_232175 = futhark_mc_task_236497->free_a0_232175;
    double defunc_2_reduce_res_232176 =
           *futhark_mc_task_236497->retval_defunc_2_reduce_res_232176;
    size_t reduce_stage_1_tid_res_arr_mem_232397_cached_sizze_236499 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232397 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_232397_cached_sizze_236499 <
        (size_t) ((int64_t) 8 * num_tasks_232396)) {
        reduce_stage_1_tid_res_arr_mem_232397 =
            realloc(reduce_stage_1_tid_res_arr_mem_232397, (int64_t) 8 *
                    num_tasks_232396);
        reduce_stage_1_tid_res_arr_mem_232397_cached_sizze_236499 =
            (int64_t) 8 * num_tasks_232396;
    }
    
    int64_t iter_232399;
    struct futhark_mc_segred_stage_1_parloop_struct_236500
    futhark_mc_segred_stage_1_parloop_struct_236500;
    
    futhark_mc_segred_stage_1_parloop_struct_236500.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_gtid_213923 =
        gtid_213923;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_x_213928 = x_213928;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_mem_217458 =
        mem_217458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_mem_219936 =
        mem_219936.mem;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_mem_219939 =
        mem_219939.mem;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_x_232146 = x_232146;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_x_232147 = x_232147;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_defunc_0_g_res_232150 =
        defunc_0_g_res_232150;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_a0_232175 = a0_232175;
    futhark_mc_segred_stage_1_parloop_struct_236500.free_reduce_stage_1_tid_res_arr_mem_232397 =
        reduce_stage_1_tid_res_arr_mem_232397;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236501_task;
    
    futhark_mc_segred_stage_1_parloop_236501_task.name =
        "futhark_mc_segred_stage_1_parloop_236501";
    futhark_mc_segred_stage_1_parloop_236501_task.fn =
        futhark_mc_segred_stage_1_parloop_236501;
    futhark_mc_segred_stage_1_parloop_236501_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236500;
    futhark_mc_segred_stage_1_parloop_236501_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236501_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236501_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236501_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236501_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236501_task);
    
    if (futhark_mc_segred_stage_1_parloop_236501_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236501_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236501_total_end -
                 futhark_mc_segred_stage_1_parloop_236501_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236501_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236501_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236501_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_232176 = 0.0;
    }
    
    double x_232401;
    double x_232402;
    
    for (int32_t i_232404 = 0; i_232404 < num_tasks_232396; i_232404++) {
        flat_tid_232357 = i_232404;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_232401 = defunc_2_reduce_res_232176;
            }
            // load next params
            {
                x_232402 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232397)[flat_tid_232357];
            }
            // red body
            {
                double defunc_1_op_res_232403 = x_232401 + x_232402;
                
                defunc_2_reduce_res_232176 = defunc_1_op_res_232403;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_232397);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236498_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236498_end -
                 futhark_mc_segred_task_236498_start;
        
        ctx->futhark_mc_segred_task_236498_runs[tid]++;
        ctx->futhark_mc_segred_task_236498_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236498_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236497->retval_defunc_2_reduce_res_232176 =
            defunc_2_reduce_res_232176;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236491(void *args, int64_t start,
                                            int64_t end, int flat_tid_232144,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236490->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236490->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236490->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236490->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236490->free_i_203760;
    int64_t gtid_213923 =
            futhark_mc_segmap_parloop_struct_236490->free_gtid_213923;
    int64_t x_213928 = futhark_mc_segmap_parloop_struct_236490->free_x_213928;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_219936,
                                  .size =0, .references =NULL};
    struct memblock mem_219939 = {.desc ="mem_219939", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_219939,
                                  .size =0, .references =NULL};
    struct memblock mem_219942 = {.desc ="mem_219942", .mem =
                                  futhark_mc_segmap_parloop_struct_236490->free_mem_219942,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232333 = start;
    
    for (; iter_232333 < end; iter_232333++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232385 = t_n_m_203740;
        int64_t gtid_232145 = iter_232333;
        int64_t remnant_232386 = iter_232333 - gtid_232145;
        int64_t x_232146;
        
        x_232146 = ((int64_t *) mem_217953.mem)[gtid_213923 * t_n_m_203740 +
                                                gtid_232145];
        
        double x_232147;
        
        x_232147 = ((double *) mem_217957.mem)[gtid_213923 * t_n_m_203740 +
                                               gtid_232145];
        
        int64_t min_arg_232148 = mul64(jump_t_203582, gtid_232145);
        int64_t min_res_232149 = smin64(i_203760, min_arg_232148);
        int64_t defunc_0_g_res_232150 = add64((int64_t) 1, min_res_232149);
        double defunc_2_reduce_res_232151;
        int64_t flat_tid_232334 = (int64_t) 0;
        int32_t num_tasks_232387;
        
        defunc_2_reduce_res_232151 = 0.0;
        
        struct futhark_mc_task_236492 futhark_mc_task_236492;
        
        futhark_mc_task_236492.ctx = ctx;
        futhark_mc_task_236492.free_n_203572 = n_203572;
        futhark_mc_task_236492.free_gtid_213923 = gtid_213923;
        futhark_mc_task_236492.free_x_213928 = x_213928;
        futhark_mc_task_236492.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236492.free_mem_219936 = mem_219936.mem;
        futhark_mc_task_236492.free_x_232146 = x_232146;
        futhark_mc_task_236492.free_x_232147 = x_232147;
        futhark_mc_task_236492.free_defunc_0_g_res_232150 =
            defunc_0_g_res_232150;
        futhark_mc_task_236492.retval_defunc_2_reduce_res_232151 =
            &defunc_2_reduce_res_232151;
        
        struct scheduler_segop futhark_mc_task_236492_task;
        
        futhark_mc_task_236492_task.args = &futhark_mc_task_236492;
        futhark_mc_task_236492_task.top_level_fn =
            futhark_mc_segred_task_236493;
        futhark_mc_task_236492_task.name = "futhark_mc_segred_task_236493";
        futhark_mc_task_236492_task.iterations = q_t_203576;
        futhark_mc_task_236492_task.task_time =
            &ctx->futhark_mc_segred_task_236493_total_time;
        futhark_mc_task_236492_task.task_iter =
            &ctx->futhark_mc_segred_task_236493_total_iter;
        futhark_mc_task_236492_task.sched = STATIC;
        futhark_mc_task_236492_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236493_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236492_task);
        
        if (futhark_mc_segred_task_236493_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_232175 = 1.0 / defunc_2_reduce_res_232151;
        double defunc_2_reduce_res_232176;
        int64_t flat_tid_232357 = (int64_t) 0;
        int32_t num_tasks_232396;
        
        defunc_2_reduce_res_232176 = 0.0;
        
        struct futhark_mc_task_236497 futhark_mc_task_236497;
        
        futhark_mc_task_236497.ctx = ctx;
        futhark_mc_task_236497.free_n_203572 = n_203572;
        futhark_mc_task_236497.free_gtid_213923 = gtid_213923;
        futhark_mc_task_236497.free_x_213928 = x_213928;
        futhark_mc_task_236497.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236497.free_mem_219936 = mem_219936.mem;
        futhark_mc_task_236497.free_mem_219939 = mem_219939.mem;
        futhark_mc_task_236497.free_x_232146 = x_232146;
        futhark_mc_task_236497.free_x_232147 = x_232147;
        futhark_mc_task_236497.free_defunc_0_g_res_232150 =
            defunc_0_g_res_232150;
        futhark_mc_task_236497.free_a0_232175 = a0_232175;
        futhark_mc_task_236497.retval_defunc_2_reduce_res_232176 =
            &defunc_2_reduce_res_232176;
        
        struct scheduler_segop futhark_mc_task_236497_task;
        
        futhark_mc_task_236497_task.args = &futhark_mc_task_236497;
        futhark_mc_task_236497_task.top_level_fn =
            futhark_mc_segred_task_236498;
        futhark_mc_task_236497_task.name = "futhark_mc_segred_task_236498";
        futhark_mc_task_236497_task.iterations = q_t_203576;
        futhark_mc_task_236497_task.task_time =
            &ctx->futhark_mc_segred_task_236498_total_time;
        futhark_mc_task_236497_task.task_iter =
            &ctx->futhark_mc_segred_task_236498_total_iter;
        futhark_mc_task_236497_task.sched = STATIC;
        futhark_mc_task_236497_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236498_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236497_task);
        
        if (futhark_mc_segred_task_236498_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_219942.mem)[gtid_232145] = defunc_2_reduce_res_232176;
    }
    
  cleanup:
    { }
    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_232144 = tid;
    int num_tasks_232280 = info.nsubtasks;
    struct futhark_mc_task_236485 *futhark_mc_task_236485 =
                                  (struct futhark_mc_task_236485 *) args;
    struct futhark_context *ctx = futhark_mc_task_236485->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_203572 = futhark_mc_task_236485->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236485->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236485->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236485->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236485->free_i_203760;
    int64_t gtid_213923 = futhark_mc_task_236485->free_gtid_213923;
    int64_t x_213928 = futhark_mc_task_236485->free_x_213928;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236485->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236485->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236485->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_219936 = {.desc ="mem_219936", .mem =
                                  futhark_mc_task_236485->free_mem_219936,
                                  .size =0, .references =NULL};
    struct memblock mem_219939 = {.desc ="mem_219939", .mem =
                                  futhark_mc_task_236485->free_mem_219939,
                                  .size =0, .references =NULL};
    struct memblock mem_219942 = {.desc ="mem_219942", .mem =
                                  futhark_mc_task_236485->free_mem_219942,
                                  .size =0, .references =NULL};
    int64_t iter_232333;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236490.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236490.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236490.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236490.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236490.free_gtid_213923 = gtid_213923;
    futhark_mc_segmap_parloop_struct_236490.free_x_213928 = x_213928;
    futhark_mc_segmap_parloop_struct_236490.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_219936 = mem_219936.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_219939 = mem_219939.mem;
    futhark_mc_segmap_parloop_struct_236490.free_mem_219942 = mem_219942.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_236472(void *args, int64_t start,
                                            int64_t end, int flat_tid_213922,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236471
    *futhark_mc_segmap_parloop_struct_236471 =
    (struct futhark_mc_segmap_parloop_struct_236471 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236471->ctx;
    uint64_t futhark_mc_segmap_parloop_236472_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236472_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236471->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236471->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236471->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236471->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236471->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236471->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236471->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236471->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236471->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236471->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236471->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236471->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236471->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236471->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236471->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236471->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236471->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236471->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220006 = {.desc ="mem_220006", .mem =
                                  futhark_mc_segmap_parloop_struct_236471->free_mem_220006,
                                  .size =0, .references =NULL};
    size_t mem_219933_cached_sizze_236473 = 0;
    unsigned char *mem_219933 = NULL;
    size_t mem_219936_cached_sizze_236474 = 0;
    unsigned char *mem_219936 = NULL;
    size_t mem_219939_cached_sizze_236475 = 0;
    unsigned char *mem_219939 = NULL;
    size_t mem_219942_cached_sizze_236476 = 0;
    unsigned char *mem_219942 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232124 = start;
    
    if (mem_219933_cached_sizze_236473 < (size_t) bytes_217420) {
        mem_219933 = realloc(mem_219933, bytes_217420);
        mem_219933_cached_sizze_236473 = bytes_217420;
    }
    if (mem_219936_cached_sizze_236474 < (size_t) bytes_217420) {
        mem_219936 = realloc(mem_219936, bytes_217420);
        mem_219936_cached_sizze_236474 = bytes_217420;
    }
    if (mem_219939_cached_sizze_236475 < (size_t) bytes_217420) {
        mem_219939 = realloc(mem_219939, bytes_217420);
        mem_219939_cached_sizze_236475 = bytes_217420;
    }
    if (mem_219942_cached_sizze_236476 < (size_t) bytes_217900) {
        mem_219942 = realloc(mem_219942, bytes_217900);
        mem_219942_cached_sizze_236476 = bytes_217900;
    }
    for (; iter_232124 < end; iter_232124++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232262 = partition_sizze_203667;
        int64_t gtid_213923 = iter_232124;
        int64_t remnant_232263 = iter_232124 - gtid_213923;
        int64_t x_213928;
        
        x_213928 = ((int64_t *) mem_217461.mem)[gtid_213923];
        
        int64_t flat_tid_232125 = (int64_t) 0;
        int32_t num_tasks_232264;
        struct futhark_mc_task_236477 futhark_mc_task_236477;
        
        futhark_mc_task_236477.ctx = ctx;
        futhark_mc_task_236477.free_n_203572 = n_203572;
        futhark_mc_task_236477.free_gtid_213923 = gtid_213923;
        futhark_mc_task_236477.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_236477.free_mem_219926 = mem_219926.mem;
        futhark_mc_task_236477.free_mem_219933 = mem_219933;
        
        struct scheduler_segop futhark_mc_task_236477_task;
        
        futhark_mc_task_236477_task.args = &futhark_mc_task_236477;
        futhark_mc_task_236477_task.top_level_fn =
            futhark_mc_segmap_task_236478;
        futhark_mc_task_236477_task.name = "futhark_mc_segmap_task_236478";
        futhark_mc_task_236477_task.iterations = n_203572;
        futhark_mc_task_236477_task.task_time =
            &ctx->futhark_mc_segmap_task_236478_total_time;
        futhark_mc_task_236477_task.task_iter =
            &ctx->futhark_mc_segmap_task_236478_total_iter;
        futhark_mc_task_236477_task.sched = STATIC;
        futhark_mc_task_236477_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236478_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236477_task);
        
        if (futhark_mc_segmap_task_236478_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_232130 = (int64_t) 0;
        int32_t num_tasks_232268;
        struct futhark_mc_task_236481 futhark_mc_task_236481;
        
        futhark_mc_task_236481.ctx = ctx;
        futhark_mc_task_236481.free_n_203572 = n_203572;
        futhark_mc_task_236481.free_gtid_213923 = gtid_213923;
        futhark_mc_task_236481.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236481.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236481.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236481.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236481.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236481.free_mem_219933 = mem_219933;
        futhark_mc_task_236481.free_mem_219936 = mem_219936;
        futhark_mc_task_236481.free_mem_219939 = mem_219939;
        
        struct scheduler_segop futhark_mc_task_236481_task;
        
        futhark_mc_task_236481_task.args = &futhark_mc_task_236481;
        futhark_mc_task_236481_task.top_level_fn =
            futhark_mc_segmap_task_236482;
        futhark_mc_task_236481_task.name = "futhark_mc_segmap_task_236482";
        futhark_mc_task_236481_task.iterations = n_203572;
        futhark_mc_task_236481_task.task_time =
            &ctx->futhark_mc_segmap_task_236482_total_time;
        futhark_mc_task_236481_task.task_iter =
            &ctx->futhark_mc_segmap_task_236482_total_iter;
        futhark_mc_task_236481_task.sched = STATIC;
        futhark_mc_task_236481_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236482_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236481_task);
        
        if (futhark_mc_segmap_task_236482_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_232205 = (int64_t) 0;
        int32_t num_tasks_232280;
        int64_t flat_tid_232144 = (int64_t) 0;
        struct futhark_mc_task_236485 futhark_mc_task_236485;
        
        futhark_mc_task_236485.ctx = ctx;
        futhark_mc_task_236485.free_n_203572 = n_203572;
        futhark_mc_task_236485.free_q_t_203576 = q_t_203576;
        futhark_mc_task_236485.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236485.free_t_n_m_203740 = t_n_m_203740;
        futhark_mc_task_236485.free_i_203760 = i_203760;
        futhark_mc_task_236485.free_gtid_213923 = gtid_213923;
        futhark_mc_task_236485.free_x_213928 = x_213928;
        futhark_mc_task_236485.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236485.free_mem_217953 = mem_217953.mem;
        futhark_mc_task_236485.free_mem_217957 = mem_217957.mem;
        futhark_mc_task_236485.free_mem_219936 = mem_219936;
        futhark_mc_task_236485.free_mem_219939 = mem_219939;
        futhark_mc_task_236485.free_mem_219942 = mem_219942;
        
        struct scheduler_segop futhark_mc_task_236485_task;
        
        futhark_mc_task_236485_task.args = &futhark_mc_task_236485;
        futhark_mc_task_236485_task.top_level_fn =
            futhark_mc_segmap_task_236486;
        futhark_mc_task_236485_task.name = "futhark_mc_segmap_task_236486";
        futhark_mc_task_236485_task.iterations = t_n_m_203740;
        futhark_mc_task_236485_task.task_time =
            &ctx->futhark_mc_segmap_task_236486_total_time;
        futhark_mc_task_236485_task.task_iter =
            &ctx->futhark_mc_segmap_task_236486_total_iter;
        futhark_mc_task_236485_task.sched = STATIC;
        futhark_mc_task_236485_task.nested_fn =
            futhark_mc_segmap_nested_task_236489;
        
        int futhark_mc_segmap_task_236486_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236485_task);
        
        if (futhark_mc_segmap_task_236486_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220006.mem + gtid_213923 * t_n_m_203740 * (int64_t) 8,
                    mem_219942 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_219933);
    free(mem_219936);
    free(mem_219939);
    free(mem_219942);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236472_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236472_end -
                 futhark_mc_segmap_parloop_236472_start;
        
        ctx->futhark_mc_segmap_parloop_236472_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236472_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236472_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236470(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_213922 = tid;
    int num_tasks_232033 = info.nsubtasks;
    struct futhark_mc_task_236462 *futhark_mc_task_236462 =
                                  (struct futhark_mc_task_236462 *) args;
    struct futhark_context *ctx = futhark_mc_task_236462->ctx;
    uint64_t futhark_mc_segmap_nested_task_236470_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236470_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236462->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236462->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236462->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236462->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236462->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236462->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236462->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236462->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236462->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236462->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236462->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236462->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236462->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236462->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236462->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236462->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236462->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236462->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220006 = {.desc ="mem_220006", .mem =
                                  futhark_mc_task_236462->free_mem_220006,
                                  .size =0, .references =NULL};
    int64_t iter_232124;
    struct futhark_mc_segmap_parloop_struct_236471
    futhark_mc_segmap_parloop_struct_236471;
    
    futhark_mc_segmap_parloop_struct_236471.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236471.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236471.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236471.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236471.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236471.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236471.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236471.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236471.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236471.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236471.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236471.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236471.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236471.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236471.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236471.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236471.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236471.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236471.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236471.free_mem_220006 = mem_220006.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236472_task;
    
    futhark_mc_segmap_parloop_236472_task.name =
        "futhark_mc_segmap_parloop_236472";
    futhark_mc_segmap_parloop_236472_task.fn = futhark_mc_segmap_parloop_236472;
    futhark_mc_segmap_parloop_236472_task.args =
        &futhark_mc_segmap_parloop_struct_236471;
    futhark_mc_segmap_parloop_236472_task.iterations = iterations;
    futhark_mc_segmap_parloop_236472_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236472_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236472_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236472_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236472_task);
    
    if (futhark_mc_segmap_parloop_236472_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236472_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236472_total_end -
                 futhark_mc_segmap_parloop_236472_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236472_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236472_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236472_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236470_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236470_end -
                 futhark_mc_segmap_nested_task_236470_start;
        
        ctx->futhark_mc_segmap_nested_task_236470_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236470_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236470_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236502 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220100;
    unsigned char *free_mem_220104;
};
struct futhark_mc_segmap_parloop_struct_236504 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220100;
    unsigned char *free_mem_220104;
};
static int futhark_mc_segmap_parloop_236505(void *args, int64_t start,
                                            int64_t end, int flat_tid_214078,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236504
    *futhark_mc_segmap_parloop_struct_236504 =
    (struct futhark_mc_segmap_parloop_struct_236504 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236504->ctx;
    uint64_t futhark_mc_segmap_parloop_236505_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236505_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236504->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236504->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236504->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236504->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236504->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236504->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236504->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236504->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236504->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236504->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236504->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236504->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236504->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236504->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236504->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236504->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236504->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236504->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220100 = {.desc ="mem_220100", .mem =
                                  futhark_mc_segmap_parloop_struct_236504->free_mem_220100,
                                  .size =0, .references =NULL};
    struct memblock mem_220104 = {.desc ="mem_220104", .mem =
                                  futhark_mc_segmap_parloop_struct_236504->free_mem_220104,
                                  .size =0, .references =NULL};
    size_t mem_220024_cached_sizze_236506 = 0;
    unsigned char *mem_220024 = NULL;
    size_t mem_220039_cached_sizze_236507 = 0;
    unsigned char *mem_220039 = NULL;
    size_t mem_220042_cached_sizze_236508 = 0;
    unsigned char *mem_220042 = NULL;
    size_t mem_220069_cached_sizze_236509 = 0;
    unsigned char *mem_220069 = NULL;
    size_t mem_220072_cached_sizze_236510 = 0;
    unsigned char *mem_220072 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232406 = start;
    
    if (mem_220024_cached_sizze_236506 < (size_t) bytes_217420) {
        mem_220024 = realloc(mem_220024, bytes_217420);
        mem_220024_cached_sizze_236506 = bytes_217420;
    }
    if (mem_220039_cached_sizze_236507 < (size_t) bytes_217420) {
        mem_220039 = realloc(mem_220039, bytes_217420);
        mem_220039_cached_sizze_236507 = bytes_217420;
    }
    if (mem_220042_cached_sizze_236508 < (size_t) bytes_217420) {
        mem_220042 = realloc(mem_220042, bytes_217420);
        mem_220042_cached_sizze_236508 = bytes_217420;
    }
    if (mem_220069_cached_sizze_236509 < (size_t) bytes_217900) {
        mem_220069 = realloc(mem_220069, bytes_217900);
        mem_220069_cached_sizze_236509 = bytes_217900;
    }
    if (mem_220072_cached_sizze_236510 < (size_t) bytes_217900) {
        mem_220072 = realloc(mem_220072, bytes_217900);
        mem_220072_cached_sizze_236510 = bytes_217900;
    }
    for (; iter_232406 < end; iter_232406++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232515 = partition_sizze_203667;
        int64_t gtid_214079 = iter_232406;
        int64_t remnant_232516 = iter_232406 - gtid_214079;
        int64_t x_206043;
        
        x_206043 = ((int64_t *) mem_217461.mem)[gtid_214079];
        for (int64_t i_232407 = 0; i_232407 < n_203572; i_232407++) {
            double x_232409;
            
            x_232409 = ((double *) mem_217415.mem)[gtid_214079 * n_203572 +
                                                   i_232407];
            
            double x_232410;
            
            x_232410 = ((double *) mem_219926.mem)[gtid_214079 * n_203572 +
                                                   i_232407];
            
            double defunc_1_f_res_232411 = x_232409 - x_232410;
            
            ((double *) mem_220024)[i_232407] = defunc_1_f_res_232411;
        }
        for (int64_t i_232413 = 0; i_232413 < n_203572; i_232413++) {
            int64_t x_232416;
            
            x_232416 = ((int64_t *) mem_217458.mem)[gtid_214079 * n_203572 +
                                                    i_232413];
            
            bool cond_232417 = sle64((int64_t) 0, x_232416);
            double defunc_0_f_res_232418;
            
            if (cond_232417) {
                bool y_232419 = slt64(x_232416, n_203572);
                bool bounds_check_232420 = cond_232417 && y_232419;
                bool index_certs_232421;
                
                if (!bounds_check_232420) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232416,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_232422;
                
                defunc_0_f_res_t_res_232422 = ((double *) mem_220024)[x_232416];
                defunc_0_f_res_232418 = defunc_0_f_res_t_res_232422;
            } else {
                defunc_0_f_res_232418 = 0.0;
            }
            
            double defunc_0_f_res_232423;
            
            if (cond_232417) {
                bool y_232424 = slt64(x_232416, n_203572);
                bool bounds_check_232425 = cond_232417 && y_232424;
                bool index_certs_232426;
                
                if (!bounds_check_232425) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232416,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_232427;
                
                defunc_0_f_res_t_res_232427 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_214079 *
                                                       ctx_param_ext_217985 +
                                                       x_232416 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_232423 = defunc_0_f_res_t_res_232427;
            } else {
                defunc_0_f_res_232423 = 0.0;
            }
            ((double *) mem_220039)[i_232413] = defunc_0_f_res_232423;
            ((double *) mem_220042)[i_232413] = defunc_0_f_res_232418;
        }
        for (int64_t i_232430 = 0; i_232430 < t_n_m_203740; i_232430++) {
            int64_t x_232433;
            
            x_232433 = ((int64_t *) mem_217953.mem)[gtid_214079 * t_n_m_203740 +
                                                    i_232430];
            
            double x_232434;
            
            x_232434 = ((double *) mem_217957.mem)[gtid_214079 * t_n_m_203740 +
                                                   i_232430];
            
            int64_t min_arg_232435 = mul64(jump_t_203582, i_232430);
            int64_t min_res_232436 = smin64(i_203760, min_arg_232435);
            int64_t defunc_0_g_res_232437 = add64((int64_t) 1, min_res_232436);
            double defunc_2_reduce_res_232438;
            double defunc_2_reduce_res_232439;
            double defunc_2_reduce_res_232440;
            double redout_232442;
            double redout_232443;
            double redout_232444;
            
            redout_232442 = 0.0;
            redout_232443 = 0.0;
            redout_232444 = 0.0;
            for (int64_t i_232441 = 0; i_232441 < q_t_203576; i_232441++) {
                bool cond_232445 = sle64(x_206043, i_232441);
                int64_t defunc_0_f_res_232446;
                
                if (cond_232445) {
                    defunc_0_f_res_232446 = (int64_t) 0;
                } else {
                    int64_t i_232447 = add64(x_232433, i_232441);
                    int64_t defunc_0_add_arg_232448;
                    
                    defunc_0_add_arg_232448 =
                        ((int64_t *) mem_217458.mem)[gtid_214079 * n_203572 +
                                                     i_232447];
                    
                    int64_t defunc_1_add_res_232449 = add64((int64_t) 1,
                                                            defunc_0_add_arg_232448);
                    
                    defunc_0_f_res_232446 = defunc_1_add_res_232449;
                }
                
                double defunc_0_f_res_232450;
                
                if (cond_232445) {
                    defunc_0_f_res_232450 = 0.0;
                } else {
                    int64_t i_232451 = add64(x_232433, i_232441);
                    double defunc_0_add_arg_232452;
                    
                    defunc_0_add_arg_232452 = ((double *) mem_220039)[i_232451];
                    defunc_0_f_res_232450 = defunc_0_add_arg_232452;
                }
                
                int64_t binop_p_232453 = sub64(defunc_0_f_res_232446,
                                               defunc_0_g_res_232437);
                double defunc_0_f_res_232454 = sitofp_i64_f64(binop_p_232453);
                double abs_res_232455 = fabs(defunc_0_f_res_232454);
                double tmp1_232456 = abs_res_232455 / x_232434;
                double x_232457 = tmp1_232456 * tmp1_232456;
                double y_232458 = tmp1_232456 * x_232457;
                double tmp2_232459 = 1.0 - y_232458;
                double x_232460 = tmp2_232459 * tmp2_232459;
                double tmp3_232461 = tmp2_232459 * x_232460;
                double w_j_232462 = defunc_0_f_res_232450 * tmp3_232461;
                double xw_j_232463 = defunc_0_f_res_232454 * w_j_232462;
                double x2w_j_232464 = defunc_0_f_res_232454 * xw_j_232463;
                double defunc_1_op_res_232465 = w_j_232462 + redout_232442;
                double defunc_1_op_res_232466 = xw_j_232463 + redout_232443;
                double defunc_1_op_res_232467 = x2w_j_232464 + redout_232444;
                double redout_tmp_232522 = defunc_1_op_res_232465;
                double redout_tmp_232523 = defunc_1_op_res_232466;
                double redout_tmp_232524 = defunc_1_op_res_232467;
                
                redout_232442 = redout_tmp_232522;
                redout_232443 = redout_tmp_232523;
                redout_232444 = redout_tmp_232524;
            }
            defunc_2_reduce_res_232438 = redout_232442;
            defunc_2_reduce_res_232439 = redout_232443;
            defunc_2_reduce_res_232440 = redout_232444;
            
            double x_232468 = defunc_2_reduce_res_232438 *
                   defunc_2_reduce_res_232440;
            double y_232469 = defunc_2_reduce_res_232439 *
                   defunc_2_reduce_res_232439;
            double y_232470 = x_232468 - y_232469;
            double det1_232471 = 1.0 / y_232470;
            double a11_232472 = defunc_2_reduce_res_232440 * det1_232471;
            double x_232473 = 0.0 - defunc_2_reduce_res_232439;
            double b11_232474 = det1_232471 * x_232473;
            double c11_232475 = defunc_2_reduce_res_232438 * det1_232471;
            double defunc_2_reduce_res_232476;
            double defunc_2_reduce_res_232477;
            double redout_232479;
            double redout_232480;
            
            redout_232479 = 0.0;
            redout_232480 = 0.0;
            for (int64_t i_232478 = 0; i_232478 < q_t_203576; i_232478++) {
                bool cond_232481 = sle64(x_206043, i_232478);
                int64_t defunc_0_f_res_232482;
                
                if (cond_232481) {
                    defunc_0_f_res_232482 = (int64_t) 0;
                } else {
                    int64_t i_232483 = add64(x_232433, i_232478);
                    int64_t defunc_0_add_arg_232484;
                    
                    defunc_0_add_arg_232484 =
                        ((int64_t *) mem_217458.mem)[gtid_214079 * n_203572 +
                                                     i_232483];
                    
                    int64_t defunc_1_add_res_232485 = add64((int64_t) 1,
                                                            defunc_0_add_arg_232484);
                    
                    defunc_0_f_res_232482 = defunc_1_add_res_232485;
                }
                
                double defunc_0_f_res_232486;
                
                if (cond_232481) {
                    defunc_0_f_res_232486 = 0.0;
                } else {
                    int64_t i_232487 = add64(x_232433, i_232478);
                    double defunc_0_add_arg_232488;
                    
                    defunc_0_add_arg_232488 = ((double *) mem_220039)[i_232487];
                    defunc_0_f_res_232486 = defunc_0_add_arg_232488;
                }
                
                int64_t binop_p_232489 = sub64(defunc_0_f_res_232482,
                                               defunc_0_g_res_232437);
                double defunc_0_f_res_232490 = sitofp_i64_f64(binop_p_232489);
                double abs_res_232491 = fabs(defunc_0_f_res_232490);
                double tmp1_232492 = abs_res_232491 / x_232434;
                double x_232493 = tmp1_232492 * tmp1_232492;
                double y_232494 = tmp1_232492 * x_232493;
                double tmp2_232495 = 1.0 - y_232494;
                double x_232496 = tmp2_232495 * tmp2_232495;
                double tmp3_232497 = tmp2_232495 * x_232496;
                double tmp4_232498 = defunc_0_f_res_232486 * tmp3_232497;
                double defunc_1_f_res_232499 = defunc_0_f_res_232490 *
                       tmp4_232498;
                double defunc_0_f_res_232500;
                
                if (cond_232481) {
                    defunc_0_f_res_232500 = 0.0;
                } else {
                    int64_t i_232501 = add64(x_232433, i_232478);
                    double defunc_0_add_arg_232502;
                    
                    defunc_0_add_arg_232502 = ((double *) mem_220042)[i_232501];
                    defunc_0_f_res_232500 = defunc_0_add_arg_232502;
                }
                
                double x_232503 = a11_232472 * tmp4_232498;
                double y_232504 = b11_232474 * defunc_1_f_res_232499;
                double x_232505 = x_232503 + y_232504;
                double defunc_9_fit_fun_res_232506 = defunc_0_f_res_232500 *
                       x_232505;
                double x_232507 = b11_232474 * tmp4_232498;
                double y_232508 = c11_232475 * defunc_1_f_res_232499;
                double x_232509 = x_232507 + y_232508;
                double defunc_9_slope_fun_res_232510 = defunc_0_f_res_232500 *
                       x_232509;
                double defunc_1_op_res_232511 = defunc_9_fit_fun_res_232506 +
                       redout_232479;
                double defunc_1_op_res_232512 = defunc_9_slope_fun_res_232510 +
                       redout_232480;
                double redout_tmp_232525 = defunc_1_op_res_232511;
                double redout_tmp_232526 = defunc_1_op_res_232512;
                
                redout_232479 = redout_tmp_232525;
                redout_232480 = redout_tmp_232526;
            }
            defunc_2_reduce_res_232476 = redout_232479;
            defunc_2_reduce_res_232477 = redout_232480;
            ((double *) mem_220069)[i_232430] = defunc_2_reduce_res_232476;
            ((double *) mem_220072)[i_232430] = defunc_2_reduce_res_232477;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220100.mem + gtid_214079 * t_n_m_203740 * (int64_t) 8,
                    mem_220069 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220104.mem + gtid_214079 * t_n_m_203740 * (int64_t) 8,
                    mem_220072 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220024);
    free(mem_220039);
    free(mem_220042);
    free(mem_220069);
    free(mem_220072);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236505_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236505_end -
                 futhark_mc_segmap_parloop_236505_start;
        
        ctx->futhark_mc_segmap_parloop_236505_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236505_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236505_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236503(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214078 = tid;
    int num_tasks_232405 = info.nsubtasks;
    struct futhark_mc_task_236502 *futhark_mc_task_236502 =
                                  (struct futhark_mc_task_236502 *) args;
    struct futhark_context *ctx = futhark_mc_task_236502->ctx;
    uint64_t futhark_mc_segmap_task_236503_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236503_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236502->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236502->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236502->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236502->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236502->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236502->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236502->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236502->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236502->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236502->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236502->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236502->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236502->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236502->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236502->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236502->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236502->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236502->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220100 = {.desc ="mem_220100", .mem =
                                  futhark_mc_task_236502->free_mem_220100,
                                  .size =0, .references =NULL};
    struct memblock mem_220104 = {.desc ="mem_220104", .mem =
                                  futhark_mc_task_236502->free_mem_220104,
                                  .size =0, .references =NULL};
    int64_t iter_232406;
    struct futhark_mc_segmap_parloop_struct_236504
    futhark_mc_segmap_parloop_struct_236504;
    
    futhark_mc_segmap_parloop_struct_236504.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236504.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236504.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236504.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236504.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236504.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236504.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236504.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236504.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236504.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236504.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236504.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236504.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236504.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236504.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236504.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236504.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236504.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236504.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236504.free_mem_220100 = mem_220100.mem;
    futhark_mc_segmap_parloop_struct_236504.free_mem_220104 = mem_220104.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236505_task;
    
    futhark_mc_segmap_parloop_236505_task.name =
        "futhark_mc_segmap_parloop_236505";
    futhark_mc_segmap_parloop_236505_task.fn = futhark_mc_segmap_parloop_236505;
    futhark_mc_segmap_parloop_236505_task.args =
        &futhark_mc_segmap_parloop_struct_236504;
    futhark_mc_segmap_parloop_236505_task.iterations = iterations;
    futhark_mc_segmap_parloop_236505_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236505_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236505_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236505_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236505_task);
    
    if (futhark_mc_segmap_parloop_236505_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236505_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236505_total_end -
                 futhark_mc_segmap_parloop_236505_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236505_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236505_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236505_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236503_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236503_end -
                 futhark_mc_segmap_task_236503_start;
        
        ctx->futhark_mc_segmap_task_236503_runs[tid]++;
        ctx->futhark_mc_segmap_task_236503_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236503_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236512 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220100;
    unsigned char *free_mem_220104;
};
struct futhark_mc_task_236519 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214187;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220009;
};
struct futhark_mc_segmap_parloop_struct_236521 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214187;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220009;
};
static int futhark_mc_segmap_parloop_236522(void *args, int64_t start,
                                            int64_t end, int flat_tid_232528,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236521->free_n_203572;
    int64_t gtid_214187 =
            futhark_mc_segmap_parloop_struct_236521->free_gtid_214187;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220009 = {.desc ="mem_220009", .mem =
                                  futhark_mc_segmap_parloop_struct_236521->free_mem_220009,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232721 = start;
    
    for (; iter_232721 < end; iter_232721++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232722 = n_203572;
        int64_t gtid_232529 = iter_232721;
        int64_t remnant_232723 = iter_232721 - gtid_232529;
        double x_232530;
        
        x_232530 = ((double *) mem_217415.mem)[gtid_214187 * n_203572 +
                                               gtid_232529];
        
        double x_232531;
        
        x_232531 = ((double *) mem_219926.mem)[gtid_214187 * n_203572 +
                                               gtid_232529];
        
        double defunc_1_f_res_232532 = x_232530 - x_232531;
        
        ((double *) mem_220009.mem)[gtid_232529] = defunc_1_f_res_232532;
    }
    
  cleanup:
    { }
    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_task_236520(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232528 = tid;
    int num_tasks_232720 = info.nsubtasks;
    struct futhark_mc_task_236519 *futhark_mc_task_236519 =
                                  (struct futhark_mc_task_236519 *) args;
    struct futhark_context *ctx = futhark_mc_task_236519->ctx;
    uint64_t futhark_mc_segmap_task_236520_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236520_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236519->free_n_203572;
    int64_t gtid_214187 = futhark_mc_task_236519->free_gtid_214187;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236519->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236519->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220009 = {.desc ="mem_220009", .mem =
                                  futhark_mc_task_236519->free_mem_220009,
                                  .size =0, .references =NULL};
    int64_t iter_232721;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236521.free_gtid_214187 = gtid_214187;
    futhark_mc_segmap_parloop_struct_236521.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236521.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236521.free_mem_220009 = mem_220009.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_task_236520_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236520_end -
                 futhark_mc_segmap_task_236520_start;
        
        ctx->futhark_mc_segmap_task_236520_runs[tid]++;
        ctx->futhark_mc_segmap_task_236520_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236520_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236523 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214187;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220009;
    unsigned char *free_mem_220012;
    unsigned char *free_mem_220015;
};
struct futhark_mc_segmap_parloop_struct_236525 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214187;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220009;
    unsigned char *free_mem_220012;
    unsigned char *free_mem_220015;
};
static int futhark_mc_segmap_parloop_236526(void *args, int64_t start,
                                            int64_t end, int flat_tid_232533,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236525
    *futhark_mc_segmap_parloop_struct_236525 =
    (struct futhark_mc_segmap_parloop_struct_236525 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236525->ctx;
    uint64_t futhark_mc_segmap_parloop_236526_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236526_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236525->free_n_203572;
    int64_t gtid_214187 =
            futhark_mc_segmap_parloop_struct_236525->free_gtid_214187;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236525->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236525->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236525->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236525->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236525->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220009 = {.desc ="mem_220009", .mem =
                                  futhark_mc_segmap_parloop_struct_236525->free_mem_220009,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_segmap_parloop_struct_236525->free_mem_220012,
                                  .size =0, .references =NULL};
    struct memblock mem_220015 = {.desc ="mem_220015", .mem =
                                  futhark_mc_segmap_parloop_struct_236525->free_mem_220015,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232725 = start;
    
    for (; iter_232725 < end; iter_232725++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232734 = n_203572;
        int64_t gtid_232534 = iter_232725;
        int64_t remnant_232735 = iter_232725 - gtid_232534;
        int64_t x_232535;
        
        x_232535 = ((int64_t *) mem_217458.mem)[gtid_214187 * n_203572 +
                                                gtid_232534];
        
        bool cond_232536 = sle64((int64_t) 0, x_232535);
        double defunc_0_f_res_232537;
        
        if (cond_232536) {
            bool y_232726 = slt64(x_232535, n_203572);
            bool bounds_check_232727 = cond_232536 && y_232726;
            bool index_certs_232728;
            
            if (!bounds_check_232727) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_232535,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_232729;
            
            defunc_0_f_res_t_res_232729 = ((double *) mem_220009.mem)[x_232535];
            defunc_0_f_res_232537 = defunc_0_f_res_t_res_232729;
        } else {
            defunc_0_f_res_232537 = 0.0;
        }
        
        double defunc_0_f_res_232542;
        
        if (cond_232536) {
            bool y_232730 = slt64(x_232535, n_203572);
            bool bounds_check_232731 = cond_232536 && y_232730;
            bool index_certs_232732;
            
            if (!bounds_check_232731) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_232535,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_232733;
            
            defunc_0_f_res_t_res_232733 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_214187 *
                                                   ctx_param_ext_217985 +
                                                   x_232535 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_232542 = defunc_0_f_res_t_res_232733;
        } else {
            defunc_0_f_res_232542 = 0.0;
        }
        ((double *) mem_220012.mem)[gtid_232534] = defunc_0_f_res_232542;
        ((double *) mem_220015.mem)[gtid_232534] = defunc_0_f_res_232537;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236526_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236526_end -
                 futhark_mc_segmap_parloop_236526_start;
        
        ctx->futhark_mc_segmap_parloop_236526_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236526_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236526_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236524(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232533 = tid;
    int num_tasks_232724 = info.nsubtasks;
    struct futhark_mc_task_236523 *futhark_mc_task_236523 =
                                  (struct futhark_mc_task_236523 *) args;
    struct futhark_context *ctx = futhark_mc_task_236523->ctx;
    uint64_t futhark_mc_segmap_task_236524_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236524_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236523->free_n_203572;
    int64_t gtid_214187 = futhark_mc_task_236523->free_gtid_214187;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236523->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236523->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236523->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236523->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236523->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220009 = {.desc ="mem_220009", .mem =
                                  futhark_mc_task_236523->free_mem_220009,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_task_236523->free_mem_220012,
                                  .size =0, .references =NULL};
    struct memblock mem_220015 = {.desc ="mem_220015", .mem =
                                  futhark_mc_task_236523->free_mem_220015,
                                  .size =0, .references =NULL};
    int64_t iter_232725;
    struct futhark_mc_segmap_parloop_struct_236525
    futhark_mc_segmap_parloop_struct_236525;
    
    futhark_mc_segmap_parloop_struct_236525.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236525.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236525.free_gtid_214187 = gtid_214187;
    futhark_mc_segmap_parloop_struct_236525.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236525.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236525.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236525.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236525.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236525.free_mem_220009 = mem_220009.mem;
    futhark_mc_segmap_parloop_struct_236525.free_mem_220012 = mem_220012.mem;
    futhark_mc_segmap_parloop_struct_236525.free_mem_220015 = mem_220015.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236526_task;
    
    futhark_mc_segmap_parloop_236526_task.name =
        "futhark_mc_segmap_parloop_236526";
    futhark_mc_segmap_parloop_236526_task.fn = futhark_mc_segmap_parloop_236526;
    futhark_mc_segmap_parloop_236526_task.args =
        &futhark_mc_segmap_parloop_struct_236525;
    futhark_mc_segmap_parloop_236526_task.iterations = iterations;
    futhark_mc_segmap_parloop_236526_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236526_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236526_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236526_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236526_task);
    
    if (futhark_mc_segmap_parloop_236526_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236526_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236526_total_end -
                 futhark_mc_segmap_parloop_236526_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236526_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236526_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236526_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236524_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236524_end -
                 futhark_mc_segmap_task_236524_start;
        
        ctx->futhark_mc_segmap_task_236524_runs[tid]++;
        ctx->futhark_mc_segmap_task_236524_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236524_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236527 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_214187;
    int64_t free_x_214192;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220012;
    unsigned char *free_mem_220015;
    unsigned char *free_mem_220018;
    unsigned char *free_mem_220021;
};
struct futhark_mc_segmap_parloop_struct_236529 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_214187;
    int64_t free_x_214192;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220012;
    unsigned char *free_mem_220015;
    unsigned char *free_mem_220018;
    unsigned char *free_mem_220021;
};
static int futhark_mc_segmap_parloop_236530(void *args, int64_t start,
                                            int64_t end, int flat_tid_232636,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236529
    *futhark_mc_segmap_parloop_struct_236529 =
    (struct futhark_mc_segmap_parloop_struct_236529 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236529->ctx;
    uint64_t futhark_mc_segmap_parloop_236530_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236530_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236529->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236529->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236529->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236529->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236529->free_i_203760;
    int64_t gtid_214187 =
            futhark_mc_segmap_parloop_struct_236529->free_gtid_214187;
    int64_t x_214192 = futhark_mc_segmap_parloop_struct_236529->free_x_214192;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236529->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236529->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236529->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_segmap_parloop_struct_236529->free_mem_220012,
                                  .size =0, .references =NULL};
    struct memblock mem_220015 = {.desc ="mem_220015", .mem =
                                  futhark_mc_segmap_parloop_struct_236529->free_mem_220015,
                                  .size =0, .references =NULL};
    struct memblock mem_220018 = {.desc ="mem_220018", .mem =
                                  futhark_mc_segmap_parloop_struct_236529->free_mem_220018,
                                  .size =0, .references =NULL};
    struct memblock mem_220021 = {.desc ="mem_220021", .mem =
                                  futhark_mc_segmap_parloop_struct_236529->free_mem_220021,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232737 = start;
    
    for (; iter_232737 < end; iter_232737++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232800 = t_n_m_203740;
        int64_t gtid_232637 = iter_232737;
        int64_t remnant_232801 = iter_232737 - gtid_232637;
        int64_t x_232638;
        
        x_232638 = ((int64_t *) mem_217953.mem)[gtid_214187 * t_n_m_203740 +
                                                gtid_232637];
        
        double x_232639;
        
        x_232639 = ((double *) mem_217957.mem)[gtid_214187 * t_n_m_203740 +
                                               gtid_232637];
        
        int64_t min_arg_232640 = mul64(jump_t_203582, gtid_232637);
        int64_t min_res_232641 = smin64(i_203760, min_arg_232640);
        int64_t defunc_0_g_res_232642 = add64((int64_t) 1, min_res_232641);
        double defunc_2_reduce_res_232643;
        double defunc_2_reduce_res_232644;
        double defunc_2_reduce_res_232645;
        double redout_232739;
        double redout_232740;
        double redout_232741;
        
        redout_232739 = 0.0;
        redout_232740 = 0.0;
        redout_232741 = 0.0;
        for (int64_t i_232738 = 0; i_232738 < q_t_203576; i_232738++) {
            bool cond_232742 = sle64(x_214192, i_232738);
            int64_t defunc_0_f_res_232743;
            
            if (cond_232742) {
                defunc_0_f_res_232743 = (int64_t) 0;
            } else {
                int64_t i_232744 = add64(x_232638, i_232738);
                int64_t defunc_0_add_arg_232745;
                
                defunc_0_add_arg_232745 =
                    ((int64_t *) mem_217458.mem)[gtid_214187 * n_203572 +
                                                 i_232744];
                
                int64_t defunc_1_add_res_232746 = add64((int64_t) 1,
                                                        defunc_0_add_arg_232745);
                
                defunc_0_f_res_232743 = defunc_1_add_res_232746;
            }
            
            double defunc_0_f_res_232747;
            
            if (cond_232742) {
                defunc_0_f_res_232747 = 0.0;
            } else {
                int64_t i_232748 = add64(x_232638, i_232738);
                double defunc_0_add_arg_232749;
                
                defunc_0_add_arg_232749 = ((double *) mem_220012.mem)[i_232748];
                defunc_0_f_res_232747 = defunc_0_add_arg_232749;
            }
            
            int64_t binop_p_232750 = sub64(defunc_0_f_res_232743,
                                           defunc_0_g_res_232642);
            double defunc_0_f_res_232751 = sitofp_i64_f64(binop_p_232750);
            double abs_res_232752 = fabs(defunc_0_f_res_232751);
            double tmp1_232753 = abs_res_232752 / x_232639;
            double x_232754 = tmp1_232753 * tmp1_232753;
            double y_232755 = tmp1_232753 * x_232754;
            double tmp2_232756 = 1.0 - y_232755;
            double x_232757 = tmp2_232756 * tmp2_232756;
            double tmp3_232758 = tmp2_232756 * x_232757;
            double w_j_232759 = defunc_0_f_res_232747 * tmp3_232758;
            double xw_j_232760 = defunc_0_f_res_232751 * w_j_232759;
            double x2w_j_232761 = defunc_0_f_res_232751 * xw_j_232760;
            double defunc_1_op_res_232762 = w_j_232759 + redout_232739;
            double defunc_1_op_res_232763 = xw_j_232760 + redout_232740;
            double defunc_1_op_res_232764 = x2w_j_232761 + redout_232741;
            double redout_tmp_232802 = defunc_1_op_res_232762;
            double redout_tmp_232803 = defunc_1_op_res_232763;
            double redout_tmp_232804 = defunc_1_op_res_232764;
            
            redout_232739 = redout_tmp_232802;
            redout_232740 = redout_tmp_232803;
            redout_232741 = redout_tmp_232804;
        }
        defunc_2_reduce_res_232643 = redout_232739;
        defunc_2_reduce_res_232644 = redout_232740;
        defunc_2_reduce_res_232645 = redout_232741;
        
        double x_232673 = defunc_2_reduce_res_232643 *
               defunc_2_reduce_res_232645;
        double y_232674 = defunc_2_reduce_res_232644 *
               defunc_2_reduce_res_232644;
        double y_232675 = x_232673 - y_232674;
        double det1_232676 = 1.0 / y_232675;
        double a11_232677 = defunc_2_reduce_res_232645 * det1_232676;
        double x_232678 = 0.0 - defunc_2_reduce_res_232644;
        double b11_232679 = det1_232676 * x_232678;
        double c11_232680 = defunc_2_reduce_res_232643 * det1_232676;
        double defunc_2_reduce_res_232681;
        double defunc_2_reduce_res_232682;
        double redout_232766;
        double redout_232767;
        
        redout_232766 = 0.0;
        redout_232767 = 0.0;
        for (int64_t i_232765 = 0; i_232765 < q_t_203576; i_232765++) {
            bool cond_232768 = sle64(x_214192, i_232765);
            int64_t defunc_0_f_res_232769;
            
            if (cond_232768) {
                defunc_0_f_res_232769 = (int64_t) 0;
            } else {
                int64_t i_232770 = add64(x_232638, i_232765);
                int64_t defunc_0_add_arg_232771;
                
                defunc_0_add_arg_232771 =
                    ((int64_t *) mem_217458.mem)[gtid_214187 * n_203572 +
                                                 i_232770];
                
                int64_t defunc_1_add_res_232772 = add64((int64_t) 1,
                                                        defunc_0_add_arg_232771);
                
                defunc_0_f_res_232769 = defunc_1_add_res_232772;
            }
            
            double defunc_0_f_res_232773;
            
            if (cond_232768) {
                defunc_0_f_res_232773 = 0.0;
            } else {
                int64_t i_232774 = add64(x_232638, i_232765);
                double defunc_0_add_arg_232775;
                
                defunc_0_add_arg_232775 = ((double *) mem_220012.mem)[i_232774];
                defunc_0_f_res_232773 = defunc_0_add_arg_232775;
            }
            
            int64_t binop_p_232776 = sub64(defunc_0_f_res_232769,
                                           defunc_0_g_res_232642);
            double defunc_0_f_res_232777 = sitofp_i64_f64(binop_p_232776);
            double abs_res_232778 = fabs(defunc_0_f_res_232777);
            double tmp1_232779 = abs_res_232778 / x_232639;
            double x_232780 = tmp1_232779 * tmp1_232779;
            double y_232781 = tmp1_232779 * x_232780;
            double tmp2_232782 = 1.0 - y_232781;
            double x_232783 = tmp2_232782 * tmp2_232782;
            double tmp3_232784 = tmp2_232782 * x_232783;
            double tmp4_232785 = defunc_0_f_res_232773 * tmp3_232784;
            double defunc_1_f_res_232786 = defunc_0_f_res_232777 * tmp4_232785;
            double defunc_0_f_res_232787;
            
            if (cond_232768) {
                defunc_0_f_res_232787 = 0.0;
            } else {
                int64_t i_232788 = add64(x_232638, i_232765);
                double defunc_0_add_arg_232789;
                
                defunc_0_add_arg_232789 = ((double *) mem_220015.mem)[i_232788];
                defunc_0_f_res_232787 = defunc_0_add_arg_232789;
            }
            
            double x_232790 = a11_232677 * tmp4_232785;
            double y_232791 = b11_232679 * defunc_1_f_res_232786;
            double x_232792 = x_232790 + y_232791;
            double defunc_9_fit_fun_res_232793 = defunc_0_f_res_232787 *
                   x_232792;
            double x_232794 = b11_232679 * tmp4_232785;
            double y_232795 = c11_232680 * defunc_1_f_res_232786;
            double x_232796 = x_232794 + y_232795;
            double defunc_9_slope_fun_res_232797 = defunc_0_f_res_232787 *
                   x_232796;
            double defunc_1_op_res_232798 = defunc_9_fit_fun_res_232793 +
                   redout_232766;
            double defunc_1_op_res_232799 = defunc_9_slope_fun_res_232797 +
                   redout_232767;
            double redout_tmp_232805 = defunc_1_op_res_232798;
            double redout_tmp_232806 = defunc_1_op_res_232799;
            
            redout_232766 = redout_tmp_232805;
            redout_232767 = redout_tmp_232806;
        }
        defunc_2_reduce_res_232681 = redout_232766;
        defunc_2_reduce_res_232682 = redout_232767;
        ((double *) mem_220018.mem)[gtid_232637] = defunc_2_reduce_res_232681;
        ((double *) mem_220021.mem)[gtid_232637] = defunc_2_reduce_res_232682;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236530_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236530_end -
                 futhark_mc_segmap_parloop_236530_start;
        
        ctx->futhark_mc_segmap_parloop_236530_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236530_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236530_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236528(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232636 = tid;
    int num_tasks_232736 = info.nsubtasks;
    struct futhark_mc_task_236527 *futhark_mc_task_236527 =
                                  (struct futhark_mc_task_236527 *) args;
    struct futhark_context *ctx = futhark_mc_task_236527->ctx;
    uint64_t futhark_mc_segmap_task_236528_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236528_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236527->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236527->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236527->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236527->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236527->free_i_203760;
    int64_t gtid_214187 = futhark_mc_task_236527->free_gtid_214187;
    int64_t x_214192 = futhark_mc_task_236527->free_x_214192;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236527->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236527->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236527->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_task_236527->free_mem_220012,
                                  .size =0, .references =NULL};
    struct memblock mem_220015 = {.desc ="mem_220015", .mem =
                                  futhark_mc_task_236527->free_mem_220015,
                                  .size =0, .references =NULL};
    struct memblock mem_220018 = {.desc ="mem_220018", .mem =
                                  futhark_mc_task_236527->free_mem_220018,
                                  .size =0, .references =NULL};
    struct memblock mem_220021 = {.desc ="mem_220021", .mem =
                                  futhark_mc_task_236527->free_mem_220021,
                                  .size =0, .references =NULL};
    int64_t iter_232737;
    struct futhark_mc_segmap_parloop_struct_236529
    futhark_mc_segmap_parloop_struct_236529;
    
    futhark_mc_segmap_parloop_struct_236529.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236529.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236529.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236529.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236529.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236529.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236529.free_gtid_214187 = gtid_214187;
    futhark_mc_segmap_parloop_struct_236529.free_x_214192 = x_214192;
    futhark_mc_segmap_parloop_struct_236529.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236529.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236529.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236529.free_mem_220012 = mem_220012.mem;
    futhark_mc_segmap_parloop_struct_236529.free_mem_220015 = mem_220015.mem;
    futhark_mc_segmap_parloop_struct_236529.free_mem_220018 = mem_220018.mem;
    futhark_mc_segmap_parloop_struct_236529.free_mem_220021 = mem_220021.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236530_task;
    
    futhark_mc_segmap_parloop_236530_task.name =
        "futhark_mc_segmap_parloop_236530";
    futhark_mc_segmap_parloop_236530_task.fn = futhark_mc_segmap_parloop_236530;
    futhark_mc_segmap_parloop_236530_task.args =
        &futhark_mc_segmap_parloop_struct_236529;
    futhark_mc_segmap_parloop_236530_task.iterations = iterations;
    futhark_mc_segmap_parloop_236530_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236530_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236530_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236530_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236530_task);
    
    if (futhark_mc_segmap_parloop_236530_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236530_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236530_total_end -
                 futhark_mc_segmap_parloop_236530_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236530_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236530_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236530_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236528_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236528_end -
                 futhark_mc_segmap_task_236528_start;
        
        ctx->futhark_mc_segmap_task_236528_runs[tid]++;
        ctx->futhark_mc_segmap_task_236528_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236528_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236532 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_214187;
    int64_t free_x_214192;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220012;
    unsigned char *free_mem_220015;
    unsigned char *free_mem_220018;
    unsigned char *free_mem_220021;
};
struct futhark_mc_task_236534 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214187;
    int64_t free_x_214192;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220012;
    int64_t free_x_232549;
    double free_x_232550;
    int64_t free_defunc_0_g_res_232553;
    double *retval_defunc_2_reduce_res_232554;
    double *retval_defunc_2_reduce_res_232555;
    double *retval_defunc_2_reduce_res_232556;
};
struct futhark_mc_segred_stage_1_parloop_struct_236539 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214187;
    int64_t free_x_214192;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220012;
    int64_t free_x_232549;
    double free_x_232550;
    int64_t free_defunc_0_g_res_232553;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232880;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232882;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232884;
};
static int futhark_mc_segred_stage_1_parloop_236540(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_232808,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236539
    *futhark_mc_segred_stage_1_parloop_struct_236539 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236539 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236539->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236540_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236540_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236539->free_n_203572;
    int64_t gtid_214187 =
            futhark_mc_segred_stage_1_parloop_struct_236539->free_gtid_214187;
    int64_t x_214192 =
            futhark_mc_segred_stage_1_parloop_struct_236539->free_x_214192;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236539->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236539->free_mem_220012,
                                  .size =0, .references =NULL};
    int64_t x_232549 =
            futhark_mc_segred_stage_1_parloop_struct_236539->free_x_232549;
    double x_232550 =
           futhark_mc_segred_stage_1_parloop_struct_236539->free_x_232550;
    int64_t defunc_0_g_res_232553 =
            futhark_mc_segred_stage_1_parloop_struct_236539->free_defunc_0_g_res_232553;
    struct memblock reduce_stage_1_tid_res_arr_mem_232880 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232880",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236539->free_reduce_stage_1_tid_res_arr_mem_232880,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_232882 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232882",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236539->free_reduce_stage_1_tid_res_arr_mem_232882,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_232884 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232884",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236539->free_reduce_stage_1_tid_res_arr_mem_232884,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232886 = start;
    double x_232810;
    double x_232811;
    double x_232813;
    double x_232814;
    double x_232816;
    double x_232817;
    double local_acc_232887 = 0.0;
    double local_acc_232888 = 0.0;
    double local_acc_232889 = 0.0;
    
    for (; iter_232886 < end; iter_232886++) {
        int64_t gtid_232809 = iter_232886;
        bool cond_232819 = sle64(x_214192, gtid_232809);
        int64_t defunc_0_f_res_232820;
        
        if (cond_232819) {
            defunc_0_f_res_232820 = (int64_t) 0;
        } else {
            int64_t i_232821 = add64(x_232549, gtid_232809);
            int64_t defunc_0_add_arg_232822;
            
            defunc_0_add_arg_232822 = ((int64_t *) mem_217458.mem)[gtid_214187 *
                                                                   n_203572 +
                                                                   i_232821];
            
            int64_t defunc_1_add_res_232823 = add64((int64_t) 1,
                                                    defunc_0_add_arg_232822);
            
            defunc_0_f_res_232820 = defunc_1_add_res_232823;
        }
        
        double defunc_0_f_res_232824;
        
        if (cond_232819) {
            defunc_0_f_res_232824 = 0.0;
        } else {
            int64_t i_232825 = add64(x_232549, gtid_232809);
            double defunc_0_add_arg_232826;
            
            defunc_0_add_arg_232826 = ((double *) mem_220012.mem)[i_232825];
            defunc_0_f_res_232824 = defunc_0_add_arg_232826;
        }
        
        int64_t binop_p_232827 = sub64(defunc_0_f_res_232820,
                                       defunc_0_g_res_232553);
        double defunc_0_f_res_232828 = sitofp_i64_f64(binop_p_232827);
        double abs_res_232829 = fabs(defunc_0_f_res_232828);
        double tmp1_232830 = abs_res_232829 / x_232550;
        double x_232831 = tmp1_232830 * tmp1_232830;
        double y_232832 = tmp1_232830 * x_232831;
        double tmp2_232833 = 1.0 - y_232832;
        double x_232834 = tmp2_232833 * tmp2_232833;
        double tmp3_232835 = tmp2_232833 * x_232834;
        double w_j_232836 = defunc_0_f_res_232824 * tmp3_232835;
        double xw_j_232837 = defunc_0_f_res_232828 * w_j_232836;
        double x2w_j_232838 = defunc_0_f_res_232828 * xw_j_232837;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_232810 = local_acc_232887;
        }
        // Load next params
        {
            x_232811 = w_j_232836;
        }
        // Red body
        {
            double defunc_1_op_res_232812 = x_232810 + x_232811;
            
            local_acc_232887 = defunc_1_op_res_232812;
        }
        // Load accum params
        {
            x_232813 = local_acc_232888;
        }
        // Load next params
        {
            x_232814 = xw_j_232837;
        }
        // Red body
        {
            double defunc_1_op_res_232815 = x_232813 + x_232814;
            
            local_acc_232888 = defunc_1_op_res_232815;
        }
        // Load accum params
        {
            x_232816 = local_acc_232889;
        }
        // Load next params
        {
            x_232817 = x2w_j_232838;
        }
        // Red body
        {
            double defunc_1_op_res_232818 = x_232816 + x_232817;
            
            local_acc_232889 = defunc_1_op_res_232818;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_232880.mem)[flat_tid_232808] =
        local_acc_232887;
    ((double *) reduce_stage_1_tid_res_arr_mem_232882.mem)[flat_tid_232808] =
        local_acc_232888;
    ((double *) reduce_stage_1_tid_res_arr_mem_232884.mem)[flat_tid_232808] =
        local_acc_232889;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236540_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236540_end -
                 futhark_mc_segred_stage_1_parloop_236540_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236540_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236540_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236540_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236535(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232808 = tid;
    int num_tasks_232879 = info.nsubtasks;
    struct futhark_mc_task_236534 *futhark_mc_task_236534 =
                                  (struct futhark_mc_task_236534 *) args;
    struct futhark_context *ctx = futhark_mc_task_236534->ctx;
    uint64_t futhark_mc_segred_task_236535_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236535_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236534->free_n_203572;
    int64_t gtid_214187 = futhark_mc_task_236534->free_gtid_214187;
    int64_t x_214192 = futhark_mc_task_236534->free_x_214192;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236534->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_task_236534->free_mem_220012,
                                  .size =0, .references =NULL};
    int64_t x_232549 = futhark_mc_task_236534->free_x_232549;
    double x_232550 = futhark_mc_task_236534->free_x_232550;
    int64_t defunc_0_g_res_232553 =
            futhark_mc_task_236534->free_defunc_0_g_res_232553;
    double defunc_2_reduce_res_232554 =
           *futhark_mc_task_236534->retval_defunc_2_reduce_res_232554;
    double defunc_2_reduce_res_232555 =
           *futhark_mc_task_236534->retval_defunc_2_reduce_res_232555;
    double defunc_2_reduce_res_232556 =
           *futhark_mc_task_236534->retval_defunc_2_reduce_res_232556;
    size_t reduce_stage_1_tid_res_arr_mem_232880_cached_sizze_236536 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232880 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_232882_cached_sizze_236537 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232882 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_232884_cached_sizze_236538 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232884 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_232880_cached_sizze_236536 <
        (size_t) ((int64_t) 8 * num_tasks_232879)) {
        reduce_stage_1_tid_res_arr_mem_232880 =
            realloc(reduce_stage_1_tid_res_arr_mem_232880, (int64_t) 8 *
                    num_tasks_232879);
        reduce_stage_1_tid_res_arr_mem_232880_cached_sizze_236536 =
            (int64_t) 8 * num_tasks_232879;
    }
    if (reduce_stage_1_tid_res_arr_mem_232882_cached_sizze_236537 <
        (size_t) ((int64_t) 8 * num_tasks_232879)) {
        reduce_stage_1_tid_res_arr_mem_232882 =
            realloc(reduce_stage_1_tid_res_arr_mem_232882, (int64_t) 8 *
                    num_tasks_232879);
        reduce_stage_1_tid_res_arr_mem_232882_cached_sizze_236537 =
            (int64_t) 8 * num_tasks_232879;
    }
    if (reduce_stage_1_tid_res_arr_mem_232884_cached_sizze_236538 <
        (size_t) ((int64_t) 8 * num_tasks_232879)) {
        reduce_stage_1_tid_res_arr_mem_232884 =
            realloc(reduce_stage_1_tid_res_arr_mem_232884, (int64_t) 8 *
                    num_tasks_232879);
        reduce_stage_1_tid_res_arr_mem_232884_cached_sizze_236538 =
            (int64_t) 8 * num_tasks_232879;
    }
    
    int64_t iter_232886;
    struct futhark_mc_segred_stage_1_parloop_struct_236539
    futhark_mc_segred_stage_1_parloop_struct_236539;
    
    futhark_mc_segred_stage_1_parloop_struct_236539.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_gtid_214187 =
        gtid_214187;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_x_214192 = x_214192;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_mem_217458 =
        mem_217458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_mem_220012 =
        mem_220012.mem;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_x_232549 = x_232549;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_x_232550 = x_232550;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_defunc_0_g_res_232553 =
        defunc_0_g_res_232553;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_reduce_stage_1_tid_res_arr_mem_232880 =
        reduce_stage_1_tid_res_arr_mem_232880;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_reduce_stage_1_tid_res_arr_mem_232882 =
        reduce_stage_1_tid_res_arr_mem_232882;
    futhark_mc_segred_stage_1_parloop_struct_236539.free_reduce_stage_1_tid_res_arr_mem_232884 =
        reduce_stage_1_tid_res_arr_mem_232884;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236540_task;
    
    futhark_mc_segred_stage_1_parloop_236540_task.name =
        "futhark_mc_segred_stage_1_parloop_236540";
    futhark_mc_segred_stage_1_parloop_236540_task.fn =
        futhark_mc_segred_stage_1_parloop_236540;
    futhark_mc_segred_stage_1_parloop_236540_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236539;
    futhark_mc_segred_stage_1_parloop_236540_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236540_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236540_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236540_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236540_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236540_task);
    
    if (futhark_mc_segred_stage_1_parloop_236540_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236540_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236540_total_end -
                 futhark_mc_segred_stage_1_parloop_236540_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236540_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236540_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236540_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_232554 = 0.0;
        defunc_2_reduce_res_232555 = 0.0;
        defunc_2_reduce_res_232556 = 0.0;
    }
    
    double x_232890;
    double x_232891;
    double x_232893;
    double x_232894;
    double x_232896;
    double x_232897;
    
    for (int32_t i_232899 = 0; i_232899 < num_tasks_232879; i_232899++) {
        flat_tid_232808 = i_232899;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_232890 = defunc_2_reduce_res_232554;
            }
            // load next params
            {
                x_232891 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232880)[flat_tid_232808];
            }
            // red body
            {
                double defunc_1_op_res_232892 = x_232890 + x_232891;
                
                defunc_2_reduce_res_232554 = defunc_1_op_res_232892;
            }
            // load acc params
            {
                x_232893 = defunc_2_reduce_res_232555;
            }
            // load next params
            {
                x_232894 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232882)[flat_tid_232808];
            }
            // red body
            {
                double defunc_1_op_res_232895 = x_232893 + x_232894;
                
                defunc_2_reduce_res_232555 = defunc_1_op_res_232895;
            }
            // load acc params
            {
                x_232896 = defunc_2_reduce_res_232556;
            }
            // load next params
            {
                x_232897 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232884)[flat_tid_232808];
            }
            // red body
            {
                double defunc_1_op_res_232898 = x_232896 + x_232897;
                
                defunc_2_reduce_res_232556 = defunc_1_op_res_232898;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_232880);
        free(reduce_stage_1_tid_res_arr_mem_232882);
        free(reduce_stage_1_tid_res_arr_mem_232884);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236535_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236535_end -
                 futhark_mc_segred_task_236535_start;
        
        ctx->futhark_mc_segred_task_236535_runs[tid]++;
        ctx->futhark_mc_segred_task_236535_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236535_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236534->retval_defunc_2_reduce_res_232554 =
            defunc_2_reduce_res_232554;
        *futhark_mc_task_236534->retval_defunc_2_reduce_res_232555 =
            defunc_2_reduce_res_232555;
        *futhark_mc_task_236534->retval_defunc_2_reduce_res_232556 =
            defunc_2_reduce_res_232556;
    }
    return err;
}
struct futhark_mc_task_236541 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214187;
    int64_t free_x_214192;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220012;
    unsigned char *free_mem_220015;
    int64_t free_x_232549;
    double free_x_232550;
    int64_t free_defunc_0_g_res_232553;
    double free_a11_232592;
    double free_b11_232594;
    double free_c11_232595;
    double *retval_defunc_2_reduce_res_232596;
    double *retval_defunc_2_reduce_res_232597;
};
struct futhark_mc_segred_stage_1_parloop_struct_236545 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214187;
    int64_t free_x_214192;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220012;
    unsigned char *free_mem_220015;
    int64_t free_x_232549;
    double free_x_232550;
    int64_t free_defunc_0_g_res_232553;
    double free_a11_232592;
    double free_b11_232594;
    double free_c11_232595;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232901;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_232903;
};
static int futhark_mc_segred_stage_1_parloop_236546(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_232839,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236545
    *futhark_mc_segred_stage_1_parloop_struct_236545 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236545 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236545->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236546_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236546_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236545->free_n_203572;
    int64_t gtid_214187 =
            futhark_mc_segred_stage_1_parloop_struct_236545->free_gtid_214187;
    int64_t x_214192 =
            futhark_mc_segred_stage_1_parloop_struct_236545->free_x_214192;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236545->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236545->free_mem_220012,
                                  .size =0, .references =NULL};
    struct memblock mem_220015 = {.desc ="mem_220015", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236545->free_mem_220015,
                                  .size =0, .references =NULL};
    int64_t x_232549 =
            futhark_mc_segred_stage_1_parloop_struct_236545->free_x_232549;
    double x_232550 =
           futhark_mc_segred_stage_1_parloop_struct_236545->free_x_232550;
    int64_t defunc_0_g_res_232553 =
            futhark_mc_segred_stage_1_parloop_struct_236545->free_defunc_0_g_res_232553;
    double a11_232592 =
           futhark_mc_segred_stage_1_parloop_struct_236545->free_a11_232592;
    double b11_232594 =
           futhark_mc_segred_stage_1_parloop_struct_236545->free_b11_232594;
    double c11_232595 =
           futhark_mc_segred_stage_1_parloop_struct_236545->free_c11_232595;
    struct memblock reduce_stage_1_tid_res_arr_mem_232901 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232901",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236545->free_reduce_stage_1_tid_res_arr_mem_232901,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_232903 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_232903",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236545->free_reduce_stage_1_tid_res_arr_mem_232903,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232905 = start;
    double x_232841;
    double x_232842;
    double x_232844;
    double x_232845;
    double local_acc_232906 = 0.0;
    double local_acc_232907 = 0.0;
    
    for (; iter_232905 < end; iter_232905++) {
        int64_t gtid_232840 = iter_232905;
        bool cond_232847 = sle64(x_214192, gtid_232840);
        int64_t defunc_0_f_res_232848;
        
        if (cond_232847) {
            defunc_0_f_res_232848 = (int64_t) 0;
        } else {
            int64_t i_232849 = add64(x_232549, gtid_232840);
            int64_t defunc_0_add_arg_232850;
            
            defunc_0_add_arg_232850 = ((int64_t *) mem_217458.mem)[gtid_214187 *
                                                                   n_203572 +
                                                                   i_232849];
            
            int64_t defunc_1_add_res_232851 = add64((int64_t) 1,
                                                    defunc_0_add_arg_232850);
            
            defunc_0_f_res_232848 = defunc_1_add_res_232851;
        }
        
        double defunc_0_f_res_232852;
        
        if (cond_232847) {
            defunc_0_f_res_232852 = 0.0;
        } else {
            int64_t i_232853 = add64(x_232549, gtid_232840);
            double defunc_0_add_arg_232854;
            
            defunc_0_add_arg_232854 = ((double *) mem_220012.mem)[i_232853];
            defunc_0_f_res_232852 = defunc_0_add_arg_232854;
        }
        
        int64_t binop_p_232855 = sub64(defunc_0_f_res_232848,
                                       defunc_0_g_res_232553);
        double defunc_0_f_res_232856 = sitofp_i64_f64(binop_p_232855);
        double abs_res_232857 = fabs(defunc_0_f_res_232856);
        double tmp1_232858 = abs_res_232857 / x_232550;
        double x_232859 = tmp1_232858 * tmp1_232858;
        double y_232860 = tmp1_232858 * x_232859;
        double tmp2_232861 = 1.0 - y_232860;
        double x_232862 = tmp2_232861 * tmp2_232861;
        double tmp3_232863 = tmp2_232861 * x_232862;
        double tmp4_232864 = defunc_0_f_res_232852 * tmp3_232863;
        double defunc_1_f_res_232865 = defunc_0_f_res_232856 * tmp4_232864;
        double defunc_0_f_res_232866;
        
        if (cond_232847) {
            defunc_0_f_res_232866 = 0.0;
        } else {
            int64_t i_232867 = add64(x_232549, gtid_232840);
            double defunc_0_add_arg_232868;
            
            defunc_0_add_arg_232868 = ((double *) mem_220015.mem)[i_232867];
            defunc_0_f_res_232866 = defunc_0_add_arg_232868;
        }
        
        double x_232869 = a11_232592 * tmp4_232864;
        double y_232870 = b11_232594 * defunc_1_f_res_232865;
        double x_232871 = x_232869 + y_232870;
        double defunc_9_fit_fun_res_232872 = defunc_0_f_res_232866 * x_232871;
        double x_232873 = b11_232594 * tmp4_232864;
        double y_232874 = c11_232595 * defunc_1_f_res_232865;
        double x_232875 = x_232873 + y_232874;
        double defunc_9_slope_fun_res_232876 = defunc_0_f_res_232866 * x_232875;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_232841 = local_acc_232906;
        }
        // Load next params
        {
            x_232842 = defunc_9_fit_fun_res_232872;
        }
        // Red body
        {
            double defunc_1_op_res_232843 = x_232841 + x_232842;
            
            local_acc_232906 = defunc_1_op_res_232843;
        }
        // Load accum params
        {
            x_232844 = local_acc_232907;
        }
        // Load next params
        {
            x_232845 = defunc_9_slope_fun_res_232876;
        }
        // Red body
        {
            double defunc_1_op_res_232846 = x_232844 + x_232845;
            
            local_acc_232907 = defunc_1_op_res_232846;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_232901.mem)[flat_tid_232839] =
        local_acc_232906;
    ((double *) reduce_stage_1_tid_res_arr_mem_232903.mem)[flat_tid_232839] =
        local_acc_232907;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236546_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236546_end -
                 futhark_mc_segred_stage_1_parloop_236546_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236546_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236546_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236546_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236542(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232839 = tid;
    int num_tasks_232900 = info.nsubtasks;
    struct futhark_mc_task_236541 *futhark_mc_task_236541 =
                                  (struct futhark_mc_task_236541 *) args;
    struct futhark_context *ctx = futhark_mc_task_236541->ctx;
    uint64_t futhark_mc_segred_task_236542_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236542_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236541->free_n_203572;
    int64_t gtid_214187 = futhark_mc_task_236541->free_gtid_214187;
    int64_t x_214192 = futhark_mc_task_236541->free_x_214192;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236541->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_task_236541->free_mem_220012,
                                  .size =0, .references =NULL};
    struct memblock mem_220015 = {.desc ="mem_220015", .mem =
                                  futhark_mc_task_236541->free_mem_220015,
                                  .size =0, .references =NULL};
    int64_t x_232549 = futhark_mc_task_236541->free_x_232549;
    double x_232550 = futhark_mc_task_236541->free_x_232550;
    int64_t defunc_0_g_res_232553 =
            futhark_mc_task_236541->free_defunc_0_g_res_232553;
    double a11_232592 = futhark_mc_task_236541->free_a11_232592;
    double b11_232594 = futhark_mc_task_236541->free_b11_232594;
    double c11_232595 = futhark_mc_task_236541->free_c11_232595;
    double defunc_2_reduce_res_232596 =
           *futhark_mc_task_236541->retval_defunc_2_reduce_res_232596;
    double defunc_2_reduce_res_232597 =
           *futhark_mc_task_236541->retval_defunc_2_reduce_res_232597;
    size_t reduce_stage_1_tid_res_arr_mem_232901_cached_sizze_236543 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232901 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_232903_cached_sizze_236544 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_232903 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_232901_cached_sizze_236543 <
        (size_t) ((int64_t) 8 * num_tasks_232900)) {
        reduce_stage_1_tid_res_arr_mem_232901 =
            realloc(reduce_stage_1_tid_res_arr_mem_232901, (int64_t) 8 *
                    num_tasks_232900);
        reduce_stage_1_tid_res_arr_mem_232901_cached_sizze_236543 =
            (int64_t) 8 * num_tasks_232900;
    }
    if (reduce_stage_1_tid_res_arr_mem_232903_cached_sizze_236544 <
        (size_t) ((int64_t) 8 * num_tasks_232900)) {
        reduce_stage_1_tid_res_arr_mem_232903 =
            realloc(reduce_stage_1_tid_res_arr_mem_232903, (int64_t) 8 *
                    num_tasks_232900);
        reduce_stage_1_tid_res_arr_mem_232903_cached_sizze_236544 =
            (int64_t) 8 * num_tasks_232900;
    }
    
    int64_t iter_232905;
    struct futhark_mc_segred_stage_1_parloop_struct_236545
    futhark_mc_segred_stage_1_parloop_struct_236545;
    
    futhark_mc_segred_stage_1_parloop_struct_236545.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_gtid_214187 =
        gtid_214187;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_x_214192 = x_214192;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_mem_217458 =
        mem_217458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_mem_220012 =
        mem_220012.mem;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_mem_220015 =
        mem_220015.mem;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_x_232549 = x_232549;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_x_232550 = x_232550;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_defunc_0_g_res_232553 =
        defunc_0_g_res_232553;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_a11_232592 =
        a11_232592;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_b11_232594 =
        b11_232594;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_c11_232595 =
        c11_232595;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_reduce_stage_1_tid_res_arr_mem_232901 =
        reduce_stage_1_tid_res_arr_mem_232901;
    futhark_mc_segred_stage_1_parloop_struct_236545.free_reduce_stage_1_tid_res_arr_mem_232903 =
        reduce_stage_1_tid_res_arr_mem_232903;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236546_task;
    
    futhark_mc_segred_stage_1_parloop_236546_task.name =
        "futhark_mc_segred_stage_1_parloop_236546";
    futhark_mc_segred_stage_1_parloop_236546_task.fn =
        futhark_mc_segred_stage_1_parloop_236546;
    futhark_mc_segred_stage_1_parloop_236546_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236545;
    futhark_mc_segred_stage_1_parloop_236546_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236546_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236546_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236546_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236546_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236546_task);
    
    if (futhark_mc_segred_stage_1_parloop_236546_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236546_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236546_total_end -
                 futhark_mc_segred_stage_1_parloop_236546_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236546_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236546_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236546_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_232596 = 0.0;
        defunc_2_reduce_res_232597 = 0.0;
    }
    
    double x_232908;
    double x_232909;
    double x_232911;
    double x_232912;
    
    for (int32_t i_232914 = 0; i_232914 < num_tasks_232900; i_232914++) {
        flat_tid_232839 = i_232914;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_232908 = defunc_2_reduce_res_232596;
            }
            // load next params
            {
                x_232909 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232901)[flat_tid_232839];
            }
            // red body
            {
                double defunc_1_op_res_232910 = x_232908 + x_232909;
                
                defunc_2_reduce_res_232596 = defunc_1_op_res_232910;
            }
            // load acc params
            {
                x_232911 = defunc_2_reduce_res_232597;
            }
            // load next params
            {
                x_232912 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_232903)[flat_tid_232839];
            }
            // red body
            {
                double defunc_1_op_res_232913 = x_232911 + x_232912;
                
                defunc_2_reduce_res_232597 = defunc_1_op_res_232913;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_232901);
        free(reduce_stage_1_tid_res_arr_mem_232903);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236542_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236542_end -
                 futhark_mc_segred_task_236542_start;
        
        ctx->futhark_mc_segred_task_236542_runs[tid]++;
        ctx->futhark_mc_segred_task_236542_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236542_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236541->retval_defunc_2_reduce_res_232596 =
            defunc_2_reduce_res_232596;
        *futhark_mc_task_236541->retval_defunc_2_reduce_res_232597 =
            defunc_2_reduce_res_232597;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236533(void *args, int64_t start,
                                            int64_t end, int flat_tid_232547,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236532
    *futhark_mc_segmap_parloop_struct_236532 =
    (struct futhark_mc_segmap_parloop_struct_236532 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236532->ctx;
    uint64_t futhark_mc_segmap_parloop_236533_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236533_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236532->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236532->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236532->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236532->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236532->free_i_203760;
    int64_t gtid_214187 =
            futhark_mc_segmap_parloop_struct_236532->free_gtid_214187;
    int64_t x_214192 = futhark_mc_segmap_parloop_struct_236532->free_x_214192;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236532->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236532->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236532->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_segmap_parloop_struct_236532->free_mem_220012,
                                  .size =0, .references =NULL};
    struct memblock mem_220015 = {.desc ="mem_220015", .mem =
                                  futhark_mc_segmap_parloop_struct_236532->free_mem_220015,
                                  .size =0, .references =NULL};
    struct memblock mem_220018 = {.desc ="mem_220018", .mem =
                                  futhark_mc_segmap_parloop_struct_236532->free_mem_220018,
                                  .size =0, .references =NULL};
    struct memblock mem_220021 = {.desc ="mem_220021", .mem =
                                  futhark_mc_segmap_parloop_struct_236532->free_mem_220021,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_232807 = start;
    
    for (; iter_232807 < end; iter_232807++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232877 = t_n_m_203740;
        int64_t gtid_232548 = iter_232807;
        int64_t remnant_232878 = iter_232807 - gtid_232548;
        int64_t x_232549;
        
        x_232549 = ((int64_t *) mem_217953.mem)[gtid_214187 * t_n_m_203740 +
                                                gtid_232548];
        
        double x_232550;
        
        x_232550 = ((double *) mem_217957.mem)[gtid_214187 * t_n_m_203740 +
                                               gtid_232548];
        
        int64_t min_arg_232551 = mul64(jump_t_203582, gtid_232548);
        int64_t min_res_232552 = smin64(i_203760, min_arg_232551);
        int64_t defunc_0_g_res_232553 = add64((int64_t) 1, min_res_232552);
        double defunc_2_reduce_res_232554;
        double defunc_2_reduce_res_232555;
        double defunc_2_reduce_res_232556;
        int64_t flat_tid_232808 = (int64_t) 0;
        int32_t num_tasks_232879;
        
        defunc_2_reduce_res_232554 = 0.0;
        defunc_2_reduce_res_232555 = 0.0;
        defunc_2_reduce_res_232556 = 0.0;
        
        struct futhark_mc_task_236534 futhark_mc_task_236534;
        
        futhark_mc_task_236534.ctx = ctx;
        futhark_mc_task_236534.free_n_203572 = n_203572;
        futhark_mc_task_236534.free_gtid_214187 = gtid_214187;
        futhark_mc_task_236534.free_x_214192 = x_214192;
        futhark_mc_task_236534.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236534.free_mem_220012 = mem_220012.mem;
        futhark_mc_task_236534.free_x_232549 = x_232549;
        futhark_mc_task_236534.free_x_232550 = x_232550;
        futhark_mc_task_236534.free_defunc_0_g_res_232553 =
            defunc_0_g_res_232553;
        futhark_mc_task_236534.retval_defunc_2_reduce_res_232554 =
            &defunc_2_reduce_res_232554;
        futhark_mc_task_236534.retval_defunc_2_reduce_res_232555 =
            &defunc_2_reduce_res_232555;
        futhark_mc_task_236534.retval_defunc_2_reduce_res_232556 =
            &defunc_2_reduce_res_232556;
        
        struct scheduler_segop futhark_mc_task_236534_task;
        
        futhark_mc_task_236534_task.args = &futhark_mc_task_236534;
        futhark_mc_task_236534_task.top_level_fn =
            futhark_mc_segred_task_236535;
        futhark_mc_task_236534_task.name = "futhark_mc_segred_task_236535";
        futhark_mc_task_236534_task.iterations = q_t_203576;
        futhark_mc_task_236534_task.task_time =
            &ctx->futhark_mc_segred_task_236535_total_time;
        futhark_mc_task_236534_task.task_iter =
            &ctx->futhark_mc_segred_task_236535_total_iter;
        futhark_mc_task_236534_task.sched = STATIC;
        futhark_mc_task_236534_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236535_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236534_task);
        
        if (futhark_mc_segred_task_236535_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_232588 = defunc_2_reduce_res_232554 *
               defunc_2_reduce_res_232556;
        double y_232589 = defunc_2_reduce_res_232555 *
               defunc_2_reduce_res_232555;
        double y_232590 = x_232588 - y_232589;
        double det1_232591 = 1.0 / y_232590;
        double a11_232592 = defunc_2_reduce_res_232556 * det1_232591;
        double x_232593 = 0.0 - defunc_2_reduce_res_232555;
        double b11_232594 = det1_232591 * x_232593;
        double c11_232595 = defunc_2_reduce_res_232554 * det1_232591;
        double defunc_2_reduce_res_232596;
        double defunc_2_reduce_res_232597;
        int64_t flat_tid_232839 = (int64_t) 0;
        int32_t num_tasks_232900;
        
        defunc_2_reduce_res_232596 = 0.0;
        defunc_2_reduce_res_232597 = 0.0;
        
        struct futhark_mc_task_236541 futhark_mc_task_236541;
        
        futhark_mc_task_236541.ctx = ctx;
        futhark_mc_task_236541.free_n_203572 = n_203572;
        futhark_mc_task_236541.free_gtid_214187 = gtid_214187;
        futhark_mc_task_236541.free_x_214192 = x_214192;
        futhark_mc_task_236541.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236541.free_mem_220012 = mem_220012.mem;
        futhark_mc_task_236541.free_mem_220015 = mem_220015.mem;
        futhark_mc_task_236541.free_x_232549 = x_232549;
        futhark_mc_task_236541.free_x_232550 = x_232550;
        futhark_mc_task_236541.free_defunc_0_g_res_232553 =
            defunc_0_g_res_232553;
        futhark_mc_task_236541.free_a11_232592 = a11_232592;
        futhark_mc_task_236541.free_b11_232594 = b11_232594;
        futhark_mc_task_236541.free_c11_232595 = c11_232595;
        futhark_mc_task_236541.retval_defunc_2_reduce_res_232596 =
            &defunc_2_reduce_res_232596;
        futhark_mc_task_236541.retval_defunc_2_reduce_res_232597 =
            &defunc_2_reduce_res_232597;
        
        struct scheduler_segop futhark_mc_task_236541_task;
        
        futhark_mc_task_236541_task.args = &futhark_mc_task_236541;
        futhark_mc_task_236541_task.top_level_fn =
            futhark_mc_segred_task_236542;
        futhark_mc_task_236541_task.name = "futhark_mc_segred_task_236542";
        futhark_mc_task_236541_task.iterations = q_t_203576;
        futhark_mc_task_236541_task.task_time =
            &ctx->futhark_mc_segred_task_236542_total_time;
        futhark_mc_task_236541_task.task_iter =
            &ctx->futhark_mc_segred_task_236542_total_iter;
        futhark_mc_task_236541_task.sched = STATIC;
        futhark_mc_task_236541_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236542_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236541_task);
        
        if (futhark_mc_segred_task_236542_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_220018.mem)[gtid_232548] = defunc_2_reduce_res_232596;
        ((double *) mem_220021.mem)[gtid_232548] = defunc_2_reduce_res_232597;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236533_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236533_end -
                 futhark_mc_segmap_parloop_236533_start;
        
        ctx->futhark_mc_segmap_parloop_236533_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236533_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236533_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236531(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_232547 = tid;
    int num_tasks_232736 = info.nsubtasks;
    struct futhark_mc_task_236527 *futhark_mc_task_236527 =
                                  (struct futhark_mc_task_236527 *) args;
    struct futhark_context *ctx = futhark_mc_task_236527->ctx;
    uint64_t futhark_mc_segmap_nested_task_236531_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236531_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236527->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236527->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236527->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236527->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236527->free_i_203760;
    int64_t gtid_214187 = futhark_mc_task_236527->free_gtid_214187;
    int64_t x_214192 = futhark_mc_task_236527->free_x_214192;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236527->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236527->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236527->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220012 = {.desc ="mem_220012", .mem =
                                  futhark_mc_task_236527->free_mem_220012,
                                  .size =0, .references =NULL};
    struct memblock mem_220015 = {.desc ="mem_220015", .mem =
                                  futhark_mc_task_236527->free_mem_220015,
                                  .size =0, .references =NULL};
    struct memblock mem_220018 = {.desc ="mem_220018", .mem =
                                  futhark_mc_task_236527->free_mem_220018,
                                  .size =0, .references =NULL};
    struct memblock mem_220021 = {.desc ="mem_220021", .mem =
                                  futhark_mc_task_236527->free_mem_220021,
                                  .size =0, .references =NULL};
    int64_t iter_232807;
    struct futhark_mc_segmap_parloop_struct_236532
    futhark_mc_segmap_parloop_struct_236532;
    
    futhark_mc_segmap_parloop_struct_236532.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236532.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236532.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236532.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236532.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236532.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236532.free_gtid_214187 = gtid_214187;
    futhark_mc_segmap_parloop_struct_236532.free_x_214192 = x_214192;
    futhark_mc_segmap_parloop_struct_236532.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236532.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236532.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236532.free_mem_220012 = mem_220012.mem;
    futhark_mc_segmap_parloop_struct_236532.free_mem_220015 = mem_220015.mem;
    futhark_mc_segmap_parloop_struct_236532.free_mem_220018 = mem_220018.mem;
    futhark_mc_segmap_parloop_struct_236532.free_mem_220021 = mem_220021.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236533_task;
    
    futhark_mc_segmap_parloop_236533_task.name =
        "futhark_mc_segmap_parloop_236533";
    futhark_mc_segmap_parloop_236533_task.fn = futhark_mc_segmap_parloop_236533;
    futhark_mc_segmap_parloop_236533_task.args =
        &futhark_mc_segmap_parloop_struct_236532;
    futhark_mc_segmap_parloop_236533_task.iterations = iterations;
    futhark_mc_segmap_parloop_236533_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236533_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236533_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236533_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236533_task);
    
    if (futhark_mc_segmap_parloop_236533_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236533_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236533_total_end -
                 futhark_mc_segmap_parloop_236533_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236533_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236533_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236533_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236531_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236531_end -
                 futhark_mc_segmap_nested_task_236531_start;
        
        ctx->futhark_mc_segmap_nested_task_236531_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236531_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236531_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236513(void *args, int64_t start,
                                            int64_t end, int flat_tid_214186,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236512
    *futhark_mc_segmap_parloop_struct_236512 =
    (struct futhark_mc_segmap_parloop_struct_236512 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236512->ctx;
    uint64_t futhark_mc_segmap_parloop_236513_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236513_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236512->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236512->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236512->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236512->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236512->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236512->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236512->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236512->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236512->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236512->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236512->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236512->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236512->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236512->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236512->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236512->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236512->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236512->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220100 = {.desc ="mem_220100", .mem =
                                  futhark_mc_segmap_parloop_struct_236512->free_mem_220100,
                                  .size =0, .references =NULL};
    struct memblock mem_220104 = {.desc ="mem_220104", .mem =
                                  futhark_mc_segmap_parloop_struct_236512->free_mem_220104,
                                  .size =0, .references =NULL};
    size_t mem_220009_cached_sizze_236514 = 0;
    unsigned char *mem_220009 = NULL;
    size_t mem_220012_cached_sizze_236515 = 0;
    unsigned char *mem_220012 = NULL;
    size_t mem_220015_cached_sizze_236516 = 0;
    unsigned char *mem_220015 = NULL;
    size_t mem_220018_cached_sizze_236517 = 0;
    unsigned char *mem_220018 = NULL;
    size_t mem_220021_cached_sizze_236518 = 0;
    unsigned char *mem_220021 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232527 = start;
    
    if (mem_220009_cached_sizze_236514 < (size_t) bytes_217420) {
        mem_220009 = realloc(mem_220009, bytes_217420);
        mem_220009_cached_sizze_236514 = bytes_217420;
    }
    if (mem_220012_cached_sizze_236515 < (size_t) bytes_217420) {
        mem_220012 = realloc(mem_220012, bytes_217420);
        mem_220012_cached_sizze_236515 = bytes_217420;
    }
    if (mem_220015_cached_sizze_236516 < (size_t) bytes_217420) {
        mem_220015 = realloc(mem_220015, bytes_217420);
        mem_220015_cached_sizze_236516 = bytes_217420;
    }
    if (mem_220018_cached_sizze_236517 < (size_t) bytes_217900) {
        mem_220018 = realloc(mem_220018, bytes_217900);
        mem_220018_cached_sizze_236517 = bytes_217900;
    }
    if (mem_220021_cached_sizze_236518 < (size_t) bytes_217900) {
        mem_220021 = realloc(mem_220021, bytes_217900);
        mem_220021_cached_sizze_236518 = bytes_217900;
    }
    for (; iter_232527 < end; iter_232527++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_232718 = partition_sizze_203667;
        int64_t gtid_214187 = iter_232527;
        int64_t remnant_232719 = iter_232527 - gtid_214187;
        int64_t x_214192;
        
        x_214192 = ((int64_t *) mem_217461.mem)[gtid_214187];
        
        int64_t flat_tid_232528 = (int64_t) 0;
        int32_t num_tasks_232720;
        struct futhark_mc_task_236519 futhark_mc_task_236519;
        
        futhark_mc_task_236519.ctx = ctx;
        futhark_mc_task_236519.free_n_203572 = n_203572;
        futhark_mc_task_236519.free_gtid_214187 = gtid_214187;
        futhark_mc_task_236519.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_236519.free_mem_219926 = mem_219926.mem;
        futhark_mc_task_236519.free_mem_220009 = mem_220009;
        
        struct scheduler_segop futhark_mc_task_236519_task;
        
        futhark_mc_task_236519_task.args = &futhark_mc_task_236519;
        futhark_mc_task_236519_task.top_level_fn =
            futhark_mc_segmap_task_236520;
        futhark_mc_task_236519_task.name = "futhark_mc_segmap_task_236520";
        futhark_mc_task_236519_task.iterations = n_203572;
        futhark_mc_task_236519_task.task_time =
            &ctx->futhark_mc_segmap_task_236520_total_time;
        futhark_mc_task_236519_task.task_iter =
            &ctx->futhark_mc_segmap_task_236520_total_iter;
        futhark_mc_task_236519_task.sched = STATIC;
        futhark_mc_task_236519_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236520_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236519_task);
        
        if (futhark_mc_segmap_task_236520_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_232533 = (int64_t) 0;
        int32_t num_tasks_232724;
        struct futhark_mc_task_236523 futhark_mc_task_236523;
        
        futhark_mc_task_236523.ctx = ctx;
        futhark_mc_task_236523.free_n_203572 = n_203572;
        futhark_mc_task_236523.free_gtid_214187 = gtid_214187;
        futhark_mc_task_236523.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236523.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236523.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236523.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236523.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236523.free_mem_220009 = mem_220009;
        futhark_mc_task_236523.free_mem_220012 = mem_220012;
        futhark_mc_task_236523.free_mem_220015 = mem_220015;
        
        struct scheduler_segop futhark_mc_task_236523_task;
        
        futhark_mc_task_236523_task.args = &futhark_mc_task_236523;
        futhark_mc_task_236523_task.top_level_fn =
            futhark_mc_segmap_task_236524;
        futhark_mc_task_236523_task.name = "futhark_mc_segmap_task_236524";
        futhark_mc_task_236523_task.iterations = n_203572;
        futhark_mc_task_236523_task.task_time =
            &ctx->futhark_mc_segmap_task_236524_total_time;
        futhark_mc_task_236523_task.task_iter =
            &ctx->futhark_mc_segmap_task_236524_total_iter;
        futhark_mc_task_236523_task.sched = STATIC;
        futhark_mc_task_236523_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236524_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236523_task);
        
        if (futhark_mc_segmap_task_236524_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_232636 = (int64_t) 0;
        int32_t num_tasks_232736;
        int64_t flat_tid_232547 = (int64_t) 0;
        struct futhark_mc_task_236527 futhark_mc_task_236527;
        
        futhark_mc_task_236527.ctx = ctx;
        futhark_mc_task_236527.free_n_203572 = n_203572;
        futhark_mc_task_236527.free_q_t_203576 = q_t_203576;
        futhark_mc_task_236527.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236527.free_t_n_m_203740 = t_n_m_203740;
        futhark_mc_task_236527.free_i_203760 = i_203760;
        futhark_mc_task_236527.free_gtid_214187 = gtid_214187;
        futhark_mc_task_236527.free_x_214192 = x_214192;
        futhark_mc_task_236527.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236527.free_mem_217953 = mem_217953.mem;
        futhark_mc_task_236527.free_mem_217957 = mem_217957.mem;
        futhark_mc_task_236527.free_mem_220012 = mem_220012;
        futhark_mc_task_236527.free_mem_220015 = mem_220015;
        futhark_mc_task_236527.free_mem_220018 = mem_220018;
        futhark_mc_task_236527.free_mem_220021 = mem_220021;
        
        struct scheduler_segop futhark_mc_task_236527_task;
        
        futhark_mc_task_236527_task.args = &futhark_mc_task_236527;
        futhark_mc_task_236527_task.top_level_fn =
            futhark_mc_segmap_task_236528;
        futhark_mc_task_236527_task.name = "futhark_mc_segmap_task_236528";
        futhark_mc_task_236527_task.iterations = t_n_m_203740;
        futhark_mc_task_236527_task.task_time =
            &ctx->futhark_mc_segmap_task_236528_total_time;
        futhark_mc_task_236527_task.task_iter =
            &ctx->futhark_mc_segmap_task_236528_total_iter;
        futhark_mc_task_236527_task.sched = STATIC;
        futhark_mc_task_236527_task.nested_fn =
            futhark_mc_segmap_nested_task_236531;
        
        int futhark_mc_segmap_task_236528_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236527_task);
        
        if (futhark_mc_segmap_task_236528_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220100.mem + gtid_214187 * t_n_m_203740 * (int64_t) 8,
                    mem_220018 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220104.mem + gtid_214187 * t_n_m_203740 * (int64_t) 8,
                    mem_220021 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220009);
    free(mem_220012);
    free(mem_220015);
    free(mem_220018);
    free(mem_220021);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236513_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236513_end -
                 futhark_mc_segmap_parloop_236513_start;
        
        ctx->futhark_mc_segmap_parloop_236513_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236513_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236513_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236511(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214186 = tid;
    int num_tasks_232405 = info.nsubtasks;
    struct futhark_mc_task_236502 *futhark_mc_task_236502 =
                                  (struct futhark_mc_task_236502 *) args;
    struct futhark_context *ctx = futhark_mc_task_236502->ctx;
    uint64_t futhark_mc_segmap_nested_task_236511_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236511_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236502->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236502->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236502->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236502->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236502->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236502->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236502->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236502->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236502->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236502->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236502->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236502->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236502->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236502->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236502->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236502->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236502->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236502->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220100 = {.desc ="mem_220100", .mem =
                                  futhark_mc_task_236502->free_mem_220100,
                                  .size =0, .references =NULL};
    struct memblock mem_220104 = {.desc ="mem_220104", .mem =
                                  futhark_mc_task_236502->free_mem_220104,
                                  .size =0, .references =NULL};
    int64_t iter_232527;
    struct futhark_mc_segmap_parloop_struct_236512
    futhark_mc_segmap_parloop_struct_236512;
    
    futhark_mc_segmap_parloop_struct_236512.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236512.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236512.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236512.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236512.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236512.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236512.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236512.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236512.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236512.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236512.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236512.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236512.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236512.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236512.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236512.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236512.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236512.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236512.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236512.free_mem_220100 = mem_220100.mem;
    futhark_mc_segmap_parloop_struct_236512.free_mem_220104 = mem_220104.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236513_task;
    
    futhark_mc_segmap_parloop_236513_task.name =
        "futhark_mc_segmap_parloop_236513";
    futhark_mc_segmap_parloop_236513_task.fn = futhark_mc_segmap_parloop_236513;
    futhark_mc_segmap_parloop_236513_task.args =
        &futhark_mc_segmap_parloop_struct_236512;
    futhark_mc_segmap_parloop_236513_task.iterations = iterations;
    futhark_mc_segmap_parloop_236513_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236513_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236513_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236513_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236513_task);
    
    if (futhark_mc_segmap_parloop_236513_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236513_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236513_total_end -
                 futhark_mc_segmap_parloop_236513_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236513_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236513_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236513_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236511_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236511_end -
                 futhark_mc_segmap_nested_task_236511_start;
        
        ctx->futhark_mc_segmap_nested_task_236511_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236511_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236511_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236547 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220198;
    unsigned char *free_mem_220202;
};
struct futhark_mc_segmap_parloop_struct_236549 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220198;
    unsigned char *free_mem_220202;
};
static int futhark_mc_segmap_parloop_236550(void *args, int64_t start,
                                            int64_t end, int flat_tid_214399,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236549
    *futhark_mc_segmap_parloop_struct_236549 =
    (struct futhark_mc_segmap_parloop_struct_236549 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236549->ctx;
    uint64_t futhark_mc_segmap_parloop_236550_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236550_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236549->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236549->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236549->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236549->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236549->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236549->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236549->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236549->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236549->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236549->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236549->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236549->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236549->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236549->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236549->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236549->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236549->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236549->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220198 = {.desc ="mem_220198", .mem =
                                  futhark_mc_segmap_parloop_struct_236549->free_mem_220198,
                                  .size =0, .references =NULL};
    struct memblock mem_220202 = {.desc ="mem_220202", .mem =
                                  futhark_mc_segmap_parloop_struct_236549->free_mem_220202,
                                  .size =0, .references =NULL};
    size_t mem_220122_cached_sizze_236551 = 0;
    unsigned char *mem_220122 = NULL;
    size_t mem_220137_cached_sizze_236552 = 0;
    unsigned char *mem_220137 = NULL;
    size_t mem_220140_cached_sizze_236553 = 0;
    unsigned char *mem_220140 = NULL;
    size_t mem_220167_cached_sizze_236554 = 0;
    unsigned char *mem_220167 = NULL;
    size_t mem_220170_cached_sizze_236555 = 0;
    unsigned char *mem_220170 = NULL;
    int64_t iterations = end - start;
    int64_t iter_232916 = start;
    
    if (mem_220122_cached_sizze_236551 < (size_t) bytes_217420) {
        mem_220122 = realloc(mem_220122, bytes_217420);
        mem_220122_cached_sizze_236551 = bytes_217420;
    }
    if (mem_220137_cached_sizze_236552 < (size_t) bytes_217420) {
        mem_220137 = realloc(mem_220137, bytes_217420);
        mem_220137_cached_sizze_236552 = bytes_217420;
    }
    if (mem_220140_cached_sizze_236553 < (size_t) bytes_217420) {
        mem_220140 = realloc(mem_220140, bytes_217420);
        mem_220140_cached_sizze_236553 = bytes_217420;
    }
    if (mem_220167_cached_sizze_236554 < (size_t) bytes_217900) {
        mem_220167 = realloc(mem_220167, bytes_217900);
        mem_220167_cached_sizze_236554 = bytes_217900;
    }
    if (mem_220170_cached_sizze_236555 < (size_t) bytes_217900) {
        mem_220170 = realloc(mem_220170, bytes_217900);
        mem_220170_cached_sizze_236555 = bytes_217900;
    }
    for (; iter_232916 < end; iter_232916++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233055 = partition_sizze_203667;
        int64_t gtid_214400 = iter_232916;
        int64_t remnant_233056 = iter_232916 - gtid_214400;
        int64_t x_206161;
        
        x_206161 = ((int64_t *) mem_217461.mem)[gtid_214400];
        for (int64_t i_232917 = 0; i_232917 < n_203572; i_232917++) {
            double x_232919;
            
            x_232919 = ((double *) mem_217415.mem)[gtid_214400 * n_203572 +
                                                   i_232917];
            
            double x_232920;
            
            x_232920 = ((double *) mem_219926.mem)[gtid_214400 * n_203572 +
                                                   i_232917];
            
            double defunc_1_f_res_232921 = x_232919 - x_232920;
            
            ((double *) mem_220122)[i_232917] = defunc_1_f_res_232921;
        }
        for (int64_t i_232923 = 0; i_232923 < n_203572; i_232923++) {
            int64_t x_232926;
            
            x_232926 = ((int64_t *) mem_217458.mem)[gtid_214400 * n_203572 +
                                                    i_232923];
            
            bool cond_232927 = sle64((int64_t) 0, x_232926);
            double defunc_0_f_res_232928;
            
            if (cond_232927) {
                bool y_232929 = slt64(x_232926, n_203572);
                bool bounds_check_232930 = cond_232927 && y_232929;
                bool index_certs_232931;
                
                if (!bounds_check_232930) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232926,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_232932;
                
                defunc_0_f_res_t_res_232932 = ((double *) mem_220122)[x_232926];
                defunc_0_f_res_232928 = defunc_0_f_res_t_res_232932;
            } else {
                defunc_0_f_res_232928 = 0.0;
            }
            
            double defunc_0_f_res_232933;
            
            if (cond_232927) {
                bool y_232934 = slt64(x_232926, n_203572);
                bool bounds_check_232935 = cond_232927 && y_232934;
                bool index_certs_232936;
                
                if (!bounds_check_232935) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_232926,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_232937;
                
                defunc_0_f_res_t_res_232937 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_214400 *
                                                       ctx_param_ext_217985 +
                                                       x_232926 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_232933 = defunc_0_f_res_t_res_232937;
            } else {
                defunc_0_f_res_232933 = 0.0;
            }
            ((double *) mem_220137)[i_232923] = defunc_0_f_res_232933;
            ((double *) mem_220140)[i_232923] = defunc_0_f_res_232928;
        }
        for (int64_t i_232940 = 0; i_232940 < t_n_m_203740; i_232940++) {
            int64_t x_232943;
            
            x_232943 = ((int64_t *) mem_217953.mem)[gtid_214400 * t_n_m_203740 +
                                                    i_232940];
            
            double x_232944;
            
            x_232944 = ((double *) mem_217957.mem)[gtid_214400 * t_n_m_203740 +
                                                   i_232940];
            
            int64_t min_arg_232945 = mul64(jump_t_203582, i_232940);
            int64_t min_res_232946 = smin64(i_203760, min_arg_232945);
            int64_t defunc_0_g_res_232947 = add64((int64_t) 1, min_res_232946);
            double defunc_2_reduce_res_232948;
            double defunc_2_reduce_res_232949;
            double defunc_2_reduce_res_232950;
            double defunc_2_reduce_res_232951;
            double defunc_2_reduce_res_232952;
            double redout_232954;
            double redout_232955;
            double redout_232956;
            double redout_232957;
            double redout_232958;
            
            redout_232954 = 0.0;
            redout_232955 = 0.0;
            redout_232956 = 0.0;
            redout_232957 = 0.0;
            redout_232958 = 0.0;
            for (int64_t i_232953 = 0; i_232953 < q_t_203576; i_232953++) {
                bool cond_232959 = sle64(x_206161, i_232953);
                int64_t defunc_0_f_res_232960;
                
                if (cond_232959) {
                    defunc_0_f_res_232960 = (int64_t) 0;
                } else {
                    int64_t i_232961 = add64(x_232943, i_232953);
                    int64_t defunc_0_add_arg_232962;
                    
                    defunc_0_add_arg_232962 =
                        ((int64_t *) mem_217458.mem)[gtid_214400 * n_203572 +
                                                     i_232961];
                    
                    int64_t defunc_1_add_res_232963 = add64((int64_t) 1,
                                                            defunc_0_add_arg_232962);
                    
                    defunc_0_f_res_232960 = defunc_1_add_res_232963;
                }
                
                double defunc_0_f_res_232964;
                
                if (cond_232959) {
                    defunc_0_f_res_232964 = 0.0;
                } else {
                    int64_t i_232965 = add64(x_232943, i_232953);
                    double defunc_0_add_arg_232966;
                    
                    defunc_0_add_arg_232966 = ((double *) mem_220137)[i_232965];
                    defunc_0_f_res_232964 = defunc_0_add_arg_232966;
                }
                
                int64_t binop_p_232967 = sub64(defunc_0_f_res_232960,
                                               defunc_0_g_res_232947);
                double defunc_0_f_res_232968 = sitofp_i64_f64(binop_p_232967);
                double abs_res_232969 = fabs(defunc_0_f_res_232968);
                double tmp1_232970 = abs_res_232969 / x_232944;
                double x_232971 = tmp1_232970 * tmp1_232970;
                double y_232972 = tmp1_232970 * x_232971;
                double tmp2_232973 = 1.0 - y_232972;
                double x_232974 = tmp2_232973 * tmp2_232973;
                double tmp3_232975 = tmp2_232973 * x_232974;
                double w_j_232976 = defunc_0_f_res_232964 * tmp3_232975;
                double xw_j_232977 = defunc_0_f_res_232968 * w_j_232976;
                double x2w_j_232978 = defunc_0_f_res_232968 * xw_j_232977;
                double x3w_j_232979 = defunc_0_f_res_232968 * x2w_j_232978;
                double x4w_j_232980 = defunc_0_f_res_232968 * x3w_j_232979;
                double defunc_1_op_res_232981 = w_j_232976 + redout_232954;
                double defunc_1_op_res_232982 = xw_j_232977 + redout_232955;
                double defunc_1_op_res_232983 = x2w_j_232978 + redout_232956;
                double defunc_1_op_res_232984 = x3w_j_232979 + redout_232957;
                double defunc_1_op_res_232985 = x4w_j_232980 + redout_232958;
                double redout_tmp_233062 = defunc_1_op_res_232981;
                double redout_tmp_233063 = defunc_1_op_res_232982;
                double redout_tmp_233064 = defunc_1_op_res_232983;
                double redout_tmp_233065 = defunc_1_op_res_232984;
                double redout_tmp_233066 = defunc_1_op_res_232985;
                
                redout_232954 = redout_tmp_233062;
                redout_232955 = redout_tmp_233063;
                redout_232956 = redout_tmp_233064;
                redout_232957 = redout_tmp_233065;
                redout_232958 = redout_tmp_233066;
            }
            defunc_2_reduce_res_232948 = redout_232954;
            defunc_2_reduce_res_232949 = redout_232955;
            defunc_2_reduce_res_232950 = redout_232956;
            defunc_2_reduce_res_232951 = redout_232957;
            defunc_2_reduce_res_232952 = redout_232958;
            
            double x_232986 = defunc_2_reduce_res_232950 *
                   defunc_2_reduce_res_232952;
            double y_232987 = defunc_2_reduce_res_232951 *
                   defunc_2_reduce_res_232951;
            double a12_232988 = x_232986 - y_232987;
            double x_232989 = defunc_2_reduce_res_232950 *
                   defunc_2_reduce_res_232951;
            double y_232990 = defunc_2_reduce_res_232949 *
                   defunc_2_reduce_res_232952;
            double b12_232991 = x_232989 - y_232990;
            double x_232992 = defunc_2_reduce_res_232949 *
                   defunc_2_reduce_res_232951;
            double y_232993 = defunc_2_reduce_res_232950 *
                   defunc_2_reduce_res_232950;
            double c12_232994 = x_232992 - y_232993;
            double x_232995 = defunc_2_reduce_res_232948 *
                   defunc_2_reduce_res_232952;
            double b2_232996 = x_232995 - y_232993;
            double x_232997 = defunc_2_reduce_res_232949 *
                   defunc_2_reduce_res_232950;
            double y_232998 = defunc_2_reduce_res_232948 *
                   defunc_2_reduce_res_232951;
            double c2_232999 = x_232997 - y_232998;
            double x_233000 = defunc_2_reduce_res_232948 * a12_232988;
            double y_233001 = defunc_2_reduce_res_232949 * b12_232991;
            double x_233002 = x_233000 + y_233001;
            double y_233003 = defunc_2_reduce_res_232950 * c12_232994;
            double y_233004 = x_233002 + y_233003;
            double det_233005 = 1.0 / y_233004;
            double a12_233006 = a12_232988 * det_233005;
            double b12_233007 = b12_232991 * det_233005;
            double c12_233008 = c12_232994 * det_233005;
            double b2_233009 = b2_232996 * det_233005;
            double c2_233010 = c2_232999 * det_233005;
            double defunc_2_reduce_res_233011;
            double defunc_2_reduce_res_233012;
            double redout_233014;
            double redout_233015;
            
            redout_233014 = 0.0;
            redout_233015 = 0.0;
            for (int64_t i_233013 = 0; i_233013 < q_t_203576; i_233013++) {
                bool cond_233016 = sle64(x_206161, i_233013);
                int64_t defunc_0_f_res_233017;
                
                if (cond_233016) {
                    defunc_0_f_res_233017 = (int64_t) 0;
                } else {
                    int64_t i_233018 = add64(x_232943, i_233013);
                    int64_t defunc_0_add_arg_233019;
                    
                    defunc_0_add_arg_233019 =
                        ((int64_t *) mem_217458.mem)[gtid_214400 * n_203572 +
                                                     i_233018];
                    
                    int64_t defunc_1_add_res_233020 = add64((int64_t) 1,
                                                            defunc_0_add_arg_233019);
                    
                    defunc_0_f_res_233017 = defunc_1_add_res_233020;
                }
                
                double defunc_0_f_res_233021;
                
                if (cond_233016) {
                    defunc_0_f_res_233021 = 0.0;
                } else {
                    int64_t i_233022 = add64(x_232943, i_233013);
                    double defunc_0_add_arg_233023;
                    
                    defunc_0_add_arg_233023 = ((double *) mem_220137)[i_233022];
                    defunc_0_f_res_233021 = defunc_0_add_arg_233023;
                }
                
                int64_t binop_p_233024 = sub64(defunc_0_f_res_233017,
                                               defunc_0_g_res_232947);
                double defunc_0_f_res_233025 = sitofp_i64_f64(binop_p_233024);
                double abs_res_233026 = fabs(defunc_0_f_res_233025);
                double tmp1_233027 = abs_res_233026 / x_232944;
                double x_233028 = tmp1_233027 * tmp1_233027;
                double y_233029 = tmp1_233027 * x_233028;
                double tmp2_233030 = 1.0 - y_233029;
                double x_233031 = tmp2_233030 * tmp2_233030;
                double tmp3_233032 = tmp2_233030 * x_233031;
                double tmp4_233033 = defunc_0_f_res_233021 * tmp3_233032;
                double defunc_1_f_res_233034 = defunc_0_f_res_233025 *
                       tmp4_233033;
                double defunc_1_f_res_233035 = defunc_0_f_res_233025 *
                       defunc_1_f_res_233034;
                double defunc_0_f_res_233036;
                
                if (cond_233016) {
                    defunc_0_f_res_233036 = 0.0;
                } else {
                    int64_t i_233037 = add64(x_232943, i_233013);
                    double defunc_0_add_arg_233038;
                    
                    defunc_0_add_arg_233038 = ((double *) mem_220140)[i_233037];
                    defunc_0_f_res_233036 = defunc_0_add_arg_233038;
                }
                
                double x_233039 = a12_233006 * tmp4_233033;
                double y_233040 = b12_233007 * defunc_1_f_res_233034;
                double x_233041 = x_233039 + y_233040;
                double y_233042 = c12_233008 * defunc_1_f_res_233035;
                double x_233043 = x_233041 + y_233042;
                double defunc_9_fit_fun_res_233044 = defunc_0_f_res_233036 *
                       x_233043;
                double x_233045 = b12_233007 * tmp4_233033;
                double y_233046 = b2_233009 * defunc_1_f_res_233034;
                double x_233047 = x_233045 + y_233046;
                double y_233048 = c2_233010 * defunc_1_f_res_233035;
                double x_233049 = x_233047 + y_233048;
                double defunc_9_slope_fun_res_233050 = defunc_0_f_res_233036 *
                       x_233049;
                double defunc_1_op_res_233051 = defunc_9_fit_fun_res_233044 +
                       redout_233014;
                double defunc_1_op_res_233052 = defunc_9_slope_fun_res_233050 +
                       redout_233015;
                double redout_tmp_233067 = defunc_1_op_res_233051;
                double redout_tmp_233068 = defunc_1_op_res_233052;
                
                redout_233014 = redout_tmp_233067;
                redout_233015 = redout_tmp_233068;
            }
            defunc_2_reduce_res_233011 = redout_233014;
            defunc_2_reduce_res_233012 = redout_233015;
            ((double *) mem_220167)[i_232940] = defunc_2_reduce_res_233011;
            ((double *) mem_220170)[i_232940] = defunc_2_reduce_res_233012;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220198.mem + gtid_214400 * t_n_m_203740 * (int64_t) 8,
                    mem_220167 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220202.mem + gtid_214400 * t_n_m_203740 * (int64_t) 8,
                    mem_220170 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220122);
    free(mem_220137);
    free(mem_220140);
    free(mem_220167);
    free(mem_220170);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236550_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236550_end -
                 futhark_mc_segmap_parloop_236550_start;
        
        ctx->futhark_mc_segmap_parloop_236550_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236550_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236550_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236548(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214399 = tid;
    int num_tasks_232915 = info.nsubtasks;
    struct futhark_mc_task_236547 *futhark_mc_task_236547 =
                                  (struct futhark_mc_task_236547 *) args;
    struct futhark_context *ctx = futhark_mc_task_236547->ctx;
    uint64_t futhark_mc_segmap_task_236548_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236548_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236547->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236547->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236547->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236547->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236547->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236547->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236547->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236547->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236547->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236547->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236547->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236547->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236547->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236547->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236547->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236547->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236547->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236547->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220198 = {.desc ="mem_220198", .mem =
                                  futhark_mc_task_236547->free_mem_220198,
                                  .size =0, .references =NULL};
    struct memblock mem_220202 = {.desc ="mem_220202", .mem =
                                  futhark_mc_task_236547->free_mem_220202,
                                  .size =0, .references =NULL};
    int64_t iter_232916;
    struct futhark_mc_segmap_parloop_struct_236549
    futhark_mc_segmap_parloop_struct_236549;
    
    futhark_mc_segmap_parloop_struct_236549.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236549.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236549.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236549.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236549.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236549.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236549.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236549.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236549.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236549.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236549.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236549.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236549.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236549.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236549.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236549.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236549.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236549.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236549.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236549.free_mem_220198 = mem_220198.mem;
    futhark_mc_segmap_parloop_struct_236549.free_mem_220202 = mem_220202.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236550_task;
    
    futhark_mc_segmap_parloop_236550_task.name =
        "futhark_mc_segmap_parloop_236550";
    futhark_mc_segmap_parloop_236550_task.fn = futhark_mc_segmap_parloop_236550;
    futhark_mc_segmap_parloop_236550_task.args =
        &futhark_mc_segmap_parloop_struct_236549;
    futhark_mc_segmap_parloop_236550_task.iterations = iterations;
    futhark_mc_segmap_parloop_236550_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236550_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236550_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236550_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236550_task);
    
    if (futhark_mc_segmap_parloop_236550_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236550_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236550_total_end -
                 futhark_mc_segmap_parloop_236550_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236550_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236550_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236550_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236548_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236548_end -
                 futhark_mc_segmap_task_236548_start;
        
        ctx->futhark_mc_segmap_task_236548_runs[tid]++;
        ctx->futhark_mc_segmap_task_236548_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236548_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236557 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220198;
    unsigned char *free_mem_220202;
};
struct futhark_mc_task_236564 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214540;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220107;
};
struct futhark_mc_segmap_parloop_struct_236566 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214540;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220107;
};
static int futhark_mc_segmap_parloop_236567(void *args, int64_t start,
                                            int64_t end, int flat_tid_233070,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236566
    *futhark_mc_segmap_parloop_struct_236566 =
    (struct futhark_mc_segmap_parloop_struct_236566 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236566->ctx;
    uint64_t futhark_mc_segmap_parloop_236567_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236567_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236566->free_n_203572;
    int64_t gtid_214540 =
            futhark_mc_segmap_parloop_struct_236566->free_gtid_214540;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236566->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236566->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220107 = {.desc ="mem_220107", .mem =
                                  futhark_mc_segmap_parloop_struct_236566->free_mem_220107,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233325 = start;
    
    for (; iter_233325 < end; iter_233325++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233326 = n_203572;
        int64_t gtid_233071 = iter_233325;
        int64_t remnant_233327 = iter_233325 - gtid_233071;
        double x_233072;
        
        x_233072 = ((double *) mem_217415.mem)[gtid_214540 * n_203572 +
                                               gtid_233071];
        
        double x_233073;
        
        x_233073 = ((double *) mem_219926.mem)[gtid_214540 * n_203572 +
                                               gtid_233071];
        
        double defunc_1_f_res_233074 = x_233072 - x_233073;
        
        ((double *) mem_220107.mem)[gtid_233071] = defunc_1_f_res_233074;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236567_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236567_end -
                 futhark_mc_segmap_parloop_236567_start;
        
        ctx->futhark_mc_segmap_parloop_236567_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236567_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236567_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236565(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233070 = tid;
    int num_tasks_233324 = 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_segmap_task_236565_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236565_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236564->free_n_203572;
    int64_t gtid_214540 = futhark_mc_task_236564->free_gtid_214540;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236564->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236564->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220107 = {.desc ="mem_220107", .mem =
                                  futhark_mc_task_236564->free_mem_220107,
                                  .size =0, .references =NULL};
    int64_t iter_233325;
    struct futhark_mc_segmap_parloop_struct_236566
    futhark_mc_segmap_parloop_struct_236566;
    
    futhark_mc_segmap_parloop_struct_236566.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236566.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236566.free_gtid_214540 = gtid_214540;
    futhark_mc_segmap_parloop_struct_236566.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236566.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236566.free_mem_220107 = mem_220107.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236567_task;
    
    futhark_mc_segmap_parloop_236567_task.name =
        "futhark_mc_segmap_parloop_236567";
    futhark_mc_segmap_parloop_236567_task.fn = futhark_mc_segmap_parloop_236567;
    futhark_mc_segmap_parloop_236567_task.args =
        &futhark_mc_segmap_parloop_struct_236566;
    futhark_mc_segmap_parloop_236567_task.iterations = iterations;
    futhark_mc_segmap_parloop_236567_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236567_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236567_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236567_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236567_task);
    
    if (futhark_mc_segmap_parloop_236567_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236567_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236567_total_end -
                 futhark_mc_segmap_parloop_236567_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236567_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236567_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236567_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236565_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236565_end -
                 futhark_mc_segmap_task_236565_start;
        
        ctx->futhark_mc_segmap_task_236565_runs[tid]++;
        ctx->futhark_mc_segmap_task_236565_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236565_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236568 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214540;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220107;
    unsigned char *free_mem_220110;
    unsigned char *free_mem_220113;
};
struct futhark_mc_segmap_parloop_struct_236570 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214540;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220107;
    unsigned char *free_mem_220110;
    unsigned char *free_mem_220113;
};
static int futhark_mc_segmap_parloop_236571(void *args, int64_t start,
                                            int64_t end, int flat_tid_233075,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236570
    *futhark_mc_segmap_parloop_struct_236570 =
    (struct futhark_mc_segmap_parloop_struct_236570 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236570->ctx;
    uint64_t futhark_mc_segmap_parloop_236571_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236571_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236570->free_n_203572;
    int64_t gtid_214540 =
            futhark_mc_segmap_parloop_struct_236570->free_gtid_214540;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236570->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236570->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236570->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236570->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236570->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220107 = {.desc ="mem_220107", .mem =
                                  futhark_mc_segmap_parloop_struct_236570->free_mem_220107,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_segmap_parloop_struct_236570->free_mem_220110,
                                  .size =0, .references =NULL};
    struct memblock mem_220113 = {.desc ="mem_220113", .mem =
                                  futhark_mc_segmap_parloop_struct_236570->free_mem_220113,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233329 = start;
    
    for (; iter_233329 < end; iter_233329++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233338 = n_203572;
        int64_t gtid_233076 = iter_233329;
        int64_t remnant_233339 = iter_233329 - gtid_233076;
        int64_t x_233077;
        
        x_233077 = ((int64_t *) mem_217458.mem)[gtid_214540 * n_203572 +
                                                gtid_233076];
        
        bool cond_233078 = sle64((int64_t) 0, x_233077);
        double defunc_0_f_res_233079;
        
        if (cond_233078) {
            bool y_233330 = slt64(x_233077, n_203572);
            bool bounds_check_233331 = cond_233078 && y_233330;
            bool index_certs_233332;
            
            if (!bounds_check_233331) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233077,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_233333;
            
            defunc_0_f_res_t_res_233333 = ((double *) mem_220107.mem)[x_233077];
            defunc_0_f_res_233079 = defunc_0_f_res_t_res_233333;
        } else {
            defunc_0_f_res_233079 = 0.0;
        }
        
        double defunc_0_f_res_233084;
        
        if (cond_233078) {
            bool y_233334 = slt64(x_233077, n_203572);
            bool bounds_check_233335 = cond_233078 && y_233334;
            bool index_certs_233336;
            
            if (!bounds_check_233335) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233077,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_233337;
            
            defunc_0_f_res_t_res_233337 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_214540 *
                                                   ctx_param_ext_217985 +
                                                   x_233077 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_233084 = defunc_0_f_res_t_res_233337;
        } else {
            defunc_0_f_res_233084 = 0.0;
        }
        ((double *) mem_220110.mem)[gtid_233076] = defunc_0_f_res_233084;
        ((double *) mem_220113.mem)[gtid_233076] = defunc_0_f_res_233079;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236571_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236571_end -
                 futhark_mc_segmap_parloop_236571_start;
        
        ctx->futhark_mc_segmap_parloop_236571_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236571_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236571_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236569(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233075 = tid;
    int num_tasks_233328 = info.nsubtasks;
    struct futhark_mc_task_236568 *futhark_mc_task_236568 =
                                  (struct futhark_mc_task_236568 *) args;
    struct futhark_context *ctx = futhark_mc_task_236568->ctx;
    uint64_t futhark_mc_segmap_task_236569_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236569_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236568->free_n_203572;
    int64_t gtid_214540 = futhark_mc_task_236568->free_gtid_214540;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236568->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236568->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236568->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236568->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236568->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220107 = {.desc ="mem_220107", .mem =
                                  futhark_mc_task_236568->free_mem_220107,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_task_236568->free_mem_220110,
                                  .size =0, .references =NULL};
    struct memblock mem_220113 = {.desc ="mem_220113", .mem =
                                  futhark_mc_task_236568->free_mem_220113,
                                  .size =0, .references =NULL};
    int64_t iter_233329;
    struct futhark_mc_segmap_parloop_struct_236570
    futhark_mc_segmap_parloop_struct_236570;
    
    futhark_mc_segmap_parloop_struct_236570.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236570.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236570.free_gtid_214540 = gtid_214540;
    futhark_mc_segmap_parloop_struct_236570.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236570.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236570.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236570.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236570.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236570.free_mem_220107 = mem_220107.mem;
    futhark_mc_segmap_parloop_struct_236570.free_mem_220110 = mem_220110.mem;
    futhark_mc_segmap_parloop_struct_236570.free_mem_220113 = mem_220113.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236571_task;
    
    futhark_mc_segmap_parloop_236571_task.name =
        "futhark_mc_segmap_parloop_236571";
    futhark_mc_segmap_parloop_236571_task.fn = futhark_mc_segmap_parloop_236571;
    futhark_mc_segmap_parloop_236571_task.args =
        &futhark_mc_segmap_parloop_struct_236570;
    futhark_mc_segmap_parloop_236571_task.iterations = iterations;
    futhark_mc_segmap_parloop_236571_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236571_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236571_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236571_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236571_task);
    
    if (futhark_mc_segmap_parloop_236571_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236571_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236571_total_end -
                 futhark_mc_segmap_parloop_236571_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236571_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236571_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236571_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236569_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236569_end -
                 futhark_mc_segmap_task_236569_start;
        
        ctx->futhark_mc_segmap_task_236569_runs[tid]++;
        ctx->futhark_mc_segmap_task_236569_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236569_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236572 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_214540;
    int64_t free_x_214545;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220110;
    unsigned char *free_mem_220113;
    unsigned char *free_mem_220116;
    unsigned char *free_mem_220119;
};
struct futhark_mc_segmap_parloop_struct_236574 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_214540;
    int64_t free_x_214545;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220110;
    unsigned char *free_mem_220113;
    unsigned char *free_mem_220116;
    unsigned char *free_mem_220119;
};
static int futhark_mc_segmap_parloop_236575(void *args, int64_t start,
                                            int64_t end, int flat_tid_233210,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236574
    *futhark_mc_segmap_parloop_struct_236574 =
    (struct futhark_mc_segmap_parloop_struct_236574 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236574->ctx;
    uint64_t futhark_mc_segmap_parloop_236575_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236575_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236574->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236574->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236574->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236574->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236574->free_i_203760;
    int64_t gtid_214540 =
            futhark_mc_segmap_parloop_struct_236574->free_gtid_214540;
    int64_t x_214545 = futhark_mc_segmap_parloop_struct_236574->free_x_214545;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236574->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236574->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236574->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_segmap_parloop_struct_236574->free_mem_220110,
                                  .size =0, .references =NULL};
    struct memblock mem_220113 = {.desc ="mem_220113", .mem =
                                  futhark_mc_segmap_parloop_struct_236574->free_mem_220113,
                                  .size =0, .references =NULL};
    struct memblock mem_220116 = {.desc ="mem_220116", .mem =
                                  futhark_mc_segmap_parloop_struct_236574->free_mem_220116,
                                  .size =0, .references =NULL};
    struct memblock mem_220119 = {.desc ="mem_220119", .mem =
                                  futhark_mc_segmap_parloop_struct_236574->free_mem_220119,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233341 = start;
    
    for (; iter_233341 < end; iter_233341++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233415 = t_n_m_203740;
        int64_t gtid_233211 = iter_233341;
        int64_t remnant_233416 = iter_233341 - gtid_233211;
        int64_t x_233212;
        
        x_233212 = ((int64_t *) mem_217953.mem)[gtid_214540 * t_n_m_203740 +
                                                gtid_233211];
        
        double x_233213;
        
        x_233213 = ((double *) mem_217957.mem)[gtid_214540 * t_n_m_203740 +
                                               gtid_233211];
        
        int64_t min_arg_233214 = mul64(jump_t_203582, gtid_233211);
        int64_t min_res_233215 = smin64(i_203760, min_arg_233214);
        int64_t defunc_0_g_res_233216 = add64((int64_t) 1, min_res_233215);
        double defunc_2_reduce_res_233217;
        double defunc_2_reduce_res_233218;
        double defunc_2_reduce_res_233219;
        double defunc_2_reduce_res_233220;
        double defunc_2_reduce_res_233221;
        double redout_233343;
        double redout_233344;
        double redout_233345;
        double redout_233346;
        double redout_233347;
        
        redout_233343 = 0.0;
        redout_233344 = 0.0;
        redout_233345 = 0.0;
        redout_233346 = 0.0;
        redout_233347 = 0.0;
        for (int64_t i_233342 = 0; i_233342 < q_t_203576; i_233342++) {
            bool cond_233348 = sle64(x_214545, i_233342);
            int64_t defunc_0_f_res_233349;
            
            if (cond_233348) {
                defunc_0_f_res_233349 = (int64_t) 0;
            } else {
                int64_t i_233350 = add64(x_233212, i_233342);
                int64_t defunc_0_add_arg_233351;
                
                defunc_0_add_arg_233351 =
                    ((int64_t *) mem_217458.mem)[gtid_214540 * n_203572 +
                                                 i_233350];
                
                int64_t defunc_1_add_res_233352 = add64((int64_t) 1,
                                                        defunc_0_add_arg_233351);
                
                defunc_0_f_res_233349 = defunc_1_add_res_233352;
            }
            
            double defunc_0_f_res_233353;
            
            if (cond_233348) {
                defunc_0_f_res_233353 = 0.0;
            } else {
                int64_t i_233354 = add64(x_233212, i_233342);
                double defunc_0_add_arg_233355;
                
                defunc_0_add_arg_233355 = ((double *) mem_220110.mem)[i_233354];
                defunc_0_f_res_233353 = defunc_0_add_arg_233355;
            }
            
            int64_t binop_p_233356 = sub64(defunc_0_f_res_233349,
                                           defunc_0_g_res_233216);
            double defunc_0_f_res_233357 = sitofp_i64_f64(binop_p_233356);
            double abs_res_233358 = fabs(defunc_0_f_res_233357);
            double tmp1_233359 = abs_res_233358 / x_233213;
            double x_233360 = tmp1_233359 * tmp1_233359;
            double y_233361 = tmp1_233359 * x_233360;
            double tmp2_233362 = 1.0 - y_233361;
            double x_233363 = tmp2_233362 * tmp2_233362;
            double tmp3_233364 = tmp2_233362 * x_233363;
            double w_j_233365 = defunc_0_f_res_233353 * tmp3_233364;
            double xw_j_233366 = defunc_0_f_res_233357 * w_j_233365;
            double x2w_j_233367 = defunc_0_f_res_233357 * xw_j_233366;
            double x3w_j_233368 = defunc_0_f_res_233357 * x2w_j_233367;
            double x4w_j_233369 = defunc_0_f_res_233357 * x3w_j_233368;
            double defunc_1_op_res_233370 = w_j_233365 + redout_233343;
            double defunc_1_op_res_233371 = xw_j_233366 + redout_233344;
            double defunc_1_op_res_233372 = x2w_j_233367 + redout_233345;
            double defunc_1_op_res_233373 = x3w_j_233368 + redout_233346;
            double defunc_1_op_res_233374 = x4w_j_233369 + redout_233347;
            double redout_tmp_233417 = defunc_1_op_res_233370;
            double redout_tmp_233418 = defunc_1_op_res_233371;
            double redout_tmp_233419 = defunc_1_op_res_233372;
            double redout_tmp_233420 = defunc_1_op_res_233373;
            double redout_tmp_233421 = defunc_1_op_res_233374;
            
            redout_233343 = redout_tmp_233417;
            redout_233344 = redout_tmp_233418;
            redout_233345 = redout_tmp_233419;
            redout_233346 = redout_tmp_233420;
            redout_233347 = redout_tmp_233421;
        }
        defunc_2_reduce_res_233217 = redout_233343;
        defunc_2_reduce_res_233218 = redout_233344;
        defunc_2_reduce_res_233219 = redout_233345;
        defunc_2_reduce_res_233220 = redout_233346;
        defunc_2_reduce_res_233221 = redout_233347;
        
        double x_233255 = defunc_2_reduce_res_233219 *
               defunc_2_reduce_res_233221;
        double y_233256 = defunc_2_reduce_res_233220 *
               defunc_2_reduce_res_233220;
        double a12_233257 = x_233255 - y_233256;
        double x_233258 = defunc_2_reduce_res_233219 *
               defunc_2_reduce_res_233220;
        double y_233259 = defunc_2_reduce_res_233218 *
               defunc_2_reduce_res_233221;
        double b12_233260 = x_233258 - y_233259;
        double x_233261 = defunc_2_reduce_res_233218 *
               defunc_2_reduce_res_233220;
        double y_233262 = defunc_2_reduce_res_233219 *
               defunc_2_reduce_res_233219;
        double c12_233263 = x_233261 - y_233262;
        double x_233264 = defunc_2_reduce_res_233217 *
               defunc_2_reduce_res_233221;
        double b2_233265 = x_233264 - y_233262;
        double x_233266 = defunc_2_reduce_res_233218 *
               defunc_2_reduce_res_233219;
        double y_233267 = defunc_2_reduce_res_233217 *
               defunc_2_reduce_res_233220;
        double c2_233268 = x_233266 - y_233267;
        double x_233269 = defunc_2_reduce_res_233217 * a12_233257;
        double y_233270 = defunc_2_reduce_res_233218 * b12_233260;
        double x_233271 = x_233269 + y_233270;
        double y_233272 = defunc_2_reduce_res_233219 * c12_233263;
        double y_233273 = x_233271 + y_233272;
        double det_233274 = 1.0 / y_233273;
        double a12_233275 = a12_233257 * det_233274;
        double b12_233276 = b12_233260 * det_233274;
        double c12_233277 = c12_233263 * det_233274;
        double b2_233278 = b2_233265 * det_233274;
        double c2_233279 = c2_233268 * det_233274;
        double defunc_2_reduce_res_233280;
        double defunc_2_reduce_res_233281;
        double redout_233376;
        double redout_233377;
        
        redout_233376 = 0.0;
        redout_233377 = 0.0;
        for (int64_t i_233375 = 0; i_233375 < q_t_203576; i_233375++) {
            bool cond_233378 = sle64(x_214545, i_233375);
            int64_t defunc_0_f_res_233379;
            
            if (cond_233378) {
                defunc_0_f_res_233379 = (int64_t) 0;
            } else {
                int64_t i_233380 = add64(x_233212, i_233375);
                int64_t defunc_0_add_arg_233381;
                
                defunc_0_add_arg_233381 =
                    ((int64_t *) mem_217458.mem)[gtid_214540 * n_203572 +
                                                 i_233380];
                
                int64_t defunc_1_add_res_233382 = add64((int64_t) 1,
                                                        defunc_0_add_arg_233381);
                
                defunc_0_f_res_233379 = defunc_1_add_res_233382;
            }
            
            double defunc_0_f_res_233383;
            
            if (cond_233378) {
                defunc_0_f_res_233383 = 0.0;
            } else {
                int64_t i_233384 = add64(x_233212, i_233375);
                double defunc_0_add_arg_233385;
                
                defunc_0_add_arg_233385 = ((double *) mem_220110.mem)[i_233384];
                defunc_0_f_res_233383 = defunc_0_add_arg_233385;
            }
            
            int64_t binop_p_233386 = sub64(defunc_0_f_res_233379,
                                           defunc_0_g_res_233216);
            double defunc_0_f_res_233387 = sitofp_i64_f64(binop_p_233386);
            double abs_res_233388 = fabs(defunc_0_f_res_233387);
            double tmp1_233389 = abs_res_233388 / x_233213;
            double x_233390 = tmp1_233389 * tmp1_233389;
            double y_233391 = tmp1_233389 * x_233390;
            double tmp2_233392 = 1.0 - y_233391;
            double x_233393 = tmp2_233392 * tmp2_233392;
            double tmp3_233394 = tmp2_233392 * x_233393;
            double tmp4_233395 = defunc_0_f_res_233383 * tmp3_233394;
            double defunc_1_f_res_233396 = defunc_0_f_res_233387 * tmp4_233395;
            double defunc_1_f_res_233397 = defunc_0_f_res_233387 *
                   defunc_1_f_res_233396;
            double defunc_0_f_res_233398;
            
            if (cond_233378) {
                defunc_0_f_res_233398 = 0.0;
            } else {
                int64_t i_233399 = add64(x_233212, i_233375);
                double defunc_0_add_arg_233400;
                
                defunc_0_add_arg_233400 = ((double *) mem_220113.mem)[i_233399];
                defunc_0_f_res_233398 = defunc_0_add_arg_233400;
            }
            
            double x_233401 = a12_233275 * tmp4_233395;
            double y_233402 = b12_233276 * defunc_1_f_res_233396;
            double x_233403 = x_233401 + y_233402;
            double y_233404 = c12_233277 * defunc_1_f_res_233397;
            double x_233405 = x_233403 + y_233404;
            double defunc_9_fit_fun_res_233406 = defunc_0_f_res_233398 *
                   x_233405;
            double x_233407 = b12_233276 * tmp4_233395;
            double y_233408 = b2_233278 * defunc_1_f_res_233396;
            double x_233409 = x_233407 + y_233408;
            double y_233410 = c2_233279 * defunc_1_f_res_233397;
            double x_233411 = x_233409 + y_233410;
            double defunc_9_slope_fun_res_233412 = defunc_0_f_res_233398 *
                   x_233411;
            double defunc_1_op_res_233413 = defunc_9_fit_fun_res_233406 +
                   redout_233376;
            double defunc_1_op_res_233414 = defunc_9_slope_fun_res_233412 +
                   redout_233377;
            double redout_tmp_233422 = defunc_1_op_res_233413;
            double redout_tmp_233423 = defunc_1_op_res_233414;
            
            redout_233376 = redout_tmp_233422;
            redout_233377 = redout_tmp_233423;
        }
        defunc_2_reduce_res_233280 = redout_233376;
        defunc_2_reduce_res_233281 = redout_233377;
        ((double *) mem_220116.mem)[gtid_233211] = defunc_2_reduce_res_233280;
        ((double *) mem_220119.mem)[gtid_233211] = defunc_2_reduce_res_233281;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236575_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236575_end -
                 futhark_mc_segmap_parloop_236575_start;
        
        ctx->futhark_mc_segmap_parloop_236575_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236575_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236575_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236573(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233210 = tid;
    int num_tasks_233340 = info.nsubtasks;
    struct futhark_mc_task_236572 *futhark_mc_task_236572 =
                                  (struct futhark_mc_task_236572 *) args;
    struct futhark_context *ctx = futhark_mc_task_236572->ctx;
    uint64_t futhark_mc_segmap_task_236573_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236573_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236572->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236572->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236572->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236572->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236572->free_i_203760;
    int64_t gtid_214540 = futhark_mc_task_236572->free_gtid_214540;
    int64_t x_214545 = futhark_mc_task_236572->free_x_214545;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236572->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236572->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236572->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_task_236572->free_mem_220110,
                                  .size =0, .references =NULL};
    struct memblock mem_220113 = {.desc ="mem_220113", .mem =
                                  futhark_mc_task_236572->free_mem_220113,
                                  .size =0, .references =NULL};
    struct memblock mem_220116 = {.desc ="mem_220116", .mem =
                                  futhark_mc_task_236572->free_mem_220116,
                                  .size =0, .references =NULL};
    struct memblock mem_220119 = {.desc ="mem_220119", .mem =
                                  futhark_mc_task_236572->free_mem_220119,
                                  .size =0, .references =NULL};
    int64_t iter_233341;
    struct futhark_mc_segmap_parloop_struct_236574
    futhark_mc_segmap_parloop_struct_236574;
    
    futhark_mc_segmap_parloop_struct_236574.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236574.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236574.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236574.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236574.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236574.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236574.free_gtid_214540 = gtid_214540;
    futhark_mc_segmap_parloop_struct_236574.free_x_214545 = x_214545;
    futhark_mc_segmap_parloop_struct_236574.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236574.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236574.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236574.free_mem_220110 = mem_220110.mem;
    futhark_mc_segmap_parloop_struct_236574.free_mem_220113 = mem_220113.mem;
    futhark_mc_segmap_parloop_struct_236574.free_mem_220116 = mem_220116.mem;
    futhark_mc_segmap_parloop_struct_236574.free_mem_220119 = mem_220119.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236575_task;
    
    futhark_mc_segmap_parloop_236575_task.name =
        "futhark_mc_segmap_parloop_236575";
    futhark_mc_segmap_parloop_236575_task.fn = futhark_mc_segmap_parloop_236575;
    futhark_mc_segmap_parloop_236575_task.args =
        &futhark_mc_segmap_parloop_struct_236574;
    futhark_mc_segmap_parloop_236575_task.iterations = iterations;
    futhark_mc_segmap_parloop_236575_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236575_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236575_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236575_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236575_task);
    
    if (futhark_mc_segmap_parloop_236575_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236575_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236575_total_end -
                 futhark_mc_segmap_parloop_236575_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236575_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236575_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236575_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236573_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236573_end -
                 futhark_mc_segmap_task_236573_start;
        
        ctx->futhark_mc_segmap_task_236573_runs[tid]++;
        ctx->futhark_mc_segmap_task_236573_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236573_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236577 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_214540;
    int64_t free_x_214545;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220110;
    unsigned char *free_mem_220113;
    unsigned char *free_mem_220116;
    unsigned char *free_mem_220119;
};
struct futhark_mc_task_236579 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214540;
    int64_t free_x_214545;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220110;
    int64_t free_x_233091;
    double free_x_233092;
    int64_t free_defunc_0_g_res_233095;
    double *retval_defunc_2_reduce_res_233096;
    double *retval_defunc_2_reduce_res_233097;
    double *retval_defunc_2_reduce_res_233098;
    double *retval_defunc_2_reduce_res_233099;
    double *retval_defunc_2_reduce_res_233100;
};
struct futhark_mc_segred_stage_1_parloop_struct_236586 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214540;
    int64_t free_x_214545;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220110;
    int64_t free_x_233091;
    double free_x_233092;
    int64_t free_defunc_0_g_res_233095;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233510;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233512;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233514;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233516;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233518;
};
static int futhark_mc_segred_stage_1_parloop_236587(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_233425,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236586
    *futhark_mc_segred_stage_1_parloop_struct_236586 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236586 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236586->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236587_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236587_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236586->free_n_203572;
    int64_t gtid_214540 =
            futhark_mc_segred_stage_1_parloop_struct_236586->free_gtid_214540;
    int64_t x_214545 =
            futhark_mc_segred_stage_1_parloop_struct_236586->free_x_214545;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236586->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236586->free_mem_220110,
                                  .size =0, .references =NULL};
    int64_t x_233091 =
            futhark_mc_segred_stage_1_parloop_struct_236586->free_x_233091;
    double x_233092 =
           futhark_mc_segred_stage_1_parloop_struct_236586->free_x_233092;
    int64_t defunc_0_g_res_233095 =
            futhark_mc_segred_stage_1_parloop_struct_236586->free_defunc_0_g_res_233095;
    struct memblock reduce_stage_1_tid_res_arr_mem_233510 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233510",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236586->free_reduce_stage_1_tid_res_arr_mem_233510,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233512 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233512",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236586->free_reduce_stage_1_tid_res_arr_mem_233512,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233514 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233514",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236586->free_reduce_stage_1_tid_res_arr_mem_233514,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233516 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233516",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236586->free_reduce_stage_1_tid_res_arr_mem_233516,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233518 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233518",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236586->free_reduce_stage_1_tid_res_arr_mem_233518,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233520 = start;
    double x_233427;
    double x_233428;
    double x_233430;
    double x_233431;
    double x_233433;
    double x_233434;
    double x_233436;
    double x_233437;
    double x_233439;
    double x_233440;
    double local_acc_233521 = 0.0;
    double local_acc_233522 = 0.0;
    double local_acc_233523 = 0.0;
    double local_acc_233524 = 0.0;
    double local_acc_233525 = 0.0;
    
    for (; iter_233520 < end; iter_233520++) {
        int64_t gtid_233426 = iter_233520;
        bool cond_233442 = sle64(x_214545, gtid_233426);
        int64_t defunc_0_f_res_233443;
        
        if (cond_233442) {
            defunc_0_f_res_233443 = (int64_t) 0;
        } else {
            int64_t i_233444 = add64(x_233091, gtid_233426);
            int64_t defunc_0_add_arg_233445;
            
            defunc_0_add_arg_233445 = ((int64_t *) mem_217458.mem)[gtid_214540 *
                                                                   n_203572 +
                                                                   i_233444];
            
            int64_t defunc_1_add_res_233446 = add64((int64_t) 1,
                                                    defunc_0_add_arg_233445);
            
            defunc_0_f_res_233443 = defunc_1_add_res_233446;
        }
        
        double defunc_0_f_res_233447;
        
        if (cond_233442) {
            defunc_0_f_res_233447 = 0.0;
        } else {
            int64_t i_233448 = add64(x_233091, gtid_233426);
            double defunc_0_add_arg_233449;
            
            defunc_0_add_arg_233449 = ((double *) mem_220110.mem)[i_233448];
            defunc_0_f_res_233447 = defunc_0_add_arg_233449;
        }
        
        int64_t binop_p_233450 = sub64(defunc_0_f_res_233443,
                                       defunc_0_g_res_233095);
        double defunc_0_f_res_233451 = sitofp_i64_f64(binop_p_233450);
        double abs_res_233452 = fabs(defunc_0_f_res_233451);
        double tmp1_233453 = abs_res_233452 / x_233092;
        double x_233454 = tmp1_233453 * tmp1_233453;
        double y_233455 = tmp1_233453 * x_233454;
        double tmp2_233456 = 1.0 - y_233455;
        double x_233457 = tmp2_233456 * tmp2_233456;
        double tmp3_233458 = tmp2_233456 * x_233457;
        double w_j_233459 = defunc_0_f_res_233447 * tmp3_233458;
        double xw_j_233460 = defunc_0_f_res_233451 * w_j_233459;
        double x2w_j_233461 = defunc_0_f_res_233451 * xw_j_233460;
        double x3w_j_233462 = defunc_0_f_res_233451 * x2w_j_233461;
        double x4w_j_233463 = defunc_0_f_res_233451 * x3w_j_233462;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_233427 = local_acc_233521;
        }
        // Load next params
        {
            x_233428 = w_j_233459;
        }
        // Red body
        {
            double defunc_1_op_res_233429 = x_233427 + x_233428;
            
            local_acc_233521 = defunc_1_op_res_233429;
        }
        // Load accum params
        {
            x_233430 = local_acc_233522;
        }
        // Load next params
        {
            x_233431 = xw_j_233460;
        }
        // Red body
        {
            double defunc_1_op_res_233432 = x_233430 + x_233431;
            
            local_acc_233522 = defunc_1_op_res_233432;
        }
        // Load accum params
        {
            x_233433 = local_acc_233523;
        }
        // Load next params
        {
            x_233434 = x2w_j_233461;
        }
        // Red body
        {
            double defunc_1_op_res_233435 = x_233433 + x_233434;
            
            local_acc_233523 = defunc_1_op_res_233435;
        }
        // Load accum params
        {
            x_233436 = local_acc_233524;
        }
        // Load next params
        {
            x_233437 = x3w_j_233462;
        }
        // Red body
        {
            double defunc_1_op_res_233438 = x_233436 + x_233437;
            
            local_acc_233524 = defunc_1_op_res_233438;
        }
        // Load accum params
        {
            x_233439 = local_acc_233525;
        }
        // Load next params
        {
            x_233440 = x4w_j_233463;
        }
        // Red body
        {
            double defunc_1_op_res_233441 = x_233439 + x_233440;
            
            local_acc_233525 = defunc_1_op_res_233441;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_233510.mem)[flat_tid_233425] =
        local_acc_233521;
    ((double *) reduce_stage_1_tid_res_arr_mem_233512.mem)[flat_tid_233425] =
        local_acc_233522;
    ((double *) reduce_stage_1_tid_res_arr_mem_233514.mem)[flat_tid_233425] =
        local_acc_233523;
    ((double *) reduce_stage_1_tid_res_arr_mem_233516.mem)[flat_tid_233425] =
        local_acc_233524;
    ((double *) reduce_stage_1_tid_res_arr_mem_233518.mem)[flat_tid_233425] =
        local_acc_233525;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236587_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236587_end -
                 futhark_mc_segred_stage_1_parloop_236587_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236587_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236587_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236587_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236580(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233425 = tid;
    int num_tasks_233509 = 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_segred_task_236580_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236580_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236579->free_n_203572;
    int64_t gtid_214540 = futhark_mc_task_236579->free_gtid_214540;
    int64_t x_214545 = futhark_mc_task_236579->free_x_214545;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236579->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_task_236579->free_mem_220110,
                                  .size =0, .references =NULL};
    int64_t x_233091 = futhark_mc_task_236579->free_x_233091;
    double x_233092 = futhark_mc_task_236579->free_x_233092;
    int64_t defunc_0_g_res_233095 =
            futhark_mc_task_236579->free_defunc_0_g_res_233095;
    double defunc_2_reduce_res_233096 =
           *futhark_mc_task_236579->retval_defunc_2_reduce_res_233096;
    double defunc_2_reduce_res_233097 =
           *futhark_mc_task_236579->retval_defunc_2_reduce_res_233097;
    double defunc_2_reduce_res_233098 =
           *futhark_mc_task_236579->retval_defunc_2_reduce_res_233098;
    double defunc_2_reduce_res_233099 =
           *futhark_mc_task_236579->retval_defunc_2_reduce_res_233099;
    double defunc_2_reduce_res_233100 =
           *futhark_mc_task_236579->retval_defunc_2_reduce_res_233100;
    size_t reduce_stage_1_tid_res_arr_mem_233510_cached_sizze_236581 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233510 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233512_cached_sizze_236582 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233512 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233514_cached_sizze_236583 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233514 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233516_cached_sizze_236584 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233516 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233518_cached_sizze_236585 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233518 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_233510_cached_sizze_236581 <
        (size_t) ((int64_t) 8 * num_tasks_233509)) {
        reduce_stage_1_tid_res_arr_mem_233510 =
            realloc(reduce_stage_1_tid_res_arr_mem_233510, (int64_t) 8 *
                    num_tasks_233509);
        reduce_stage_1_tid_res_arr_mem_233510_cached_sizze_236581 =
            (int64_t) 8 * num_tasks_233509;
    }
    if (reduce_stage_1_tid_res_arr_mem_233512_cached_sizze_236582 <
        (size_t) ((int64_t) 8 * num_tasks_233509)) {
        reduce_stage_1_tid_res_arr_mem_233512 =
            realloc(reduce_stage_1_tid_res_arr_mem_233512, (int64_t) 8 *
                    num_tasks_233509);
        reduce_stage_1_tid_res_arr_mem_233512_cached_sizze_236582 =
            (int64_t) 8 * num_tasks_233509;
    }
    if (reduce_stage_1_tid_res_arr_mem_233514_cached_sizze_236583 <
        (size_t) ((int64_t) 8 * num_tasks_233509)) {
        reduce_stage_1_tid_res_arr_mem_233514 =
            realloc(reduce_stage_1_tid_res_arr_mem_233514, (int64_t) 8 *
                    num_tasks_233509);
        reduce_stage_1_tid_res_arr_mem_233514_cached_sizze_236583 =
            (int64_t) 8 * num_tasks_233509;
    }
    if (reduce_stage_1_tid_res_arr_mem_233516_cached_sizze_236584 <
        (size_t) ((int64_t) 8 * num_tasks_233509)) {
        reduce_stage_1_tid_res_arr_mem_233516 =
            realloc(reduce_stage_1_tid_res_arr_mem_233516, (int64_t) 8 *
                    num_tasks_233509);
        reduce_stage_1_tid_res_arr_mem_233516_cached_sizze_236584 =
            (int64_t) 8 * num_tasks_233509;
    }
    if (reduce_stage_1_tid_res_arr_mem_233518_cached_sizze_236585 <
        (size_t) ((int64_t) 8 * num_tasks_233509)) {
        reduce_stage_1_tid_res_arr_mem_233518 =
            realloc(reduce_stage_1_tid_res_arr_mem_233518, (int64_t) 8 *
                    num_tasks_233509);
        reduce_stage_1_tid_res_arr_mem_233518_cached_sizze_236585 =
            (int64_t) 8 * num_tasks_233509;
    }
    
    int64_t iter_233520;
    struct futhark_mc_segred_stage_1_parloop_struct_236586
    futhark_mc_segred_stage_1_parloop_struct_236586;
    
    futhark_mc_segred_stage_1_parloop_struct_236586.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_gtid_214540 =
        gtid_214540;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_x_214545 = x_214545;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_mem_217458 =
        mem_217458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_mem_220110 =
        mem_220110.mem;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_x_233091 = x_233091;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_x_233092 = x_233092;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_defunc_0_g_res_233095 =
        defunc_0_g_res_233095;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_reduce_stage_1_tid_res_arr_mem_233510 =
        reduce_stage_1_tid_res_arr_mem_233510;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_reduce_stage_1_tid_res_arr_mem_233512 =
        reduce_stage_1_tid_res_arr_mem_233512;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_reduce_stage_1_tid_res_arr_mem_233514 =
        reduce_stage_1_tid_res_arr_mem_233514;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_reduce_stage_1_tid_res_arr_mem_233516 =
        reduce_stage_1_tid_res_arr_mem_233516;
    futhark_mc_segred_stage_1_parloop_struct_236586.free_reduce_stage_1_tid_res_arr_mem_233518 =
        reduce_stage_1_tid_res_arr_mem_233518;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236587_task;
    
    futhark_mc_segred_stage_1_parloop_236587_task.name =
        "futhark_mc_segred_stage_1_parloop_236587";
    futhark_mc_segred_stage_1_parloop_236587_task.fn =
        futhark_mc_segred_stage_1_parloop_236587;
    futhark_mc_segred_stage_1_parloop_236587_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236586;
    futhark_mc_segred_stage_1_parloop_236587_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236587_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236587_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236587_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236587_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236587_task);
    
    if (futhark_mc_segred_stage_1_parloop_236587_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236587_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236587_total_end -
                 futhark_mc_segred_stage_1_parloop_236587_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236587_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236587_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236587_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_233096 = 0.0;
        defunc_2_reduce_res_233097 = 0.0;
        defunc_2_reduce_res_233098 = 0.0;
        defunc_2_reduce_res_233099 = 0.0;
        defunc_2_reduce_res_233100 = 0.0;
    }
    
    double x_233526;
    double x_233527;
    double x_233529;
    double x_233530;
    double x_233532;
    double x_233533;
    double x_233535;
    double x_233536;
    double x_233538;
    double x_233539;
    
    for (int32_t i_233541 = 0; i_233541 < num_tasks_233509; i_233541++) {
        flat_tid_233425 = i_233541;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_233526 = defunc_2_reduce_res_233096;
            }
            // load next params
            {
                x_233527 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233510)[flat_tid_233425];
            }
            // red body
            {
                double defunc_1_op_res_233528 = x_233526 + x_233527;
                
                defunc_2_reduce_res_233096 = defunc_1_op_res_233528;
            }
            // load acc params
            {
                x_233529 = defunc_2_reduce_res_233097;
            }
            // load next params
            {
                x_233530 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233512)[flat_tid_233425];
            }
            // red body
            {
                double defunc_1_op_res_233531 = x_233529 + x_233530;
                
                defunc_2_reduce_res_233097 = defunc_1_op_res_233531;
            }
            // load acc params
            {
                x_233532 = defunc_2_reduce_res_233098;
            }
            // load next params
            {
                x_233533 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233514)[flat_tid_233425];
            }
            // red body
            {
                double defunc_1_op_res_233534 = x_233532 + x_233533;
                
                defunc_2_reduce_res_233098 = defunc_1_op_res_233534;
            }
            // load acc params
            {
                x_233535 = defunc_2_reduce_res_233099;
            }
            // load next params
            {
                x_233536 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233516)[flat_tid_233425];
            }
            // red body
            {
                double defunc_1_op_res_233537 = x_233535 + x_233536;
                
                defunc_2_reduce_res_233099 = defunc_1_op_res_233537;
            }
            // load acc params
            {
                x_233538 = defunc_2_reduce_res_233100;
            }
            // load next params
            {
                x_233539 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233518)[flat_tid_233425];
            }
            // red body
            {
                double defunc_1_op_res_233540 = x_233538 + x_233539;
                
                defunc_2_reduce_res_233100 = defunc_1_op_res_233540;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_233510);
        free(reduce_stage_1_tid_res_arr_mem_233512);
        free(reduce_stage_1_tid_res_arr_mem_233514);
        free(reduce_stage_1_tid_res_arr_mem_233516);
        free(reduce_stage_1_tid_res_arr_mem_233518);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236580_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236580_end -
                 futhark_mc_segred_task_236580_start;
        
        ctx->futhark_mc_segred_task_236580_runs[tid]++;
        ctx->futhark_mc_segred_task_236580_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236580_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236579->retval_defunc_2_reduce_res_233096 =
            defunc_2_reduce_res_233096;
        *futhark_mc_task_236579->retval_defunc_2_reduce_res_233097 =
            defunc_2_reduce_res_233097;
        *futhark_mc_task_236579->retval_defunc_2_reduce_res_233098 =
            defunc_2_reduce_res_233098;
        *futhark_mc_task_236579->retval_defunc_2_reduce_res_233099 =
            defunc_2_reduce_res_233099;
        *futhark_mc_task_236579->retval_defunc_2_reduce_res_233100 =
            defunc_2_reduce_res_233100;
    }
    return err;
}
struct futhark_mc_task_236588 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214540;
    int64_t free_x_214545;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220110;
    unsigned char *free_mem_220113;
    int64_t free_x_233091;
    double free_x_233092;
    int64_t free_defunc_0_g_res_233095;
    double free_a12_233160;
    double free_b12_233161;
    double free_c12_233162;
    double free_b2_233163;
    double free_c2_233164;
    double *retval_defunc_2_reduce_res_233165;
    double *retval_defunc_2_reduce_res_233166;
};
struct futhark_mc_segred_stage_1_parloop_struct_236592 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214540;
    int64_t free_x_214545;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220110;
    unsigned char *free_mem_220113;
    int64_t free_x_233091;
    double free_x_233092;
    int64_t free_defunc_0_g_res_233095;
    double free_a12_233160;
    double free_b12_233161;
    double free_c12_233162;
    double free_b2_233163;
    double free_c2_233164;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233543;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233545;
};
static int futhark_mc_segred_stage_1_parloop_236593(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_233464,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236592
    *futhark_mc_segred_stage_1_parloop_struct_236592 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236592 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236592->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236593_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236593_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236592->free_n_203572;
    int64_t gtid_214540 =
            futhark_mc_segred_stage_1_parloop_struct_236592->free_gtid_214540;
    int64_t x_214545 =
            futhark_mc_segred_stage_1_parloop_struct_236592->free_x_214545;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236592->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236592->free_mem_220110,
                                  .size =0, .references =NULL};
    struct memblock mem_220113 = {.desc ="mem_220113", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236592->free_mem_220113,
                                  .size =0, .references =NULL};
    int64_t x_233091 =
            futhark_mc_segred_stage_1_parloop_struct_236592->free_x_233091;
    double x_233092 =
           futhark_mc_segred_stage_1_parloop_struct_236592->free_x_233092;
    int64_t defunc_0_g_res_233095 =
            futhark_mc_segred_stage_1_parloop_struct_236592->free_defunc_0_g_res_233095;
    double a12_233160 =
           futhark_mc_segred_stage_1_parloop_struct_236592->free_a12_233160;
    double b12_233161 =
           futhark_mc_segred_stage_1_parloop_struct_236592->free_b12_233161;
    double c12_233162 =
           futhark_mc_segred_stage_1_parloop_struct_236592->free_c12_233162;
    double b2_233163 =
           futhark_mc_segred_stage_1_parloop_struct_236592->free_b2_233163;
    double c2_233164 =
           futhark_mc_segred_stage_1_parloop_struct_236592->free_c2_233164;
    struct memblock reduce_stage_1_tid_res_arr_mem_233543 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233543",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236592->free_reduce_stage_1_tid_res_arr_mem_233543,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233545 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233545",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236592->free_reduce_stage_1_tid_res_arr_mem_233545,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233547 = start;
    double x_233466;
    double x_233467;
    double x_233469;
    double x_233470;
    double local_acc_233548 = 0.0;
    double local_acc_233549 = 0.0;
    
    for (; iter_233547 < end; iter_233547++) {
        int64_t gtid_233465 = iter_233547;
        bool cond_233472 = sle64(x_214545, gtid_233465);
        int64_t defunc_0_f_res_233473;
        
        if (cond_233472) {
            defunc_0_f_res_233473 = (int64_t) 0;
        } else {
            int64_t i_233474 = add64(x_233091, gtid_233465);
            int64_t defunc_0_add_arg_233475;
            
            defunc_0_add_arg_233475 = ((int64_t *) mem_217458.mem)[gtid_214540 *
                                                                   n_203572 +
                                                                   i_233474];
            
            int64_t defunc_1_add_res_233476 = add64((int64_t) 1,
                                                    defunc_0_add_arg_233475);
            
            defunc_0_f_res_233473 = defunc_1_add_res_233476;
        }
        
        double defunc_0_f_res_233477;
        
        if (cond_233472) {
            defunc_0_f_res_233477 = 0.0;
        } else {
            int64_t i_233478 = add64(x_233091, gtid_233465);
            double defunc_0_add_arg_233479;
            
            defunc_0_add_arg_233479 = ((double *) mem_220110.mem)[i_233478];
            defunc_0_f_res_233477 = defunc_0_add_arg_233479;
        }
        
        int64_t binop_p_233480 = sub64(defunc_0_f_res_233473,
                                       defunc_0_g_res_233095);
        double defunc_0_f_res_233481 = sitofp_i64_f64(binop_p_233480);
        double abs_res_233482 = fabs(defunc_0_f_res_233481);
        double tmp1_233483 = abs_res_233482 / x_233092;
        double x_233484 = tmp1_233483 * tmp1_233483;
        double y_233485 = tmp1_233483 * x_233484;
        double tmp2_233486 = 1.0 - y_233485;
        double x_233487 = tmp2_233486 * tmp2_233486;
        double tmp3_233488 = tmp2_233486 * x_233487;
        double tmp4_233489 = defunc_0_f_res_233477 * tmp3_233488;
        double defunc_1_f_res_233490 = defunc_0_f_res_233481 * tmp4_233489;
        double defunc_1_f_res_233491 = defunc_0_f_res_233481 *
               defunc_1_f_res_233490;
        double defunc_0_f_res_233492;
        
        if (cond_233472) {
            defunc_0_f_res_233492 = 0.0;
        } else {
            int64_t i_233493 = add64(x_233091, gtid_233465);
            double defunc_0_add_arg_233494;
            
            defunc_0_add_arg_233494 = ((double *) mem_220113.mem)[i_233493];
            defunc_0_f_res_233492 = defunc_0_add_arg_233494;
        }
        
        double x_233495 = a12_233160 * tmp4_233489;
        double y_233496 = b12_233161 * defunc_1_f_res_233490;
        double x_233497 = x_233495 + y_233496;
        double y_233498 = c12_233162 * defunc_1_f_res_233491;
        double x_233499 = x_233497 + y_233498;
        double defunc_9_fit_fun_res_233500 = defunc_0_f_res_233492 * x_233499;
        double x_233501 = b12_233161 * tmp4_233489;
        double y_233502 = b2_233163 * defunc_1_f_res_233490;
        double x_233503 = x_233501 + y_233502;
        double y_233504 = c2_233164 * defunc_1_f_res_233491;
        double x_233505 = x_233503 + y_233504;
        double defunc_9_slope_fun_res_233506 = defunc_0_f_res_233492 * x_233505;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_233466 = local_acc_233548;
        }
        // Load next params
        {
            x_233467 = defunc_9_fit_fun_res_233500;
        }
        // Red body
        {
            double defunc_1_op_res_233468 = x_233466 + x_233467;
            
            local_acc_233548 = defunc_1_op_res_233468;
        }
        // Load accum params
        {
            x_233469 = local_acc_233549;
        }
        // Load next params
        {
            x_233470 = defunc_9_slope_fun_res_233506;
        }
        // Red body
        {
            double defunc_1_op_res_233471 = x_233469 + x_233470;
            
            local_acc_233549 = defunc_1_op_res_233471;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_233543.mem)[flat_tid_233464] =
        local_acc_233548;
    ((double *) reduce_stage_1_tid_res_arr_mem_233545.mem)[flat_tid_233464] =
        local_acc_233549;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236593_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236593_end -
                 futhark_mc_segred_stage_1_parloop_236593_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236593_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236593_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236593_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236589(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233464 = tid;
    int num_tasks_233542 = info.nsubtasks;
    struct futhark_mc_task_236588 *futhark_mc_task_236588 =
                                  (struct futhark_mc_task_236588 *) args;
    struct futhark_context *ctx = futhark_mc_task_236588->ctx;
    uint64_t futhark_mc_segred_task_236589_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236589_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236588->free_n_203572;
    int64_t gtid_214540 = futhark_mc_task_236588->free_gtid_214540;
    int64_t x_214545 = futhark_mc_task_236588->free_x_214545;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236588->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_task_236588->free_mem_220110,
                                  .size =0, .references =NULL};
    struct memblock mem_220113 = {.desc ="mem_220113", .mem =
                                  futhark_mc_task_236588->free_mem_220113,
                                  .size =0, .references =NULL};
    int64_t x_233091 = futhark_mc_task_236588->free_x_233091;
    double x_233092 = futhark_mc_task_236588->free_x_233092;
    int64_t defunc_0_g_res_233095 =
            futhark_mc_task_236588->free_defunc_0_g_res_233095;
    double a12_233160 = futhark_mc_task_236588->free_a12_233160;
    double b12_233161 = futhark_mc_task_236588->free_b12_233161;
    double c12_233162 = futhark_mc_task_236588->free_c12_233162;
    double b2_233163 = futhark_mc_task_236588->free_b2_233163;
    double c2_233164 = futhark_mc_task_236588->free_c2_233164;
    double defunc_2_reduce_res_233165 =
           *futhark_mc_task_236588->retval_defunc_2_reduce_res_233165;
    double defunc_2_reduce_res_233166 =
           *futhark_mc_task_236588->retval_defunc_2_reduce_res_233166;
    size_t reduce_stage_1_tid_res_arr_mem_233543_cached_sizze_236590 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233543 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_233545_cached_sizze_236591 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233545 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_233543_cached_sizze_236590 <
        (size_t) ((int64_t) 8 * num_tasks_233542)) {
        reduce_stage_1_tid_res_arr_mem_233543 =
            realloc(reduce_stage_1_tid_res_arr_mem_233543, (int64_t) 8 *
                    num_tasks_233542);
        reduce_stage_1_tid_res_arr_mem_233543_cached_sizze_236590 =
            (int64_t) 8 * num_tasks_233542;
    }
    if (reduce_stage_1_tid_res_arr_mem_233545_cached_sizze_236591 <
        (size_t) ((int64_t) 8 * num_tasks_233542)) {
        reduce_stage_1_tid_res_arr_mem_233545 =
            realloc(reduce_stage_1_tid_res_arr_mem_233545, (int64_t) 8 *
                    num_tasks_233542);
        reduce_stage_1_tid_res_arr_mem_233545_cached_sizze_236591 =
            (int64_t) 8 * num_tasks_233542;
    }
    
    int64_t iter_233547;
    struct futhark_mc_segred_stage_1_parloop_struct_236592
    futhark_mc_segred_stage_1_parloop_struct_236592;
    
    futhark_mc_segred_stage_1_parloop_struct_236592.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_gtid_214540 =
        gtid_214540;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_x_214545 = x_214545;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_mem_217458 =
        mem_217458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_mem_220110 =
        mem_220110.mem;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_mem_220113 =
        mem_220113.mem;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_x_233091 = x_233091;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_x_233092 = x_233092;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_defunc_0_g_res_233095 =
        defunc_0_g_res_233095;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_a12_233160 =
        a12_233160;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_b12_233161 =
        b12_233161;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_c12_233162 =
        c12_233162;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_b2_233163 = b2_233163;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_c2_233164 = c2_233164;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_reduce_stage_1_tid_res_arr_mem_233543 =
        reduce_stage_1_tid_res_arr_mem_233543;
    futhark_mc_segred_stage_1_parloop_struct_236592.free_reduce_stage_1_tid_res_arr_mem_233545 =
        reduce_stage_1_tid_res_arr_mem_233545;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236593_task;
    
    futhark_mc_segred_stage_1_parloop_236593_task.name =
        "futhark_mc_segred_stage_1_parloop_236593";
    futhark_mc_segred_stage_1_parloop_236593_task.fn =
        futhark_mc_segred_stage_1_parloop_236593;
    futhark_mc_segred_stage_1_parloop_236593_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236592;
    futhark_mc_segred_stage_1_parloop_236593_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236593_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236593_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236593_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236593_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236593_task);
    
    if (futhark_mc_segred_stage_1_parloop_236593_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236593_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236593_total_end -
                 futhark_mc_segred_stage_1_parloop_236593_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236593_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236593_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236593_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_233165 = 0.0;
        defunc_2_reduce_res_233166 = 0.0;
    }
    
    double x_233550;
    double x_233551;
    double x_233553;
    double x_233554;
    
    for (int32_t i_233556 = 0; i_233556 < num_tasks_233542; i_233556++) {
        flat_tid_233464 = i_233556;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_233550 = defunc_2_reduce_res_233165;
            }
            // load next params
            {
                x_233551 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233543)[flat_tid_233464];
            }
            // red body
            {
                double defunc_1_op_res_233552 = x_233550 + x_233551;
                
                defunc_2_reduce_res_233165 = defunc_1_op_res_233552;
            }
            // load acc params
            {
                x_233553 = defunc_2_reduce_res_233166;
            }
            // load next params
            {
                x_233554 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233545)[flat_tid_233464];
            }
            // red body
            {
                double defunc_1_op_res_233555 = x_233553 + x_233554;
                
                defunc_2_reduce_res_233166 = defunc_1_op_res_233555;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_233543);
        free(reduce_stage_1_tid_res_arr_mem_233545);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236589_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236589_end -
                 futhark_mc_segred_task_236589_start;
        
        ctx->futhark_mc_segred_task_236589_runs[tid]++;
        ctx->futhark_mc_segred_task_236589_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236589_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236588->retval_defunc_2_reduce_res_233165 =
            defunc_2_reduce_res_233165;
        *futhark_mc_task_236588->retval_defunc_2_reduce_res_233166 =
            defunc_2_reduce_res_233166;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236578(void *args, int64_t start,
                                            int64_t end, int flat_tid_233089,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236577
    *futhark_mc_segmap_parloop_struct_236577 =
    (struct futhark_mc_segmap_parloop_struct_236577 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236577->ctx;
    uint64_t futhark_mc_segmap_parloop_236578_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236578_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236577->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236577->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236577->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236577->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236577->free_i_203760;
    int64_t gtid_214540 =
            futhark_mc_segmap_parloop_struct_236577->free_gtid_214540;
    int64_t x_214545 = futhark_mc_segmap_parloop_struct_236577->free_x_214545;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236577->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236577->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236577->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_segmap_parloop_struct_236577->free_mem_220110,
                                  .size =0, .references =NULL};
    struct memblock mem_220113 = {.desc ="mem_220113", .mem =
                                  futhark_mc_segmap_parloop_struct_236577->free_mem_220113,
                                  .size =0, .references =NULL};
    struct memblock mem_220116 = {.desc ="mem_220116", .mem =
                                  futhark_mc_segmap_parloop_struct_236577->free_mem_220116,
                                  .size =0, .references =NULL};
    struct memblock mem_220119 = {.desc ="mem_220119", .mem =
                                  futhark_mc_segmap_parloop_struct_236577->free_mem_220119,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233424 = start;
    
    for (; iter_233424 < end; iter_233424++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233507 = t_n_m_203740;
        int64_t gtid_233090 = iter_233424;
        int64_t remnant_233508 = iter_233424 - gtid_233090;
        int64_t x_233091;
        
        x_233091 = ((int64_t *) mem_217953.mem)[gtid_214540 * t_n_m_203740 +
                                                gtid_233090];
        
        double x_233092;
        
        x_233092 = ((double *) mem_217957.mem)[gtid_214540 * t_n_m_203740 +
                                               gtid_233090];
        
        int64_t min_arg_233093 = mul64(jump_t_203582, gtid_233090);
        int64_t min_res_233094 = smin64(i_203760, min_arg_233093);
        int64_t defunc_0_g_res_233095 = add64((int64_t) 1, min_res_233094);
        double defunc_2_reduce_res_233096;
        double defunc_2_reduce_res_233097;
        double defunc_2_reduce_res_233098;
        double defunc_2_reduce_res_233099;
        double defunc_2_reduce_res_233100;
        int64_t flat_tid_233425 = (int64_t) 0;
        int32_t num_tasks_233509;
        
        defunc_2_reduce_res_233096 = 0.0;
        defunc_2_reduce_res_233097 = 0.0;
        defunc_2_reduce_res_233098 = 0.0;
        defunc_2_reduce_res_233099 = 0.0;
        defunc_2_reduce_res_233100 = 0.0;
        
        struct futhark_mc_task_236579 futhark_mc_task_236579;
        
        futhark_mc_task_236579.ctx = ctx;
        futhark_mc_task_236579.free_n_203572 = n_203572;
        futhark_mc_task_236579.free_gtid_214540 = gtid_214540;
        futhark_mc_task_236579.free_x_214545 = x_214545;
        futhark_mc_task_236579.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236579.free_mem_220110 = mem_220110.mem;
        futhark_mc_task_236579.free_x_233091 = x_233091;
        futhark_mc_task_236579.free_x_233092 = x_233092;
        futhark_mc_task_236579.free_defunc_0_g_res_233095 =
            defunc_0_g_res_233095;
        futhark_mc_task_236579.retval_defunc_2_reduce_res_233096 =
            &defunc_2_reduce_res_233096;
        futhark_mc_task_236579.retval_defunc_2_reduce_res_233097 =
            &defunc_2_reduce_res_233097;
        futhark_mc_task_236579.retval_defunc_2_reduce_res_233098 =
            &defunc_2_reduce_res_233098;
        futhark_mc_task_236579.retval_defunc_2_reduce_res_233099 =
            &defunc_2_reduce_res_233099;
        futhark_mc_task_236579.retval_defunc_2_reduce_res_233100 =
            &defunc_2_reduce_res_233100;
        
        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_segred_task_236580;
        futhark_mc_task_236579_task.name = "futhark_mc_segred_task_236580";
        futhark_mc_task_236579_task.iterations = q_t_203576;
        futhark_mc_task_236579_task.task_time =
            &ctx->futhark_mc_segred_task_236580_total_time;
        futhark_mc_task_236579_task.task_iter =
            &ctx->futhark_mc_segred_task_236580_total_iter;
        futhark_mc_task_236579_task.sched = STATIC;
        futhark_mc_task_236579_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236580_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236579_task);
        
        if (futhark_mc_segred_task_236580_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_233140 = defunc_2_reduce_res_233098 *
               defunc_2_reduce_res_233100;
        double y_233141 = defunc_2_reduce_res_233099 *
               defunc_2_reduce_res_233099;
        double a12_233142 = x_233140 - y_233141;
        double x_233143 = defunc_2_reduce_res_233098 *
               defunc_2_reduce_res_233099;
        double y_233144 = defunc_2_reduce_res_233097 *
               defunc_2_reduce_res_233100;
        double b12_233145 = x_233143 - y_233144;
        double x_233146 = defunc_2_reduce_res_233097 *
               defunc_2_reduce_res_233099;
        double y_233147 = defunc_2_reduce_res_233098 *
               defunc_2_reduce_res_233098;
        double c12_233148 = x_233146 - y_233147;
        double x_233149 = defunc_2_reduce_res_233096 *
               defunc_2_reduce_res_233100;
        double b2_233150 = x_233149 - y_233147;
        double x_233151 = defunc_2_reduce_res_233097 *
               defunc_2_reduce_res_233098;
        double y_233152 = defunc_2_reduce_res_233096 *
               defunc_2_reduce_res_233099;
        double c2_233153 = x_233151 - y_233152;
        double x_233154 = defunc_2_reduce_res_233096 * a12_233142;
        double y_233155 = defunc_2_reduce_res_233097 * b12_233145;
        double x_233156 = x_233154 + y_233155;
        double y_233157 = defunc_2_reduce_res_233098 * c12_233148;
        double y_233158 = x_233156 + y_233157;
        double det_233159 = 1.0 / y_233158;
        double a12_233160 = a12_233142 * det_233159;
        double b12_233161 = b12_233145 * det_233159;
        double c12_233162 = c12_233148 * det_233159;
        double b2_233163 = b2_233150 * det_233159;
        double c2_233164 = c2_233153 * det_233159;
        double defunc_2_reduce_res_233165;
        double defunc_2_reduce_res_233166;
        int64_t flat_tid_233464 = (int64_t) 0;
        int32_t num_tasks_233542;
        
        defunc_2_reduce_res_233165 = 0.0;
        defunc_2_reduce_res_233166 = 0.0;
        
        struct futhark_mc_task_236588 futhark_mc_task_236588;
        
        futhark_mc_task_236588.ctx = ctx;
        futhark_mc_task_236588.free_n_203572 = n_203572;
        futhark_mc_task_236588.free_gtid_214540 = gtid_214540;
        futhark_mc_task_236588.free_x_214545 = x_214545;
        futhark_mc_task_236588.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236588.free_mem_220110 = mem_220110.mem;
        futhark_mc_task_236588.free_mem_220113 = mem_220113.mem;
        futhark_mc_task_236588.free_x_233091 = x_233091;
        futhark_mc_task_236588.free_x_233092 = x_233092;
        futhark_mc_task_236588.free_defunc_0_g_res_233095 =
            defunc_0_g_res_233095;
        futhark_mc_task_236588.free_a12_233160 = a12_233160;
        futhark_mc_task_236588.free_b12_233161 = b12_233161;
        futhark_mc_task_236588.free_c12_233162 = c12_233162;
        futhark_mc_task_236588.free_b2_233163 = b2_233163;
        futhark_mc_task_236588.free_c2_233164 = c2_233164;
        futhark_mc_task_236588.retval_defunc_2_reduce_res_233165 =
            &defunc_2_reduce_res_233165;
        futhark_mc_task_236588.retval_defunc_2_reduce_res_233166 =
            &defunc_2_reduce_res_233166;
        
        struct scheduler_segop futhark_mc_task_236588_task;
        
        futhark_mc_task_236588_task.args = &futhark_mc_task_236588;
        futhark_mc_task_236588_task.top_level_fn =
            futhark_mc_segred_task_236589;
        futhark_mc_task_236588_task.name = "futhark_mc_segred_task_236589";
        futhark_mc_task_236588_task.iterations = q_t_203576;
        futhark_mc_task_236588_task.task_time =
            &ctx->futhark_mc_segred_task_236589_total_time;
        futhark_mc_task_236588_task.task_iter =
            &ctx->futhark_mc_segred_task_236589_total_iter;
        futhark_mc_task_236588_task.sched = STATIC;
        futhark_mc_task_236588_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236589_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236588_task);
        
        if (futhark_mc_segred_task_236589_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_220116.mem)[gtid_233090] = defunc_2_reduce_res_233165;
        ((double *) mem_220119.mem)[gtid_233090] = defunc_2_reduce_res_233166;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236578_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236578_end -
                 futhark_mc_segmap_parloop_236578_start;
        
        ctx->futhark_mc_segmap_parloop_236578_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236578_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236578_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236576(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233089 = tid;
    int num_tasks_233340 = info.nsubtasks;
    struct futhark_mc_task_236572 *futhark_mc_task_236572 =
                                  (struct futhark_mc_task_236572 *) args;
    struct futhark_context *ctx = futhark_mc_task_236572->ctx;
    uint64_t futhark_mc_segmap_nested_task_236576_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236576_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236572->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236572->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236572->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236572->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236572->free_i_203760;
    int64_t gtid_214540 = futhark_mc_task_236572->free_gtid_214540;
    int64_t x_214545 = futhark_mc_task_236572->free_x_214545;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236572->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236572->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236572->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220110 = {.desc ="mem_220110", .mem =
                                  futhark_mc_task_236572->free_mem_220110,
                                  .size =0, .references =NULL};
    struct memblock mem_220113 = {.desc ="mem_220113", .mem =
                                  futhark_mc_task_236572->free_mem_220113,
                                  .size =0, .references =NULL};
    struct memblock mem_220116 = {.desc ="mem_220116", .mem =
                                  futhark_mc_task_236572->free_mem_220116,
                                  .size =0, .references =NULL};
    struct memblock mem_220119 = {.desc ="mem_220119", .mem =
                                  futhark_mc_task_236572->free_mem_220119,
                                  .size =0, .references =NULL};
    int64_t iter_233424;
    struct futhark_mc_segmap_parloop_struct_236577
    futhark_mc_segmap_parloop_struct_236577;
    
    futhark_mc_segmap_parloop_struct_236577.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236577.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236577.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236577.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236577.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236577.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236577.free_gtid_214540 = gtid_214540;
    futhark_mc_segmap_parloop_struct_236577.free_x_214545 = x_214545;
    futhark_mc_segmap_parloop_struct_236577.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236577.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236577.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236577.free_mem_220110 = mem_220110.mem;
    futhark_mc_segmap_parloop_struct_236577.free_mem_220113 = mem_220113.mem;
    futhark_mc_segmap_parloop_struct_236577.free_mem_220116 = mem_220116.mem;
    futhark_mc_segmap_parloop_struct_236577.free_mem_220119 = mem_220119.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236578_task;
    
    futhark_mc_segmap_parloop_236578_task.name =
        "futhark_mc_segmap_parloop_236578";
    futhark_mc_segmap_parloop_236578_task.fn = futhark_mc_segmap_parloop_236578;
    futhark_mc_segmap_parloop_236578_task.args =
        &futhark_mc_segmap_parloop_struct_236577;
    futhark_mc_segmap_parloop_236578_task.iterations = iterations;
    futhark_mc_segmap_parloop_236578_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236578_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236578_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236578_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236578_task);
    
    if (futhark_mc_segmap_parloop_236578_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236578_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236578_total_end -
                 futhark_mc_segmap_parloop_236578_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236578_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236578_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236578_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236576_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236576_end -
                 futhark_mc_segmap_nested_task_236576_start;
        
        ctx->futhark_mc_segmap_nested_task_236576_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236576_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236576_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236558(void *args, int64_t start,
                                            int64_t end, int flat_tid_214539,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236557
    *futhark_mc_segmap_parloop_struct_236557 =
    (struct futhark_mc_segmap_parloop_struct_236557 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236557->ctx;
    uint64_t futhark_mc_segmap_parloop_236558_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236558_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236557->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236557->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236557->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236557->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236557->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236557->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236557->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236557->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236557->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236557->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236557->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236557->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236557->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236557->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236557->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236557->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236557->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236557->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220198 = {.desc ="mem_220198", .mem =
                                  futhark_mc_segmap_parloop_struct_236557->free_mem_220198,
                                  .size =0, .references =NULL};
    struct memblock mem_220202 = {.desc ="mem_220202", .mem =
                                  futhark_mc_segmap_parloop_struct_236557->free_mem_220202,
                                  .size =0, .references =NULL};
    size_t mem_220107_cached_sizze_236559 = 0;
    unsigned char *mem_220107 = NULL;
    size_t mem_220110_cached_sizze_236560 = 0;
    unsigned char *mem_220110 = NULL;
    size_t mem_220113_cached_sizze_236561 = 0;
    unsigned char *mem_220113 = NULL;
    size_t mem_220116_cached_sizze_236562 = 0;
    unsigned char *mem_220116 = NULL;
    size_t mem_220119_cached_sizze_236563 = 0;
    unsigned char *mem_220119 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233069 = start;
    
    if (mem_220107_cached_sizze_236559 < (size_t) bytes_217420) {
        mem_220107 = realloc(mem_220107, bytes_217420);
        mem_220107_cached_sizze_236559 = bytes_217420;
    }
    if (mem_220110_cached_sizze_236560 < (size_t) bytes_217420) {
        mem_220110 = realloc(mem_220110, bytes_217420);
        mem_220110_cached_sizze_236560 = bytes_217420;
    }
    if (mem_220113_cached_sizze_236561 < (size_t) bytes_217420) {
        mem_220113 = realloc(mem_220113, bytes_217420);
        mem_220113_cached_sizze_236561 = bytes_217420;
    }
    if (mem_220116_cached_sizze_236562 < (size_t) bytes_217900) {
        mem_220116 = realloc(mem_220116, bytes_217900);
        mem_220116_cached_sizze_236562 = bytes_217900;
    }
    if (mem_220119_cached_sizze_236563 < (size_t) bytes_217900) {
        mem_220119 = realloc(mem_220119, bytes_217900);
        mem_220119_cached_sizze_236563 = bytes_217900;
    }
    for (; iter_233069 < end; iter_233069++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233322 = partition_sizze_203667;
        int64_t gtid_214540 = iter_233069;
        int64_t remnant_233323 = iter_233069 - gtid_214540;
        int64_t x_214545;
        
        x_214545 = ((int64_t *) mem_217461.mem)[gtid_214540];
        
        int64_t flat_tid_233070 = (int64_t) 0;
        int32_t num_tasks_233324;
        struct futhark_mc_task_236564 futhark_mc_task_236564;
        
        futhark_mc_task_236564.ctx = ctx;
        futhark_mc_task_236564.free_n_203572 = n_203572;
        futhark_mc_task_236564.free_gtid_214540 = gtid_214540;
        futhark_mc_task_236564.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_236564.free_mem_219926 = mem_219926.mem;
        futhark_mc_task_236564.free_mem_220107 = mem_220107;
        
        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_segmap_task_236565;
        futhark_mc_task_236564_task.name = "futhark_mc_segmap_task_236565";
        futhark_mc_task_236564_task.iterations = n_203572;
        futhark_mc_task_236564_task.task_time =
            &ctx->futhark_mc_segmap_task_236565_total_time;
        futhark_mc_task_236564_task.task_iter =
            &ctx->futhark_mc_segmap_task_236565_total_iter;
        futhark_mc_task_236564_task.sched = STATIC;
        futhark_mc_task_236564_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236565_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236564_task);
        
        if (futhark_mc_segmap_task_236565_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233075 = (int64_t) 0;
        int32_t num_tasks_233328;
        struct futhark_mc_task_236568 futhark_mc_task_236568;
        
        futhark_mc_task_236568.ctx = ctx;
        futhark_mc_task_236568.free_n_203572 = n_203572;
        futhark_mc_task_236568.free_gtid_214540 = gtid_214540;
        futhark_mc_task_236568.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236568.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236568.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236568.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236568.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236568.free_mem_220107 = mem_220107;
        futhark_mc_task_236568.free_mem_220110 = mem_220110;
        futhark_mc_task_236568.free_mem_220113 = mem_220113;
        
        struct scheduler_segop futhark_mc_task_236568_task;
        
        futhark_mc_task_236568_task.args = &futhark_mc_task_236568;
        futhark_mc_task_236568_task.top_level_fn =
            futhark_mc_segmap_task_236569;
        futhark_mc_task_236568_task.name = "futhark_mc_segmap_task_236569";
        futhark_mc_task_236568_task.iterations = n_203572;
        futhark_mc_task_236568_task.task_time =
            &ctx->futhark_mc_segmap_task_236569_total_time;
        futhark_mc_task_236568_task.task_iter =
            &ctx->futhark_mc_segmap_task_236569_total_iter;
        futhark_mc_task_236568_task.sched = STATIC;
        futhark_mc_task_236568_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236569_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236568_task);
        
        if (futhark_mc_segmap_task_236569_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233210 = (int64_t) 0;
        int32_t num_tasks_233340;
        int64_t flat_tid_233089 = (int64_t) 0;
        struct futhark_mc_task_236572 futhark_mc_task_236572;
        
        futhark_mc_task_236572.ctx = ctx;
        futhark_mc_task_236572.free_n_203572 = n_203572;
        futhark_mc_task_236572.free_q_t_203576 = q_t_203576;
        futhark_mc_task_236572.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236572.free_t_n_m_203740 = t_n_m_203740;
        futhark_mc_task_236572.free_i_203760 = i_203760;
        futhark_mc_task_236572.free_gtid_214540 = gtid_214540;
        futhark_mc_task_236572.free_x_214545 = x_214545;
        futhark_mc_task_236572.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236572.free_mem_217953 = mem_217953.mem;
        futhark_mc_task_236572.free_mem_217957 = mem_217957.mem;
        futhark_mc_task_236572.free_mem_220110 = mem_220110;
        futhark_mc_task_236572.free_mem_220113 = mem_220113;
        futhark_mc_task_236572.free_mem_220116 = mem_220116;
        futhark_mc_task_236572.free_mem_220119 = mem_220119;
        
        struct scheduler_segop futhark_mc_task_236572_task;
        
        futhark_mc_task_236572_task.args = &futhark_mc_task_236572;
        futhark_mc_task_236572_task.top_level_fn =
            futhark_mc_segmap_task_236573;
        futhark_mc_task_236572_task.name = "futhark_mc_segmap_task_236573";
        futhark_mc_task_236572_task.iterations = t_n_m_203740;
        futhark_mc_task_236572_task.task_time =
            &ctx->futhark_mc_segmap_task_236573_total_time;
        futhark_mc_task_236572_task.task_iter =
            &ctx->futhark_mc_segmap_task_236573_total_iter;
        futhark_mc_task_236572_task.sched = STATIC;
        futhark_mc_task_236572_task.nested_fn =
            futhark_mc_segmap_nested_task_236576;
        
        int futhark_mc_segmap_task_236573_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236572_task);
        
        if (futhark_mc_segmap_task_236573_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220198.mem + gtid_214540 * t_n_m_203740 * (int64_t) 8,
                    mem_220116 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220202.mem + gtid_214540 * t_n_m_203740 * (int64_t) 8,
                    mem_220119 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220107);
    free(mem_220110);
    free(mem_220113);
    free(mem_220116);
    free(mem_220119);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236558_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236558_end -
                 futhark_mc_segmap_parloop_236558_start;
        
        ctx->futhark_mc_segmap_parloop_236558_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236558_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236558_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236556(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214539 = tid;
    int num_tasks_232915 = info.nsubtasks;
    struct futhark_mc_task_236547 *futhark_mc_task_236547 =
                                  (struct futhark_mc_task_236547 *) args;
    struct futhark_context *ctx = futhark_mc_task_236547->ctx;
    uint64_t futhark_mc_segmap_nested_task_236556_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236556_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236547->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236547->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236547->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236547->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236547->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236547->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236547->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236547->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236547->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236547->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236547->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236547->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236547->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236547->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236547->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236547->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236547->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236547->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220198 = {.desc ="mem_220198", .mem =
                                  futhark_mc_task_236547->free_mem_220198,
                                  .size =0, .references =NULL};
    struct memblock mem_220202 = {.desc ="mem_220202", .mem =
                                  futhark_mc_task_236547->free_mem_220202,
                                  .size =0, .references =NULL};
    int64_t iter_233069;
    struct futhark_mc_segmap_parloop_struct_236557
    futhark_mc_segmap_parloop_struct_236557;
    
    futhark_mc_segmap_parloop_struct_236557.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236557.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236557.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236557.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236557.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236557.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236557.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236557.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236557.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236557.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236557.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236557.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236557.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236557.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236557.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236557.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236557.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236557.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236557.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236557.free_mem_220198 = mem_220198.mem;
    futhark_mc_segmap_parloop_struct_236557.free_mem_220202 = mem_220202.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236558_task;
    
    futhark_mc_segmap_parloop_236558_task.name =
        "futhark_mc_segmap_parloop_236558";
    futhark_mc_segmap_parloop_236558_task.fn = futhark_mc_segmap_parloop_236558;
    futhark_mc_segmap_parloop_236558_task.args =
        &futhark_mc_segmap_parloop_struct_236557;
    futhark_mc_segmap_parloop_236558_task.iterations = iterations;
    futhark_mc_segmap_parloop_236558_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236558_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236558_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236558_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236558_task);
    
    if (futhark_mc_segmap_parloop_236558_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236558_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236558_total_end -
                 futhark_mc_segmap_parloop_236558_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236558_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236558_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236558_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236556_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236556_end -
                 futhark_mc_segmap_nested_task_236556_start;
        
        ctx->futhark_mc_segmap_nested_task_236556_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236556_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236556_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236594 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    int64_t free_bytes_220221;
    unsigned char *free_mem_220319;
};
struct futhark_mc_segmap_parloop_struct_236596 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    int64_t free_bytes_220221;
    unsigned char *free_mem_220319;
};
static int futhark_mc_segmap_parloop_236597(void *args, int64_t start,
                                            int64_t end, int flat_tid_214816,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236596->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236596->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236596->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236596->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236596->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236596->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236596->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236596->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236596->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236596->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236596->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236596->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236596->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236596->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236596->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236596->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236596->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236596->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220221 =
            futhark_mc_segmap_parloop_struct_236596->free_bytes_220221;
    struct memblock mem_220319 = {.desc ="mem_220319", .mem =
                                  futhark_mc_segmap_parloop_struct_236596->free_mem_220319,
                                  .size =0, .references =NULL};
    size_t mem_220243_cached_sizze_236598 = 0;
    unsigned char *mem_220243 = NULL;
    size_t mem_220258_cached_sizze_236599 = 0;
    unsigned char *mem_220258 = NULL;
    size_t mem_220261_cached_sizze_236600 = 0;
    unsigned char *mem_220261 = NULL;
    size_t mem_220288_cached_sizze_236601 = 0;
    unsigned char *mem_220288 = NULL;
    size_t mem_220298_cached_sizze_236602 = 0;
    unsigned char *mem_220298 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233560 = start;
    
    if (mem_220243_cached_sizze_236598 < (size_t) bytes_217420) {
        mem_220243 = realloc(mem_220243, bytes_217420);
        mem_220243_cached_sizze_236598 = bytes_217420;
    }
    if (mem_220258_cached_sizze_236599 < (size_t) bytes_217420) {
        mem_220258 = realloc(mem_220258, bytes_217420);
        mem_220258_cached_sizze_236599 = bytes_217420;
    }
    if (mem_220261_cached_sizze_236600 < (size_t) bytes_217420) {
        mem_220261 = realloc(mem_220261, bytes_217420);
        mem_220261_cached_sizze_236600 = bytes_217420;
    }
    if (mem_220288_cached_sizze_236601 < (size_t) bytes_217900) {
        mem_220288 = realloc(mem_220288, bytes_217900);
        mem_220288_cached_sizze_236601 = bytes_217900;
    }
    if (mem_220298_cached_sizze_236602 < (size_t) bytes_220221) {
        mem_220298 = realloc(mem_220298, bytes_220221);
        mem_220298_cached_sizze_236602 = bytes_220221;
    }
    for (; iter_233560 < end; iter_233560++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233630 = partition_sizze_203667;
        int64_t gtid_214817 = iter_233560;
        int64_t remnant_233631 = iter_233560 - gtid_214817;
        int64_t x_206314;
        
        x_206314 = ((int64_t *) mem_217461.mem)[gtid_214817];
        for (int64_t i_233561 = 0; i_233561 < n_203572; i_233561++) {
            double x_233563;
            
            x_233563 = ((double *) mem_217415.mem)[gtid_214817 * n_203572 +
                                                   i_233561];
            
            double x_233564;
            
            x_233564 = ((double *) mem_219926.mem)[gtid_214817 * n_203572 +
                                                   i_233561];
            
            double defunc_1_f_res_233565 = x_233563 - x_233564;
            
            ((double *) mem_220243)[i_233561] = defunc_1_f_res_233565;
        }
        for (int64_t i_233567 = 0; i_233567 < n_203572; i_233567++) {
            int64_t x_233570;
            
            x_233570 = ((int64_t *) mem_217458.mem)[gtid_214817 * n_203572 +
                                                    i_233567];
            
            bool cond_233571 = sle64((int64_t) 0, x_233570);
            double defunc_0_f_res_233572;
            
            if (cond_233571) {
                bool y_233573 = slt64(x_233570, n_203572);
                bool bounds_check_233574 = cond_233571 && y_233573;
                bool index_certs_233575;
                
                if (!bounds_check_233574) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_233570,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_233576;
                
                defunc_0_f_res_t_res_233576 = ((double *) mem_220243)[x_233570];
                defunc_0_f_res_233572 = defunc_0_f_res_t_res_233576;
            } else {
                defunc_0_f_res_233572 = 0.0;
            }
            
            double defunc_0_f_res_233577;
            
            if (cond_233571) {
                bool y_233578 = slt64(x_233570, n_203572);
                bool bounds_check_233579 = cond_233571 && y_233578;
                bool index_certs_233580;
                
                if (!bounds_check_233579) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_233570,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_233581;
                
                defunc_0_f_res_t_res_233581 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_214817 *
                                                       ctx_param_ext_217985 +
                                                       x_233570 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_233577 = defunc_0_f_res_t_res_233581;
            } else {
                defunc_0_f_res_233577 = 0.0;
            }
            ((double *) mem_220258)[i_233567] = defunc_0_f_res_233577;
            ((double *) mem_220261)[i_233567] = defunc_0_f_res_233572;
        }
        for (int64_t i_233584 = 0; i_233584 < t_n_m_203740; i_233584++) {
            int64_t x_233586;
            
            x_233586 = ((int64_t *) mem_217953.mem)[gtid_214817 * t_n_m_203740 +
                                                    i_233584];
            
            double x_233587;
            
            x_233587 = ((double *) mem_217957.mem)[gtid_214817 * t_n_m_203740 +
                                                   i_233584];
            
            int64_t min_arg_233588 = mul64(jump_t_203582, i_233584);
            int64_t min_res_233589 = smin64(i_203760, min_arg_233588);
            int64_t defunc_0_g_res_233590 = add64((int64_t) 1, min_res_233589);
            double defunc_2_reduce_res_233592;
            double redout_233595 = 0.0;
            
            for (int64_t i_233594 = 0; i_233594 < q_t_203576; i_233594++) {
                bool cond_233597 = sle64(x_206314, i_233594);
                int64_t defunc_0_f_res_233598;
                
                if (cond_233597) {
                    defunc_0_f_res_233598 = (int64_t) 0;
                } else {
                    int64_t i_233599 = add64(x_233586, i_233594);
                    int64_t defunc_0_add_arg_233600;
                    
                    defunc_0_add_arg_233600 =
                        ((int64_t *) mem_217458.mem)[gtid_214817 * n_203572 +
                                                     i_233599];
                    
                    int64_t defunc_1_add_res_233601 = add64((int64_t) 1,
                                                            defunc_0_add_arg_233600);
                    
                    defunc_0_f_res_233598 = defunc_1_add_res_233601;
                }
                
                double defunc_0_f_res_233602;
                
                if (cond_233597) {
                    defunc_0_f_res_233602 = 0.0;
                } else {
                    int64_t i_233603 = add64(x_233586, i_233594);
                    double defunc_0_add_arg_233604;
                    
                    defunc_0_add_arg_233604 = ((double *) mem_220258)[i_233603];
                    defunc_0_f_res_233602 = defunc_0_add_arg_233604;
                }
                
                int64_t binop_p_233605 = sub64(defunc_0_f_res_233598,
                                               defunc_0_g_res_233590);
                double defunc_0_f_res_233606 = sitofp_i64_f64(binop_p_233605);
                double abs_res_233607 = fabs(defunc_0_f_res_233606);
                double tmp1_233608 = abs_res_233607 / x_233587;
                double x_233609 = tmp1_233608 * tmp1_233608;
                double y_233610 = tmp1_233608 * x_233609;
                double tmp2_233611 = 1.0 - y_233610;
                double x_233612 = tmp2_233611 * tmp2_233611;
                double tmp3_233613 = tmp2_233611 * x_233612;
                double tmp4_233614 = defunc_0_f_res_233602 * tmp3_233613;
                double defunc_1_op_res_233615 = tmp4_233614 + redout_233595;
                
                ((double *) mem_220298)[i_233594] = tmp4_233614;
                
                double redout_tmp_233636 = defunc_1_op_res_233615;
                
                redout_233595 = redout_tmp_233636;
            }
            defunc_2_reduce_res_233592 = redout_233595;
            
            double a0_233617 = 1.0 / defunc_2_reduce_res_233592;
            double defunc_2_reduce_res_233618;
            double redout_233620 = 0.0;
            
            for (int64_t i_233619 = 0; i_233619 < q_t_203576; i_233619++) {
                double x_233621;
                
                x_233621 = ((double *) mem_220298)[i_233619];
                
                bool cond_233622 = sle64(x_206314, i_233619);
                double defunc_0_f_res_233623;
                
                if (cond_233622) {
                    defunc_0_f_res_233623 = 0.0;
                } else {
                    int64_t i_233624 = add64(x_233586, i_233619);
                    double defunc_0_add_arg_233625;
                    
                    defunc_0_add_arg_233625 = ((double *) mem_220261)[i_233624];
                    defunc_0_f_res_233623 = defunc_0_add_arg_233625;
                }
                
                double x_233626 = a0_233617 * x_233621;
                double defunc_9_fit_fun_res_233627 = defunc_0_f_res_233623 *
                       x_233626;
                double defunc_1_op_res_233628 = defunc_9_fit_fun_res_233627 +
                       redout_233620;
                double redout_tmp_233638 = defunc_1_op_res_233628;
                
                redout_233620 = redout_tmp_233638;
            }
            defunc_2_reduce_res_233618 = redout_233620;
            ((double *) mem_220288)[i_233584] = defunc_2_reduce_res_233618;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220319.mem + gtid_214817 * t_n_m_203740 * (int64_t) 8,
                    mem_220288 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220243);
    free(mem_220258);
    free(mem_220261);
    free(mem_220288);
    free(mem_220298);
    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_214816 = tid;
    int num_tasks_233559 = 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_203572 = futhark_mc_task_236594->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236594->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236594->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236594->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236594->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236594->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236594->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236594->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236594->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236594->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236594->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236594->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236594->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236594->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236594->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236594->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236594->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236594->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220221 = futhark_mc_task_236594->free_bytes_220221;
    struct memblock mem_220319 = {.desc ="mem_220319", .mem =
                                  futhark_mc_task_236594->free_mem_220319,
                                  .size =0, .references =NULL};
    int64_t iter_233560;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236596.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236596.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236596.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236596.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236596.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236596.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236596.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236596.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236596.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236596.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236596.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236596.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236596.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236596.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236596.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236596.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236596.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236596.free_bytes_220221 = bytes_220221;
    futhark_mc_segmap_parloop_struct_236596.free_mem_220319 = mem_220319.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_segmap_parloop_struct_236604 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    int64_t free_bytes_220221;
    unsigned char *free_mem_220319;
};
struct futhark_mc_task_236610 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214882;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220213;
};
struct futhark_mc_segmap_parloop_struct_236612 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214882;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220213;
};
static int futhark_mc_segmap_parloop_236613(void *args, int64_t start,
                                            int64_t end, int flat_tid_233640,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236612->free_n_203572;
    int64_t gtid_214882 =
            futhark_mc_segmap_parloop_struct_236612->free_gtid_214882;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236612->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236612->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220213 = {.desc ="mem_220213", .mem =
                                  futhark_mc_segmap_parloop_struct_236612->free_mem_220213,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233755 = start;
    
    for (; iter_233755 < end; iter_233755++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233756 = n_203572;
        int64_t gtid_233641 = iter_233755;
        int64_t remnant_233757 = iter_233755 - gtid_233641;
        double x_233642;
        
        x_233642 = ((double *) mem_217415.mem)[gtid_214882 * n_203572 +
                                               gtid_233641];
        
        double x_233643;
        
        x_233643 = ((double *) mem_219926.mem)[gtid_214882 * n_203572 +
                                               gtid_233641];
        
        double defunc_1_f_res_233644 = x_233642 - x_233643;
        
        ((double *) mem_220213.mem)[gtid_233641] = defunc_1_f_res_233644;
    }
    
  cleanup:
    { }
    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_task_236611(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233640 = tid;
    int num_tasks_233754 = info.nsubtasks;
    struct futhark_mc_task_236610 *futhark_mc_task_236610 =
                                  (struct futhark_mc_task_236610 *) args;
    struct futhark_context *ctx = futhark_mc_task_236610->ctx;
    uint64_t futhark_mc_segmap_task_236611_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236611_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236610->free_n_203572;
    int64_t gtid_214882 = futhark_mc_task_236610->free_gtid_214882;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236610->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236610->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220213 = {.desc ="mem_220213", .mem =
                                  futhark_mc_task_236610->free_mem_220213,
                                  .size =0, .references =NULL};
    int64_t iter_233755;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236612.free_gtid_214882 = gtid_214882;
    futhark_mc_segmap_parloop_struct_236612.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236612.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236612.free_mem_220213 = mem_220213.mem;
    
    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_task_236611_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236611_end -
                 futhark_mc_segmap_task_236611_start;
        
        ctx->futhark_mc_segmap_task_236611_runs[tid]++;
        ctx->futhark_mc_segmap_task_236611_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236611_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236614 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214882;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220213;
    unsigned char *free_mem_220216;
    unsigned char *free_mem_220219;
};
struct futhark_mc_segmap_parloop_struct_236616 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214882;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220213;
    unsigned char *free_mem_220216;
    unsigned char *free_mem_220219;
};
static int futhark_mc_segmap_parloop_236617(void *args, int64_t start,
                                            int64_t end, int flat_tid_233645,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236616
    *futhark_mc_segmap_parloop_struct_236616 =
    (struct futhark_mc_segmap_parloop_struct_236616 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236616->ctx;
    uint64_t futhark_mc_segmap_parloop_236617_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236617_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236616->free_n_203572;
    int64_t gtid_214882 =
            futhark_mc_segmap_parloop_struct_236616->free_gtid_214882;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236616->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236616->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236616->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236616->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236616->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220213 = {.desc ="mem_220213", .mem =
                                  futhark_mc_segmap_parloop_struct_236616->free_mem_220213,
                                  .size =0, .references =NULL};
    struct memblock mem_220216 = {.desc ="mem_220216", .mem =
                                  futhark_mc_segmap_parloop_struct_236616->free_mem_220216,
                                  .size =0, .references =NULL};
    struct memblock mem_220219 = {.desc ="mem_220219", .mem =
                                  futhark_mc_segmap_parloop_struct_236616->free_mem_220219,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233759 = start;
    
    for (; iter_233759 < end; iter_233759++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233768 = n_203572;
        int64_t gtid_233646 = iter_233759;
        int64_t remnant_233769 = iter_233759 - gtid_233646;
        int64_t x_233647;
        
        x_233647 = ((int64_t *) mem_217458.mem)[gtid_214882 * n_203572 +
                                                gtid_233646];
        
        bool cond_233648 = sle64((int64_t) 0, x_233647);
        double defunc_0_f_res_233649;
        
        if (cond_233648) {
            bool y_233760 = slt64(x_233647, n_203572);
            bool bounds_check_233761 = cond_233648 && y_233760;
            bool index_certs_233762;
            
            if (!bounds_check_233761) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233647,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_233763;
            
            defunc_0_f_res_t_res_233763 = ((double *) mem_220213.mem)[x_233647];
            defunc_0_f_res_233649 = defunc_0_f_res_t_res_233763;
        } else {
            defunc_0_f_res_233649 = 0.0;
        }
        
        double defunc_0_f_res_233654;
        
        if (cond_233648) {
            bool y_233764 = slt64(x_233647, n_203572);
            bool bounds_check_233765 = cond_233648 && y_233764;
            bool index_certs_233766;
            
            if (!bounds_check_233765) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233647,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_233767;
            
            defunc_0_f_res_t_res_233767 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_214882 *
                                                   ctx_param_ext_217985 +
                                                   x_233647 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_233654 = defunc_0_f_res_t_res_233767;
        } else {
            defunc_0_f_res_233654 = 0.0;
        }
        ((double *) mem_220216.mem)[gtid_233646] = defunc_0_f_res_233654;
        ((double *) mem_220219.mem)[gtid_233646] = defunc_0_f_res_233649;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236617_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236617_end -
                 futhark_mc_segmap_parloop_236617_start;
        
        ctx->futhark_mc_segmap_parloop_236617_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236617_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236617_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236615(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233645 = tid;
    int num_tasks_233758 = info.nsubtasks;
    struct futhark_mc_task_236614 *futhark_mc_task_236614 =
                                  (struct futhark_mc_task_236614 *) args;
    struct futhark_context *ctx = futhark_mc_task_236614->ctx;
    uint64_t futhark_mc_segmap_task_236615_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236615_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236614->free_n_203572;
    int64_t gtid_214882 = futhark_mc_task_236614->free_gtid_214882;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236614->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236614->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236614->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236614->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236614->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220213 = {.desc ="mem_220213", .mem =
                                  futhark_mc_task_236614->free_mem_220213,
                                  .size =0, .references =NULL};
    struct memblock mem_220216 = {.desc ="mem_220216", .mem =
                                  futhark_mc_task_236614->free_mem_220216,
                                  .size =0, .references =NULL};
    struct memblock mem_220219 = {.desc ="mem_220219", .mem =
                                  futhark_mc_task_236614->free_mem_220219,
                                  .size =0, .references =NULL};
    int64_t iter_233759;
    struct futhark_mc_segmap_parloop_struct_236616
    futhark_mc_segmap_parloop_struct_236616;
    
    futhark_mc_segmap_parloop_struct_236616.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236616.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236616.free_gtid_214882 = gtid_214882;
    futhark_mc_segmap_parloop_struct_236616.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236616.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236616.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236616.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236616.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236616.free_mem_220213 = mem_220213.mem;
    futhark_mc_segmap_parloop_struct_236616.free_mem_220216 = mem_220216.mem;
    futhark_mc_segmap_parloop_struct_236616.free_mem_220219 = mem_220219.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236617_task;
    
    futhark_mc_segmap_parloop_236617_task.name =
        "futhark_mc_segmap_parloop_236617";
    futhark_mc_segmap_parloop_236617_task.fn = futhark_mc_segmap_parloop_236617;
    futhark_mc_segmap_parloop_236617_task.args =
        &futhark_mc_segmap_parloop_struct_236616;
    futhark_mc_segmap_parloop_236617_task.iterations = iterations;
    futhark_mc_segmap_parloop_236617_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236617_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236617_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236617_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236617_task);
    
    if (futhark_mc_segmap_parloop_236617_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236617_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236617_total_end -
                 futhark_mc_segmap_parloop_236617_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236617_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236617_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236617_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236615_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236615_end -
                 futhark_mc_segmap_task_236615_start;
        
        ctx->futhark_mc_segmap_task_236615_runs[tid]++;
        ctx->futhark_mc_segmap_task_236615_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236615_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236618 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_214882;
    int64_t free_x_214887;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220216;
    unsigned char *free_mem_220219;
    int64_t free_bytes_220221;
    unsigned char *free_mem_220240;
};
struct futhark_mc_segmap_parloop_struct_236620 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_214882;
    int64_t free_x_214887;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220216;
    unsigned char *free_mem_220219;
    int64_t free_bytes_220221;
    unsigned char *free_mem_220240;
};
static int futhark_mc_segmap_parloop_236621(void *args, int64_t start,
                                            int64_t end, int flat_tid_233706,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236620
    *futhark_mc_segmap_parloop_struct_236620 =
    (struct futhark_mc_segmap_parloop_struct_236620 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236620->ctx;
    uint64_t futhark_mc_segmap_parloop_236621_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236621_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236620->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236620->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236620->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236620->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236620->free_i_203760;
    int64_t gtid_214882 =
            futhark_mc_segmap_parloop_struct_236620->free_gtid_214882;
    int64_t x_214887 = futhark_mc_segmap_parloop_struct_236620->free_x_214887;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236620->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236620->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236620->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220216 = {.desc ="mem_220216", .mem =
                                  futhark_mc_segmap_parloop_struct_236620->free_mem_220216,
                                  .size =0, .references =NULL};
    struct memblock mem_220219 = {.desc ="mem_220219", .mem =
                                  futhark_mc_segmap_parloop_struct_236620->free_mem_220219,
                                  .size =0, .references =NULL};
    int64_t bytes_220221 =
            futhark_mc_segmap_parloop_struct_236620->free_bytes_220221;
    struct memblock mem_220240 = {.desc ="mem_220240", .mem =
                                  futhark_mc_segmap_parloop_struct_236620->free_mem_220240,
                                  .size =0, .references =NULL};
    size_t mem_233713_cached_sizze_236622 = 0;
    unsigned char *mem_233713 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233771 = start;
    
    if (mem_233713_cached_sizze_236622 < (size_t) bytes_220221) {
        mem_233713 = realloc(mem_233713, bytes_220221);
        mem_233713_cached_sizze_236622 = bytes_220221;
    }
    for (; iter_233771 < end; iter_233771++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233805 = t_n_m_203740;
        int64_t gtid_233707 = iter_233771;
        int64_t remnant_233806 = iter_233771 - gtid_233707;
        int64_t x_233708;
        
        x_233708 = ((int64_t *) mem_217953.mem)[gtid_214882 * t_n_m_203740 +
                                                gtid_233707];
        
        double x_233709;
        
        x_233709 = ((double *) mem_217957.mem)[gtid_214882 * t_n_m_203740 +
                                               gtid_233707];
        
        int64_t min_arg_233710 = mul64(jump_t_203582, gtid_233707);
        int64_t min_res_233711 = smin64(i_203760, min_arg_233710);
        int64_t defunc_0_g_res_233712 = add64((int64_t) 1, min_res_233711);
        double defunc_2_reduce_res_233715;
        double redout_233773 = 0.0;
        
        for (int64_t i_233772 = 0; i_233772 < q_t_203576; i_233772++) {
            bool cond_233775 = sle64(x_214887, i_233772);
            int64_t defunc_0_f_res_233776;
            
            if (cond_233775) {
                defunc_0_f_res_233776 = (int64_t) 0;
            } else {
                int64_t i_233777 = add64(x_233708, i_233772);
                int64_t defunc_0_add_arg_233778;
                
                defunc_0_add_arg_233778 =
                    ((int64_t *) mem_217458.mem)[gtid_214882 * n_203572 +
                                                 i_233777];
                
                int64_t defunc_1_add_res_233779 = add64((int64_t) 1,
                                                        defunc_0_add_arg_233778);
                
                defunc_0_f_res_233776 = defunc_1_add_res_233779;
            }
            
            double defunc_0_f_res_233780;
            
            if (cond_233775) {
                defunc_0_f_res_233780 = 0.0;
            } else {
                int64_t i_233781 = add64(x_233708, i_233772);
                double defunc_0_add_arg_233782;
                
                defunc_0_add_arg_233782 = ((double *) mem_220216.mem)[i_233781];
                defunc_0_f_res_233780 = defunc_0_add_arg_233782;
            }
            
            int64_t binop_p_233783 = sub64(defunc_0_f_res_233776,
                                           defunc_0_g_res_233712);
            double defunc_0_f_res_233784 = sitofp_i64_f64(binop_p_233783);
            double abs_res_233785 = fabs(defunc_0_f_res_233784);
            double tmp1_233786 = abs_res_233785 / x_233709;
            double x_233787 = tmp1_233786 * tmp1_233786;
            double y_233788 = tmp1_233786 * x_233787;
            double tmp2_233789 = 1.0 - y_233788;
            double x_233790 = tmp2_233789 * tmp2_233789;
            double tmp3_233791 = tmp2_233789 * x_233790;
            double tmp4_233792 = defunc_0_f_res_233780 * tmp3_233791;
            double defunc_1_op_res_233793 = tmp4_233792 + redout_233773;
            
            ((double *) mem_233713)[i_233772] = tmp4_233792;
            
            double redout_tmp_233807 = defunc_1_op_res_233793;
            
            redout_233773 = redout_tmp_233807;
        }
        defunc_2_reduce_res_233715 = redout_233773;
        
        double a0_233740 = 1.0 / defunc_2_reduce_res_233715;
        double defunc_2_reduce_res_233741;
        double redout_233796 = 0.0;
        
        for (int64_t i_233795 = 0; i_233795 < q_t_203576; i_233795++) {
            double x_233797;
            
            x_233797 = ((double *) mem_233713)[i_233795];
            
            bool cond_233798 = sle64(x_214887, i_233795);
            double defunc_0_f_res_233799;
            
            if (cond_233798) {
                defunc_0_f_res_233799 = 0.0;
            } else {
                int64_t i_233800 = add64(x_233708, i_233795);
                double defunc_0_add_arg_233801;
                
                defunc_0_add_arg_233801 = ((double *) mem_220219.mem)[i_233800];
                defunc_0_f_res_233799 = defunc_0_add_arg_233801;
            }
            
            double x_233802 = a0_233740 * x_233797;
            double defunc_9_fit_fun_res_233803 = defunc_0_f_res_233799 *
                   x_233802;
            double defunc_1_op_res_233804 = defunc_9_fit_fun_res_233803 +
                   redout_233796;
            double redout_tmp_233809 = defunc_1_op_res_233804;
            
            redout_233796 = redout_tmp_233809;
        }
        defunc_2_reduce_res_233741 = redout_233796;
        ((double *) mem_220240.mem)[gtid_233707] = defunc_2_reduce_res_233741;
    }
    
  cleanup:
    { }
    free(mem_233713);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236621_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236621_end -
                 futhark_mc_segmap_parloop_236621_start;
        
        ctx->futhark_mc_segmap_parloop_236621_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236621_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236621_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236619(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233706 = tid;
    int num_tasks_233770 = info.nsubtasks;
    struct futhark_mc_task_236618 *futhark_mc_task_236618 =
                                  (struct futhark_mc_task_236618 *) args;
    struct futhark_context *ctx = futhark_mc_task_236618->ctx;
    uint64_t futhark_mc_segmap_task_236619_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236619_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236618->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236618->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236618->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236618->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236618->free_i_203760;
    int64_t gtid_214882 = futhark_mc_task_236618->free_gtid_214882;
    int64_t x_214887 = futhark_mc_task_236618->free_x_214887;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236618->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236618->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236618->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220216 = {.desc ="mem_220216", .mem =
                                  futhark_mc_task_236618->free_mem_220216,
                                  .size =0, .references =NULL};
    struct memblock mem_220219 = {.desc ="mem_220219", .mem =
                                  futhark_mc_task_236618->free_mem_220219,
                                  .size =0, .references =NULL};
    int64_t bytes_220221 = futhark_mc_task_236618->free_bytes_220221;
    struct memblock mem_220240 = {.desc ="mem_220240", .mem =
                                  futhark_mc_task_236618->free_mem_220240,
                                  .size =0, .references =NULL};
    int64_t iter_233771;
    struct futhark_mc_segmap_parloop_struct_236620
    futhark_mc_segmap_parloop_struct_236620;
    
    futhark_mc_segmap_parloop_struct_236620.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236620.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236620.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236620.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236620.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236620.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236620.free_gtid_214882 = gtid_214882;
    futhark_mc_segmap_parloop_struct_236620.free_x_214887 = x_214887;
    futhark_mc_segmap_parloop_struct_236620.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236620.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236620.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236620.free_mem_220216 = mem_220216.mem;
    futhark_mc_segmap_parloop_struct_236620.free_mem_220219 = mem_220219.mem;
    futhark_mc_segmap_parloop_struct_236620.free_bytes_220221 = bytes_220221;
    futhark_mc_segmap_parloop_struct_236620.free_mem_220240 = mem_220240.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236621_task;
    
    futhark_mc_segmap_parloop_236621_task.name =
        "futhark_mc_segmap_parloop_236621";
    futhark_mc_segmap_parloop_236621_task.fn = futhark_mc_segmap_parloop_236621;
    futhark_mc_segmap_parloop_236621_task.args =
        &futhark_mc_segmap_parloop_struct_236620;
    futhark_mc_segmap_parloop_236621_task.iterations = iterations;
    futhark_mc_segmap_parloop_236621_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236621_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236621_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236621_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236621_task);
    
    if (futhark_mc_segmap_parloop_236621_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236621_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236621_total_end -
                 futhark_mc_segmap_parloop_236621_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236621_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236621_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236621_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236619_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236619_end -
                 futhark_mc_segmap_task_236619_start;
        
        ctx->futhark_mc_segmap_task_236619_runs[tid]++;
        ctx->futhark_mc_segmap_task_236619_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236619_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236624 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_214882;
    int64_t free_x_214887;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220216;
    unsigned char *free_mem_220219;
    int64_t free_bytes_220221;
    unsigned char *free_mem_220240;
};
struct futhark_mc_task_236627 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214882;
    int64_t free_x_214887;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220216;
    int64_t free_x_233661;
    double free_x_233662;
    int64_t free_defunc_0_g_res_233665;
    double *retval_defunc_2_reduce_res_233667;
    unsigned char *retval_mem_233666;
};
struct futhark_mc_segred_stage_1_parloop_struct_236630 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_214882;
    int64_t free_x_214887;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220216;
    int64_t free_x_233661;
    double free_x_233662;
    int64_t free_defunc_0_g_res_233665;
    unsigned char *free_mem_233666;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233849;
};
static int futhark_mc_segred_stage_1_parloop_236631(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_233811,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236630
    *futhark_mc_segred_stage_1_parloop_struct_236630 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236630 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236630->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236631_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236631_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236630->free_n_203572;
    int64_t gtid_214882 =
            futhark_mc_segred_stage_1_parloop_struct_236630->free_gtid_214882;
    int64_t x_214887 =
            futhark_mc_segred_stage_1_parloop_struct_236630->free_x_214887;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236630->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220216 = {.desc ="mem_220216", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236630->free_mem_220216,
                                  .size =0, .references =NULL};
    int64_t x_233661 =
            futhark_mc_segred_stage_1_parloop_struct_236630->free_x_233661;
    double x_233662 =
           futhark_mc_segred_stage_1_parloop_struct_236630->free_x_233662;
    int64_t defunc_0_g_res_233665 =
            futhark_mc_segred_stage_1_parloop_struct_236630->free_defunc_0_g_res_233665;
    struct memblock mem_233666 = {.desc ="mem_233666", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236630->free_mem_233666,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_233849 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233849",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236630->free_reduce_stage_1_tid_res_arr_mem_233849,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233851 = start;
    double x_233813;
    double x_233814;
    double local_acc_233852 = 0.0;
    
    for (; iter_233851 < end; iter_233851++) {
        int64_t gtid_233812 = iter_233851;
        bool cond_233816 = sle64(x_214887, gtid_233812);
        int64_t defunc_0_f_res_233817;
        
        if (cond_233816) {
            defunc_0_f_res_233817 = (int64_t) 0;
        } else {
            int64_t i_233818 = add64(x_233661, gtid_233812);
            int64_t defunc_0_add_arg_233819;
            
            defunc_0_add_arg_233819 = ((int64_t *) mem_217458.mem)[gtid_214882 *
                                                                   n_203572 +
                                                                   i_233818];
            
            int64_t defunc_1_add_res_233820 = add64((int64_t) 1,
                                                    defunc_0_add_arg_233819);
            
            defunc_0_f_res_233817 = defunc_1_add_res_233820;
        }
        
        double defunc_0_f_res_233821;
        
        if (cond_233816) {
            defunc_0_f_res_233821 = 0.0;
        } else {
            int64_t i_233822 = add64(x_233661, gtid_233812);
            double defunc_0_add_arg_233823;
            
            defunc_0_add_arg_233823 = ((double *) mem_220216.mem)[i_233822];
            defunc_0_f_res_233821 = defunc_0_add_arg_233823;
        }
        
        int64_t binop_p_233824 = sub64(defunc_0_f_res_233817,
                                       defunc_0_g_res_233665);
        double defunc_0_f_res_233825 = sitofp_i64_f64(binop_p_233824);
        double abs_res_233826 = fabs(defunc_0_f_res_233825);
        double tmp1_233827 = abs_res_233826 / x_233662;
        double x_233828 = tmp1_233827 * tmp1_233827;
        double y_233829 = tmp1_233827 * x_233828;
        double tmp2_233830 = 1.0 - y_233829;
        double x_233831 = tmp2_233830 * tmp2_233830;
        double tmp3_233832 = tmp2_233830 * x_233831;
        double tmp4_233833 = defunc_0_f_res_233821 * tmp3_233832;
        
        // save map-out results
        {
            ((double *) mem_233666.mem)[gtid_233812] = tmp4_233833;
        }
        // Load accum params
        {
            x_233813 = local_acc_233852;
        }
        // Load next params
        {
            x_233814 = tmp4_233833;
        }
        // Red body
        {
            double defunc_1_op_res_233815 = x_233813 + x_233814;
            
            local_acc_233852 = defunc_1_op_res_233815;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_233849.mem)[flat_tid_233811] =
        local_acc_233852;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236631_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236631_end -
                 futhark_mc_segred_stage_1_parloop_236631_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236631_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236631_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236631_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236628(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233811 = tid;
    int num_tasks_233848 = info.nsubtasks;
    struct futhark_mc_task_236627 *futhark_mc_task_236627 =
                                  (struct futhark_mc_task_236627 *) args;
    struct futhark_context *ctx = futhark_mc_task_236627->ctx;
    uint64_t futhark_mc_segred_task_236628_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236628_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236627->free_n_203572;
    int64_t gtid_214882 = futhark_mc_task_236627->free_gtid_214882;
    int64_t x_214887 = futhark_mc_task_236627->free_x_214887;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236627->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220216 = {.desc ="mem_220216", .mem =
                                  futhark_mc_task_236627->free_mem_220216,
                                  .size =0, .references =NULL};
    int64_t x_233661 = futhark_mc_task_236627->free_x_233661;
    double x_233662 = futhark_mc_task_236627->free_x_233662;
    int64_t defunc_0_g_res_233665 =
            futhark_mc_task_236627->free_defunc_0_g_res_233665;
    double defunc_2_reduce_res_233667 =
           *futhark_mc_task_236627->retval_defunc_2_reduce_res_233667;
    struct memblock mem_233666 = {.desc ="mem_233666", .mem =
                                  futhark_mc_task_236627->retval_mem_233666,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_233849_cached_sizze_236629 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233849 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_233849_cached_sizze_236629 <
        (size_t) ((int64_t) 8 * num_tasks_233848)) {
        reduce_stage_1_tid_res_arr_mem_233849 =
            realloc(reduce_stage_1_tid_res_arr_mem_233849, (int64_t) 8 *
                    num_tasks_233848);
        reduce_stage_1_tid_res_arr_mem_233849_cached_sizze_236629 =
            (int64_t) 8 * num_tasks_233848;
    }
    
    int64_t iter_233851;
    struct futhark_mc_segred_stage_1_parloop_struct_236630
    futhark_mc_segred_stage_1_parloop_struct_236630;
    
    futhark_mc_segred_stage_1_parloop_struct_236630.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_gtid_214882 =
        gtid_214882;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_x_214887 = x_214887;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_mem_217458 =
        mem_217458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_mem_220216 =
        mem_220216.mem;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_x_233661 = x_233661;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_x_233662 = x_233662;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_defunc_0_g_res_233665 =
        defunc_0_g_res_233665;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_mem_233666 =
        mem_233666.mem;
    futhark_mc_segred_stage_1_parloop_struct_236630.free_reduce_stage_1_tid_res_arr_mem_233849 =
        reduce_stage_1_tid_res_arr_mem_233849;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236631_task;
    
    futhark_mc_segred_stage_1_parloop_236631_task.name =
        "futhark_mc_segred_stage_1_parloop_236631";
    futhark_mc_segred_stage_1_parloop_236631_task.fn =
        futhark_mc_segred_stage_1_parloop_236631;
    futhark_mc_segred_stage_1_parloop_236631_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236630;
    futhark_mc_segred_stage_1_parloop_236631_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236631_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236631_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236631_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236631_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236631_task);
    
    if (futhark_mc_segred_stage_1_parloop_236631_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236631_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236631_total_end -
                 futhark_mc_segred_stage_1_parloop_236631_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236631_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236631_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236631_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_233667 = 0.0;
    }
    
    double x_233853;
    double x_233854;
    
    for (int32_t i_233856 = 0; i_233856 < num_tasks_233848; i_233856++) {
        flat_tid_233811 = i_233856;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_233853 = defunc_2_reduce_res_233667;
            }
            // load next params
            {
                x_233854 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233849)[flat_tid_233811];
            }
            // red body
            {
                double defunc_1_op_res_233855 = x_233853 + x_233854;
                
                defunc_2_reduce_res_233667 = defunc_1_op_res_233855;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_233849);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236628_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236628_end -
                 futhark_mc_segred_task_236628_start;
        
        ctx->futhark_mc_segred_task_236628_runs[tid]++;
        ctx->futhark_mc_segred_task_236628_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236628_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236627->retval_defunc_2_reduce_res_233667 =
            defunc_2_reduce_res_233667;
        futhark_mc_task_236627->retval_mem_233666 = mem_233666.mem;
    }
    return err;
}
struct futhark_mc_task_236632 {
    struct futhark_context *ctx;
    int64_t free_x_214887;
    unsigned char *free_mem_220219;
    int64_t free_x_233661;
    unsigned char *free_mem_233666;
    double free_a0_233692;
    double *retval_defunc_2_reduce_res_233693;
};
struct futhark_mc_segred_stage_1_parloop_struct_236635 {
    struct futhark_context *ctx;
    int64_t free_x_214887;
    unsigned char *free_mem_220219;
    int64_t free_x_233661;
    unsigned char *free_mem_233666;
    double free_a0_233692;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_233858;
};
static int futhark_mc_segred_stage_1_parloop_236636(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_233834,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236635
    *futhark_mc_segred_stage_1_parloop_struct_236635 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236635 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236635->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236636_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236636_start = get_wall_time();
    
    int64_t x_214887 =
            futhark_mc_segred_stage_1_parloop_struct_236635->free_x_214887;
    struct memblock mem_220219 = {.desc ="mem_220219", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236635->free_mem_220219,
                                  .size =0, .references =NULL};
    int64_t x_233661 =
            futhark_mc_segred_stage_1_parloop_struct_236635->free_x_233661;
    struct memblock mem_233666 = {.desc ="mem_233666", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236635->free_mem_233666,
                                  .size =0, .references =NULL};
    double a0_233692 =
           futhark_mc_segred_stage_1_parloop_struct_236635->free_a0_233692;
    struct memblock reduce_stage_1_tid_res_arr_mem_233858 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_233858",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236635->free_reduce_stage_1_tid_res_arr_mem_233858,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_233860 = start;
    double x_233836;
    double x_233837;
    double local_acc_233861 = 0.0;
    
    for (; iter_233860 < end; iter_233860++) {
        int64_t gtid_233835 = iter_233860;
        double x_233839;
        
        x_233839 = ((double *) mem_233666.mem)[gtid_233835];
        
        bool cond_233840 = sle64(x_214887, gtid_233835);
        double defunc_0_f_res_233841;
        
        if (cond_233840) {
            defunc_0_f_res_233841 = 0.0;
        } else {
            int64_t i_233842 = add64(x_233661, gtid_233835);
            double defunc_0_add_arg_233843;
            
            defunc_0_add_arg_233843 = ((double *) mem_220219.mem)[i_233842];
            defunc_0_f_res_233841 = defunc_0_add_arg_233843;
        }
        
        double x_233844 = a0_233692 * x_233839;
        double defunc_9_fit_fun_res_233845 = defunc_0_f_res_233841 * x_233844;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_233836 = local_acc_233861;
        }
        // Load next params
        {
            x_233837 = defunc_9_fit_fun_res_233845;
        }
        // Red body
        {
            double defunc_1_op_res_233838 = x_233836 + x_233837;
            
            local_acc_233861 = defunc_1_op_res_233838;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_233858.mem)[flat_tid_233834] =
        local_acc_233861;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236636_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236636_end -
                 futhark_mc_segred_stage_1_parloop_236636_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236636_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236636_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236636_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236633(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233834 = tid;
    int num_tasks_233857 = info.nsubtasks;
    struct futhark_mc_task_236632 *futhark_mc_task_236632 =
                                  (struct futhark_mc_task_236632 *) args;
    struct futhark_context *ctx = futhark_mc_task_236632->ctx;
    uint64_t futhark_mc_segred_task_236633_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236633_start = get_wall_time();
    
    int64_t x_214887 = futhark_mc_task_236632->free_x_214887;
    struct memblock mem_220219 = {.desc ="mem_220219", .mem =
                                  futhark_mc_task_236632->free_mem_220219,
                                  .size =0, .references =NULL};
    int64_t x_233661 = futhark_mc_task_236632->free_x_233661;
    struct memblock mem_233666 = {.desc ="mem_233666", .mem =
                                  futhark_mc_task_236632->free_mem_233666,
                                  .size =0, .references =NULL};
    double a0_233692 = futhark_mc_task_236632->free_a0_233692;
    double defunc_2_reduce_res_233693 =
           *futhark_mc_task_236632->retval_defunc_2_reduce_res_233693;
    size_t reduce_stage_1_tid_res_arr_mem_233858_cached_sizze_236634 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_233858 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_233858_cached_sizze_236634 <
        (size_t) ((int64_t) 8 * num_tasks_233857)) {
        reduce_stage_1_tid_res_arr_mem_233858 =
            realloc(reduce_stage_1_tid_res_arr_mem_233858, (int64_t) 8 *
                    num_tasks_233857);
        reduce_stage_1_tid_res_arr_mem_233858_cached_sizze_236634 =
            (int64_t) 8 * num_tasks_233857;
    }
    
    int64_t iter_233860;
    struct futhark_mc_segred_stage_1_parloop_struct_236635
    futhark_mc_segred_stage_1_parloop_struct_236635;
    
    futhark_mc_segred_stage_1_parloop_struct_236635.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236635.free_x_214887 = x_214887;
    futhark_mc_segred_stage_1_parloop_struct_236635.free_mem_220219 =
        mem_220219.mem;
    futhark_mc_segred_stage_1_parloop_struct_236635.free_x_233661 = x_233661;
    futhark_mc_segred_stage_1_parloop_struct_236635.free_mem_233666 =
        mem_233666.mem;
    futhark_mc_segred_stage_1_parloop_struct_236635.free_a0_233692 = a0_233692;
    futhark_mc_segred_stage_1_parloop_struct_236635.free_reduce_stage_1_tid_res_arr_mem_233858 =
        reduce_stage_1_tid_res_arr_mem_233858;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236636_task;
    
    futhark_mc_segred_stage_1_parloop_236636_task.name =
        "futhark_mc_segred_stage_1_parloop_236636";
    futhark_mc_segred_stage_1_parloop_236636_task.fn =
        futhark_mc_segred_stage_1_parloop_236636;
    futhark_mc_segred_stage_1_parloop_236636_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236635;
    futhark_mc_segred_stage_1_parloop_236636_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236636_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236636_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236636_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236636_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236636_task);
    
    if (futhark_mc_segred_stage_1_parloop_236636_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236636_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236636_total_end -
                 futhark_mc_segred_stage_1_parloop_236636_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236636_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236636_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236636_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_233693 = 0.0;
    }
    
    double x_233862;
    double x_233863;
    
    for (int32_t i_233865 = 0; i_233865 < num_tasks_233857; i_233865++) {
        flat_tid_233834 = i_233865;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_233862 = defunc_2_reduce_res_233693;
            }
            // load next params
            {
                x_233863 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_233858)[flat_tid_233834];
            }
            // red body
            {
                double defunc_1_op_res_233864 = x_233862 + x_233863;
                
                defunc_2_reduce_res_233693 = defunc_1_op_res_233864;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_233858);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236633_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236633_end -
                 futhark_mc_segred_task_236633_start;
        
        ctx->futhark_mc_segred_task_236633_runs[tid]++;
        ctx->futhark_mc_segred_task_236633_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236633_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236632->retval_defunc_2_reduce_res_233693 =
            defunc_2_reduce_res_233693;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236625(void *args, int64_t start,
                                            int64_t end, int flat_tid_233659,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236624
    *futhark_mc_segmap_parloop_struct_236624 =
    (struct futhark_mc_segmap_parloop_struct_236624 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236624->ctx;
    uint64_t futhark_mc_segmap_parloop_236625_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236625_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236624->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236624->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236624->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236624->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236624->free_i_203760;
    int64_t gtid_214882 =
            futhark_mc_segmap_parloop_struct_236624->free_gtid_214882;
    int64_t x_214887 = futhark_mc_segmap_parloop_struct_236624->free_x_214887;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236624->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236624->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236624->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220216 = {.desc ="mem_220216", .mem =
                                  futhark_mc_segmap_parloop_struct_236624->free_mem_220216,
                                  .size =0, .references =NULL};
    struct memblock mem_220219 = {.desc ="mem_220219", .mem =
                                  futhark_mc_segmap_parloop_struct_236624->free_mem_220219,
                                  .size =0, .references =NULL};
    int64_t bytes_220221 =
            futhark_mc_segmap_parloop_struct_236624->free_bytes_220221;
    struct memblock mem_220240 = {.desc ="mem_220240", .mem =
                                  futhark_mc_segmap_parloop_struct_236624->free_mem_220240,
                                  .size =0, .references =NULL};
    size_t mem_233666_cached_sizze_236626 = 0;
    unsigned char *mem_233666 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233810 = start;
    
    if (mem_233666_cached_sizze_236626 < (size_t) bytes_220221) {
        mem_233666 = realloc(mem_233666, bytes_220221);
        mem_233666_cached_sizze_236626 = bytes_220221;
    }
    for (; iter_233810 < end; iter_233810++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233846 = t_n_m_203740;
        int64_t gtid_233660 = iter_233810;
        int64_t remnant_233847 = iter_233810 - gtid_233660;
        int64_t x_233661;
        
        x_233661 = ((int64_t *) mem_217953.mem)[gtid_214882 * t_n_m_203740 +
                                                gtid_233660];
        
        double x_233662;
        
        x_233662 = ((double *) mem_217957.mem)[gtid_214882 * t_n_m_203740 +
                                               gtid_233660];
        
        int64_t min_arg_233663 = mul64(jump_t_203582, gtid_233660);
        int64_t min_res_233664 = smin64(i_203760, min_arg_233663);
        int64_t defunc_0_g_res_233665 = add64((int64_t) 1, min_res_233664);
        double defunc_2_reduce_res_233667;
        int64_t flat_tid_233811 = (int64_t) 0;
        int32_t num_tasks_233848;
        
        defunc_2_reduce_res_233667 = 0.0;
        
        struct futhark_mc_task_236627 futhark_mc_task_236627;
        
        futhark_mc_task_236627.ctx = ctx;
        futhark_mc_task_236627.free_n_203572 = n_203572;
        futhark_mc_task_236627.free_gtid_214882 = gtid_214882;
        futhark_mc_task_236627.free_x_214887 = x_214887;
        futhark_mc_task_236627.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236627.free_mem_220216 = mem_220216.mem;
        futhark_mc_task_236627.free_x_233661 = x_233661;
        futhark_mc_task_236627.free_x_233662 = x_233662;
        futhark_mc_task_236627.free_defunc_0_g_res_233665 =
            defunc_0_g_res_233665;
        futhark_mc_task_236627.retval_defunc_2_reduce_res_233667 =
            &defunc_2_reduce_res_233667;
        futhark_mc_task_236627.retval_mem_233666 = mem_233666;
        
        struct scheduler_segop futhark_mc_task_236627_task;
        
        futhark_mc_task_236627_task.args = &futhark_mc_task_236627;
        futhark_mc_task_236627_task.top_level_fn =
            futhark_mc_segred_task_236628;
        futhark_mc_task_236627_task.name = "futhark_mc_segred_task_236628";
        futhark_mc_task_236627_task.iterations = q_t_203576;
        futhark_mc_task_236627_task.task_time =
            &ctx->futhark_mc_segred_task_236628_total_time;
        futhark_mc_task_236627_task.task_iter =
            &ctx->futhark_mc_segred_task_236628_total_iter;
        futhark_mc_task_236627_task.sched = STATIC;
        futhark_mc_task_236627_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236628_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236627_task);
        
        if (futhark_mc_segred_task_236628_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double a0_233692 = 1.0 / defunc_2_reduce_res_233667;
        double defunc_2_reduce_res_233693;
        int64_t flat_tid_233834 = (int64_t) 0;
        int32_t num_tasks_233857;
        
        defunc_2_reduce_res_233693 = 0.0;
        
        struct futhark_mc_task_236632 futhark_mc_task_236632;
        
        futhark_mc_task_236632.ctx = ctx;
        futhark_mc_task_236632.free_x_214887 = x_214887;
        futhark_mc_task_236632.free_mem_220219 = mem_220219.mem;
        futhark_mc_task_236632.free_x_233661 = x_233661;
        futhark_mc_task_236632.free_mem_233666 = mem_233666;
        futhark_mc_task_236632.free_a0_233692 = a0_233692;
        futhark_mc_task_236632.retval_defunc_2_reduce_res_233693 =
            &defunc_2_reduce_res_233693;
        
        struct scheduler_segop futhark_mc_task_236632_task;
        
        futhark_mc_task_236632_task.args = &futhark_mc_task_236632;
        futhark_mc_task_236632_task.top_level_fn =
            futhark_mc_segred_task_236633;
        futhark_mc_task_236632_task.name = "futhark_mc_segred_task_236633";
        futhark_mc_task_236632_task.iterations = q_t_203576;
        futhark_mc_task_236632_task.task_time =
            &ctx->futhark_mc_segred_task_236633_total_time;
        futhark_mc_task_236632_task.task_iter =
            &ctx->futhark_mc_segred_task_236633_total_iter;
        futhark_mc_task_236632_task.sched = STATIC;
        futhark_mc_task_236632_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236633_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236632_task);
        
        if (futhark_mc_segred_task_236633_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_220240.mem)[gtid_233660] = defunc_2_reduce_res_233693;
    }
    
  cleanup:
    { }
    free(mem_233666);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236625_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236625_end -
                 futhark_mc_segmap_parloop_236625_start;
        
        ctx->futhark_mc_segmap_parloop_236625_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236625_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236625_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236623(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233659 = tid;
    int num_tasks_233770 = info.nsubtasks;
    struct futhark_mc_task_236618 *futhark_mc_task_236618 =
                                  (struct futhark_mc_task_236618 *) args;
    struct futhark_context *ctx = futhark_mc_task_236618->ctx;
    uint64_t futhark_mc_segmap_nested_task_236623_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236623_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236618->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236618->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236618->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236618->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236618->free_i_203760;
    int64_t gtid_214882 = futhark_mc_task_236618->free_gtid_214882;
    int64_t x_214887 = futhark_mc_task_236618->free_x_214887;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236618->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236618->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236618->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220216 = {.desc ="mem_220216", .mem =
                                  futhark_mc_task_236618->free_mem_220216,
                                  .size =0, .references =NULL};
    struct memblock mem_220219 = {.desc ="mem_220219", .mem =
                                  futhark_mc_task_236618->free_mem_220219,
                                  .size =0, .references =NULL};
    int64_t bytes_220221 = futhark_mc_task_236618->free_bytes_220221;
    struct memblock mem_220240 = {.desc ="mem_220240", .mem =
                                  futhark_mc_task_236618->free_mem_220240,
                                  .size =0, .references =NULL};
    int64_t iter_233810;
    struct futhark_mc_segmap_parloop_struct_236624
    futhark_mc_segmap_parloop_struct_236624;
    
    futhark_mc_segmap_parloop_struct_236624.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236624.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236624.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236624.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236624.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236624.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236624.free_gtid_214882 = gtid_214882;
    futhark_mc_segmap_parloop_struct_236624.free_x_214887 = x_214887;
    futhark_mc_segmap_parloop_struct_236624.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236624.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236624.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236624.free_mem_220216 = mem_220216.mem;
    futhark_mc_segmap_parloop_struct_236624.free_mem_220219 = mem_220219.mem;
    futhark_mc_segmap_parloop_struct_236624.free_bytes_220221 = bytes_220221;
    futhark_mc_segmap_parloop_struct_236624.free_mem_220240 = mem_220240.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236625_task;
    
    futhark_mc_segmap_parloop_236625_task.name =
        "futhark_mc_segmap_parloop_236625";
    futhark_mc_segmap_parloop_236625_task.fn = futhark_mc_segmap_parloop_236625;
    futhark_mc_segmap_parloop_236625_task.args =
        &futhark_mc_segmap_parloop_struct_236624;
    futhark_mc_segmap_parloop_236625_task.iterations = iterations;
    futhark_mc_segmap_parloop_236625_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236625_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236625_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236625_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236625_task);
    
    if (futhark_mc_segmap_parloop_236625_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236625_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236625_total_end -
                 futhark_mc_segmap_parloop_236625_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236625_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236625_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236625_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236623_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236623_end -
                 futhark_mc_segmap_nested_task_236623_start;
        
        ctx->futhark_mc_segmap_nested_task_236623_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236623_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236623_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236605(void *args, int64_t start,
                                            int64_t end, int flat_tid_214881,
                                            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_203572 = futhark_mc_segmap_parloop_struct_236604->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236604->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236604->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236604->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236604->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236604->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236604->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236604->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236604->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236604->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236604->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236604->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236604->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236604->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236604->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236604->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236604->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236604->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220221 =
            futhark_mc_segmap_parloop_struct_236604->free_bytes_220221;
    struct memblock mem_220319 = {.desc ="mem_220319", .mem =
                                  futhark_mc_segmap_parloop_struct_236604->free_mem_220319,
                                  .size =0, .references =NULL};
    size_t mem_220213_cached_sizze_236606 = 0;
    unsigned char *mem_220213 = NULL;
    size_t mem_220216_cached_sizze_236607 = 0;
    unsigned char *mem_220216 = NULL;
    size_t mem_220219_cached_sizze_236608 = 0;
    unsigned char *mem_220219 = NULL;
    size_t mem_220240_cached_sizze_236609 = 0;
    unsigned char *mem_220240 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233639 = start;
    
    if (mem_220213_cached_sizze_236606 < (size_t) bytes_217420) {
        mem_220213 = realloc(mem_220213, bytes_217420);
        mem_220213_cached_sizze_236606 = bytes_217420;
    }
    if (mem_220216_cached_sizze_236607 < (size_t) bytes_217420) {
        mem_220216 = realloc(mem_220216, bytes_217420);
        mem_220216_cached_sizze_236607 = bytes_217420;
    }
    if (mem_220219_cached_sizze_236608 < (size_t) bytes_217420) {
        mem_220219 = realloc(mem_220219, bytes_217420);
        mem_220219_cached_sizze_236608 = bytes_217420;
    }
    if (mem_220240_cached_sizze_236609 < (size_t) bytes_217900) {
        mem_220240 = realloc(mem_220240, bytes_217900);
        mem_220240_cached_sizze_236609 = bytes_217900;
    }
    for (; iter_233639 < end; iter_233639++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233752 = partition_sizze_203667;
        int64_t gtid_214882 = iter_233639;
        int64_t remnant_233753 = iter_233639 - gtid_214882;
        int64_t x_214887;
        
        x_214887 = ((int64_t *) mem_217461.mem)[gtid_214882];
        
        int64_t flat_tid_233640 = (int64_t) 0;
        int32_t num_tasks_233754;
        struct futhark_mc_task_236610 futhark_mc_task_236610;
        
        futhark_mc_task_236610.ctx = ctx;
        futhark_mc_task_236610.free_n_203572 = n_203572;
        futhark_mc_task_236610.free_gtid_214882 = gtid_214882;
        futhark_mc_task_236610.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_236610.free_mem_219926 = mem_219926.mem;
        futhark_mc_task_236610.free_mem_220213 = mem_220213;
        
        struct scheduler_segop futhark_mc_task_236610_task;
        
        futhark_mc_task_236610_task.args = &futhark_mc_task_236610;
        futhark_mc_task_236610_task.top_level_fn =
            futhark_mc_segmap_task_236611;
        futhark_mc_task_236610_task.name = "futhark_mc_segmap_task_236611";
        futhark_mc_task_236610_task.iterations = n_203572;
        futhark_mc_task_236610_task.task_time =
            &ctx->futhark_mc_segmap_task_236611_total_time;
        futhark_mc_task_236610_task.task_iter =
            &ctx->futhark_mc_segmap_task_236611_total_iter;
        futhark_mc_task_236610_task.sched = STATIC;
        futhark_mc_task_236610_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236611_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236610_task);
        
        if (futhark_mc_segmap_task_236611_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233645 = (int64_t) 0;
        int32_t num_tasks_233758;
        struct futhark_mc_task_236614 futhark_mc_task_236614;
        
        futhark_mc_task_236614.ctx = ctx;
        futhark_mc_task_236614.free_n_203572 = n_203572;
        futhark_mc_task_236614.free_gtid_214882 = gtid_214882;
        futhark_mc_task_236614.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236614.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236614.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236614.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236614.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236614.free_mem_220213 = mem_220213;
        futhark_mc_task_236614.free_mem_220216 = mem_220216;
        futhark_mc_task_236614.free_mem_220219 = mem_220219;
        
        struct scheduler_segop futhark_mc_task_236614_task;
        
        futhark_mc_task_236614_task.args = &futhark_mc_task_236614;
        futhark_mc_task_236614_task.top_level_fn =
            futhark_mc_segmap_task_236615;
        futhark_mc_task_236614_task.name = "futhark_mc_segmap_task_236615";
        futhark_mc_task_236614_task.iterations = n_203572;
        futhark_mc_task_236614_task.task_time =
            &ctx->futhark_mc_segmap_task_236615_total_time;
        futhark_mc_task_236614_task.task_iter =
            &ctx->futhark_mc_segmap_task_236615_total_iter;
        futhark_mc_task_236614_task.sched = STATIC;
        futhark_mc_task_236614_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236615_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236614_task);
        
        if (futhark_mc_segmap_task_236615_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233706 = (int64_t) 0;
        int32_t num_tasks_233770;
        int64_t flat_tid_233659 = (int64_t) 0;
        struct futhark_mc_task_236618 futhark_mc_task_236618;
        
        futhark_mc_task_236618.ctx = ctx;
        futhark_mc_task_236618.free_n_203572 = n_203572;
        futhark_mc_task_236618.free_q_t_203576 = q_t_203576;
        futhark_mc_task_236618.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236618.free_t_n_m_203740 = t_n_m_203740;
        futhark_mc_task_236618.free_i_203760 = i_203760;
        futhark_mc_task_236618.free_gtid_214882 = gtid_214882;
        futhark_mc_task_236618.free_x_214887 = x_214887;
        futhark_mc_task_236618.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236618.free_mem_217953 = mem_217953.mem;
        futhark_mc_task_236618.free_mem_217957 = mem_217957.mem;
        futhark_mc_task_236618.free_mem_220216 = mem_220216;
        futhark_mc_task_236618.free_mem_220219 = mem_220219;
        futhark_mc_task_236618.free_bytes_220221 = bytes_220221;
        futhark_mc_task_236618.free_mem_220240 = mem_220240;
        
        struct scheduler_segop futhark_mc_task_236618_task;
        
        futhark_mc_task_236618_task.args = &futhark_mc_task_236618;
        futhark_mc_task_236618_task.top_level_fn =
            futhark_mc_segmap_task_236619;
        futhark_mc_task_236618_task.name = "futhark_mc_segmap_task_236619";
        futhark_mc_task_236618_task.iterations = t_n_m_203740;
        futhark_mc_task_236618_task.task_time =
            &ctx->futhark_mc_segmap_task_236619_total_time;
        futhark_mc_task_236618_task.task_iter =
            &ctx->futhark_mc_segmap_task_236619_total_iter;
        futhark_mc_task_236618_task.sched = STATIC;
        futhark_mc_task_236618_task.nested_fn =
            futhark_mc_segmap_nested_task_236623;
        
        int futhark_mc_segmap_task_236619_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236618_task);
        
        if (futhark_mc_segmap_task_236619_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220319.mem + gtid_214882 * t_n_m_203740 * (int64_t) 8,
                    mem_220240 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220213);
    free(mem_220216);
    free(mem_220219);
    free(mem_220240);
    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_nested_task_236603(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_214881 = tid;
    int num_tasks_233559 = 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_nested_task_236603_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236603_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236594->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236594->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236594->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236594->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236594->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236594->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236594->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236594->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236594->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236594->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236594->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236594->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236594->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236594->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236594->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236594->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236594->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236594->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220221 = futhark_mc_task_236594->free_bytes_220221;
    struct memblock mem_220319 = {.desc ="mem_220319", .mem =
                                  futhark_mc_task_236594->free_mem_220319,
                                  .size =0, .references =NULL};
    int64_t iter_233639;
    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_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236604.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236604.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236604.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236604.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236604.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236604.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236604.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236604.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236604.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236604.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236604.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236604.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236604.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236604.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236604.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236604.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236604.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236604.free_bytes_220221 = bytes_220221;
    futhark_mc_segmap_parloop_struct_236604.free_mem_220319 = mem_220319.mem;
    
    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_nested_task_236603_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236603_end -
                 futhark_mc_segmap_nested_task_236603_start;
        
        ctx->futhark_mc_segmap_nested_task_236603_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236603_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236603_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236637 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    int64_t free_bytes_220330;
    unsigned char *free_mem_220479;
    unsigned char *free_mem_220483;
};
struct futhark_mc_segmap_parloop_struct_236639 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    int64_t free_bytes_220330;
    unsigned char *free_mem_220479;
    unsigned char *free_mem_220483;
};
static int futhark_mc_segmap_parloop_236640(void *args, int64_t start,
                                            int64_t end, int flat_tid_215007,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236639
    *futhark_mc_segmap_parloop_struct_236639 =
    (struct futhark_mc_segmap_parloop_struct_236639 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236639->ctx;
    uint64_t futhark_mc_segmap_parloop_236640_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236640_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236639->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236639->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236639->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236639->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236639->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236639->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236639->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236639->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236639->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236639->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236639->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236639->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236639->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236639->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236639->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236639->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236639->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236639->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220330 =
            futhark_mc_segmap_parloop_struct_236639->free_bytes_220330;
    struct memblock mem_220479 = {.desc ="mem_220479", .mem =
                                  futhark_mc_segmap_parloop_struct_236639->free_mem_220479,
                                  .size =0, .references =NULL};
    struct memblock mem_220483 = {.desc ="mem_220483", .mem =
                                  futhark_mc_segmap_parloop_struct_236639->free_mem_220483,
                                  .size =0, .references =NULL};
    size_t mem_220373_cached_sizze_236641 = 0;
    unsigned char *mem_220373 = NULL;
    size_t mem_220388_cached_sizze_236642 = 0;
    unsigned char *mem_220388 = NULL;
    size_t mem_220391_cached_sizze_236643 = 0;
    unsigned char *mem_220391 = NULL;
    size_t mem_220418_cached_sizze_236644 = 0;
    unsigned char *mem_220418 = NULL;
    size_t mem_220421_cached_sizze_236645 = 0;
    unsigned char *mem_220421 = NULL;
    size_t mem_220438_cached_sizze_236646 = 0;
    unsigned char *mem_220438 = NULL;
    size_t mem_220441_cached_sizze_236647 = 0;
    unsigned char *mem_220441 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233867 = start;
    
    if (mem_220373_cached_sizze_236641 < (size_t) bytes_217420) {
        mem_220373 = realloc(mem_220373, bytes_217420);
        mem_220373_cached_sizze_236641 = bytes_217420;
    }
    if (mem_220388_cached_sizze_236642 < (size_t) bytes_217420) {
        mem_220388 = realloc(mem_220388, bytes_217420);
        mem_220388_cached_sizze_236642 = bytes_217420;
    }
    if (mem_220391_cached_sizze_236643 < (size_t) bytes_217420) {
        mem_220391 = realloc(mem_220391, bytes_217420);
        mem_220391_cached_sizze_236643 = bytes_217420;
    }
    if (mem_220418_cached_sizze_236644 < (size_t) bytes_217900) {
        mem_220418 = realloc(mem_220418, bytes_217900);
        mem_220418_cached_sizze_236644 = bytes_217900;
    }
    if (mem_220421_cached_sizze_236645 < (size_t) bytes_217900) {
        mem_220421 = realloc(mem_220421, bytes_217900);
        mem_220421_cached_sizze_236645 = bytes_217900;
    }
    if (mem_220438_cached_sizze_236646 < (size_t) bytes_220330) {
        mem_220438 = realloc(mem_220438, bytes_220330);
        mem_220438_cached_sizze_236646 = bytes_220330;
    }
    if (mem_220441_cached_sizze_236647 < (size_t) bytes_220330) {
        mem_220441 = realloc(mem_220441, bytes_220330);
        mem_220441_cached_sizze_236647 = bytes_220330;
    }
    for (; iter_233867 < end; iter_233867++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_233968 = partition_sizze_203667;
        int64_t gtid_215008 = iter_233867;
        int64_t remnant_233969 = iter_233867 - gtid_215008;
        int64_t x_206391;
        
        x_206391 = ((int64_t *) mem_217461.mem)[gtid_215008];
        for (int64_t i_233868 = 0; i_233868 < n_203572; i_233868++) {
            double x_233870;
            
            x_233870 = ((double *) mem_217415.mem)[gtid_215008 * n_203572 +
                                                   i_233868];
            
            double x_233871;
            
            x_233871 = ((double *) mem_219926.mem)[gtid_215008 * n_203572 +
                                                   i_233868];
            
            double defunc_1_f_res_233872 = x_233870 - x_233871;
            
            ((double *) mem_220373)[i_233868] = defunc_1_f_res_233872;
        }
        for (int64_t i_233874 = 0; i_233874 < n_203572; i_233874++) {
            int64_t x_233877;
            
            x_233877 = ((int64_t *) mem_217458.mem)[gtid_215008 * n_203572 +
                                                    i_233874];
            
            bool cond_233878 = sle64((int64_t) 0, x_233877);
            double defunc_0_f_res_233879;
            
            if (cond_233878) {
                bool y_233880 = slt64(x_233877, n_203572);
                bool bounds_check_233881 = cond_233878 && y_233880;
                bool index_certs_233882;
                
                if (!bounds_check_233881) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_233877,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_233883;
                
                defunc_0_f_res_t_res_233883 = ((double *) mem_220373)[x_233877];
                defunc_0_f_res_233879 = defunc_0_f_res_t_res_233883;
            } else {
                defunc_0_f_res_233879 = 0.0;
            }
            
            double defunc_0_f_res_233884;
            
            if (cond_233878) {
                bool y_233885 = slt64(x_233877, n_203572);
                bool bounds_check_233886 = cond_233878 && y_233885;
                bool index_certs_233887;
                
                if (!bounds_check_233886) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_233877,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_233888;
                
                defunc_0_f_res_t_res_233888 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_215008 *
                                                       ctx_param_ext_217985 +
                                                       x_233877 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_233884 = defunc_0_f_res_t_res_233888;
            } else {
                defunc_0_f_res_233884 = 0.0;
            }
            ((double *) mem_220388)[i_233874] = defunc_0_f_res_233884;
            ((double *) mem_220391)[i_233874] = defunc_0_f_res_233879;
        }
        for (int64_t i_233891 = 0; i_233891 < t_n_m_203740; i_233891++) {
            int64_t x_233894;
            
            x_233894 = ((int64_t *) mem_217953.mem)[gtid_215008 * t_n_m_203740 +
                                                    i_233891];
            
            double x_233895;
            
            x_233895 = ((double *) mem_217957.mem)[gtid_215008 * t_n_m_203740 +
                                                   i_233891];
            
            int64_t min_arg_233896 = mul64(jump_t_203582, i_233891);
            int64_t min_res_233897 = smin64(i_203760, min_arg_233896);
            int64_t defunc_0_g_res_233898 = add64((int64_t) 1, min_res_233897);
            double defunc_2_reduce_res_233901;
            double defunc_2_reduce_res_233902;
            double defunc_2_reduce_res_233903;
            double redout_233907;
            double redout_233908;
            double redout_233909;
            
            redout_233907 = 0.0;
            redout_233908 = 0.0;
            redout_233909 = 0.0;
            for (int64_t i_233906 = 0; i_233906 < q_t_203576; i_233906++) {
                bool cond_233912 = sle64(x_206391, i_233906);
                int64_t defunc_0_f_res_233913;
                
                if (cond_233912) {
                    defunc_0_f_res_233913 = (int64_t) 0;
                } else {
                    int64_t i_233914 = add64(x_233894, i_233906);
                    int64_t defunc_0_add_arg_233915;
                    
                    defunc_0_add_arg_233915 =
                        ((int64_t *) mem_217458.mem)[gtid_215008 * n_203572 +
                                                     i_233914];
                    
                    int64_t defunc_1_add_res_233916 = add64((int64_t) 1,
                                                            defunc_0_add_arg_233915);
                    
                    defunc_0_f_res_233913 = defunc_1_add_res_233916;
                }
                
                double defunc_0_f_res_233917;
                
                if (cond_233912) {
                    defunc_0_f_res_233917 = 0.0;
                } else {
                    int64_t i_233918 = add64(x_233894, i_233906);
                    double defunc_0_add_arg_233919;
                    
                    defunc_0_add_arg_233919 = ((double *) mem_220388)[i_233918];
                    defunc_0_f_res_233917 = defunc_0_add_arg_233919;
                }
                
                int64_t binop_p_233920 = sub64(defunc_0_f_res_233913,
                                               defunc_0_g_res_233898);
                double defunc_0_f_res_233921 = sitofp_i64_f64(binop_p_233920);
                double abs_res_233922 = fabs(defunc_0_f_res_233921);
                double tmp1_233923 = abs_res_233922 / x_233895;
                double x_233924 = tmp1_233923 * tmp1_233923;
                double y_233925 = tmp1_233923 * x_233924;
                double tmp2_233926 = 1.0 - y_233925;
                double x_233927 = tmp2_233926 * tmp2_233926;
                double tmp3_233928 = tmp2_233926 * x_233927;
                double tmp4_233929 = defunc_0_f_res_233917 * tmp3_233928;
                double defunc_1_f_res_233930 = defunc_0_f_res_233921 *
                       tmp4_233929;
                double defunc_1_f_res_233931 = defunc_0_f_res_233921 *
                       defunc_1_f_res_233930;
                double defunc_1_op_res_233932 = tmp4_233929 + redout_233907;
                double defunc_1_op_res_233933 = defunc_1_f_res_233930 +
                       redout_233908;
                double defunc_1_op_res_233934 = defunc_1_f_res_233931 +
                       redout_233909;
                
                ((double *) mem_220438)[i_233906] = defunc_1_f_res_233930;
                ((double *) mem_220441)[i_233906] = tmp4_233929;
                
                double redout_tmp_233975 = defunc_1_op_res_233932;
                double redout_tmp_233976 = defunc_1_op_res_233933;
                double redout_tmp_233977 = defunc_1_op_res_233934;
                
                redout_233907 = redout_tmp_233975;
                redout_233908 = redout_tmp_233976;
                redout_233909 = redout_tmp_233977;
            }
            defunc_2_reduce_res_233901 = redout_233907;
            defunc_2_reduce_res_233902 = redout_233908;
            defunc_2_reduce_res_233903 = redout_233909;
            
            double x_233937 = defunc_2_reduce_res_233901 *
                   defunc_2_reduce_res_233903;
            double y_233938 = defunc_2_reduce_res_233902 *
                   defunc_2_reduce_res_233902;
            double y_233939 = x_233937 - y_233938;
            double det1_233940 = 1.0 / y_233939;
            double a11_233941 = defunc_2_reduce_res_233903 * det1_233940;
            double x_233942 = 0.0 - defunc_2_reduce_res_233902;
            double b11_233943 = det1_233940 * x_233942;
            double c11_233944 = defunc_2_reduce_res_233901 * det1_233940;
            double defunc_2_reduce_res_233945;
            double defunc_2_reduce_res_233946;
            double redout_233948;
            double redout_233949;
            
            redout_233948 = 0.0;
            redout_233949 = 0.0;
            for (int64_t i_233947 = 0; i_233947 < q_t_203576; i_233947++) {
                double x_233950;
                
                x_233950 = ((double *) mem_220441)[i_233947];
                
                double x_233951;
                
                x_233951 = ((double *) mem_220438)[i_233947];
                
                bool cond_233952 = sle64(x_206391, i_233947);
                double defunc_0_f_res_233953;
                
                if (cond_233952) {
                    defunc_0_f_res_233953 = 0.0;
                } else {
                    int64_t i_233954 = add64(x_233894, i_233947);
                    double defunc_0_add_arg_233955;
                    
                    defunc_0_add_arg_233955 = ((double *) mem_220391)[i_233954];
                    defunc_0_f_res_233953 = defunc_0_add_arg_233955;
                }
                
                double x_233956 = a11_233941 * x_233950;
                double y_233957 = b11_233943 * x_233951;
                double x_233958 = x_233956 + y_233957;
                double defunc_9_fit_fun_res_233959 = defunc_0_f_res_233953 *
                       x_233958;
                double x_233960 = b11_233943 * x_233950;
                double y_233961 = c11_233944 * x_233951;
                double x_233962 = x_233960 + y_233961;
                double defunc_9_slope_fun_res_233963 = defunc_0_f_res_233953 *
                       x_233962;
                double defunc_1_op_res_233964 = defunc_9_fit_fun_res_233959 +
                       redout_233948;
                double defunc_1_op_res_233965 = defunc_9_slope_fun_res_233963 +
                       redout_233949;
                double redout_tmp_233980 = defunc_1_op_res_233964;
                double redout_tmp_233981 = defunc_1_op_res_233965;
                
                redout_233948 = redout_tmp_233980;
                redout_233949 = redout_tmp_233981;
            }
            defunc_2_reduce_res_233945 = redout_233948;
            defunc_2_reduce_res_233946 = redout_233949;
            ((double *) mem_220418)[i_233891] = defunc_2_reduce_res_233945;
            ((double *) mem_220421)[i_233891] = defunc_2_reduce_res_233946;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220479.mem + gtid_215008 * t_n_m_203740 * (int64_t) 8,
                    mem_220418 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220483.mem + gtid_215008 * t_n_m_203740 * (int64_t) 8,
                    mem_220421 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220373);
    free(mem_220388);
    free(mem_220391);
    free(mem_220418);
    free(mem_220421);
    free(mem_220438);
    free(mem_220441);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236640_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236640_end -
                 futhark_mc_segmap_parloop_236640_start;
        
        ctx->futhark_mc_segmap_parloop_236640_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236640_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236640_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236638(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215007 = tid;
    int num_tasks_233866 = info.nsubtasks;
    struct futhark_mc_task_236637 *futhark_mc_task_236637 =
                                  (struct futhark_mc_task_236637 *) args;
    struct futhark_context *ctx = futhark_mc_task_236637->ctx;
    uint64_t futhark_mc_segmap_task_236638_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236638_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236637->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236637->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236637->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236637->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236637->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236637->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236637->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236637->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236637->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236637->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236637->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236637->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236637->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236637->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236637->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236637->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236637->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236637->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220330 = futhark_mc_task_236637->free_bytes_220330;
    struct memblock mem_220479 = {.desc ="mem_220479", .mem =
                                  futhark_mc_task_236637->free_mem_220479,
                                  .size =0, .references =NULL};
    struct memblock mem_220483 = {.desc ="mem_220483", .mem =
                                  futhark_mc_task_236637->free_mem_220483,
                                  .size =0, .references =NULL};
    int64_t iter_233867;
    struct futhark_mc_segmap_parloop_struct_236639
    futhark_mc_segmap_parloop_struct_236639;
    
    futhark_mc_segmap_parloop_struct_236639.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236639.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236639.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236639.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236639.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236639.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236639.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236639.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236639.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236639.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236639.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236639.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236639.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236639.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236639.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236639.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236639.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236639.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236639.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236639.free_bytes_220330 = bytes_220330;
    futhark_mc_segmap_parloop_struct_236639.free_mem_220479 = mem_220479.mem;
    futhark_mc_segmap_parloop_struct_236639.free_mem_220483 = mem_220483.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236640_task;
    
    futhark_mc_segmap_parloop_236640_task.name =
        "futhark_mc_segmap_parloop_236640";
    futhark_mc_segmap_parloop_236640_task.fn = futhark_mc_segmap_parloop_236640;
    futhark_mc_segmap_parloop_236640_task.args =
        &futhark_mc_segmap_parloop_struct_236639;
    futhark_mc_segmap_parloop_236640_task.iterations = iterations;
    futhark_mc_segmap_parloop_236640_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236640_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236640_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236640_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236640_task);
    
    if (futhark_mc_segmap_parloop_236640_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236640_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236640_total_end -
                 futhark_mc_segmap_parloop_236640_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236640_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236640_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236640_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236638_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236638_end -
                 futhark_mc_segmap_task_236638_start;
        
        ctx->futhark_mc_segmap_task_236638_runs[tid]++;
        ctx->futhark_mc_segmap_task_236638_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236638_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236649 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    int64_t free_bytes_220330;
    unsigned char *free_mem_220479;
    unsigned char *free_mem_220483;
};
struct futhark_mc_task_236656 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215102;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220322;
};
struct futhark_mc_segmap_parloop_struct_236658 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215102;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220322;
};
static int futhark_mc_segmap_parloop_236659(void *args, int64_t start,
                                            int64_t end, int flat_tid_233983,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236658
    *futhark_mc_segmap_parloop_struct_236658 =
    (struct futhark_mc_segmap_parloop_struct_236658 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236658->ctx;
    uint64_t futhark_mc_segmap_parloop_236659_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236659_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236658->free_n_203572;
    int64_t gtid_215102 =
            futhark_mc_segmap_parloop_struct_236658->free_gtid_215102;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236658->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236658->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220322 = {.desc ="mem_220322", .mem =
                                  futhark_mc_segmap_parloop_struct_236658->free_mem_220322,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234158 = start;
    
    for (; iter_234158 < end; iter_234158++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234159 = n_203572;
        int64_t gtid_233984 = iter_234158;
        int64_t remnant_234160 = iter_234158 - gtid_233984;
        double x_233985;
        
        x_233985 = ((double *) mem_217415.mem)[gtid_215102 * n_203572 +
                                               gtid_233984];
        
        double x_233986;
        
        x_233986 = ((double *) mem_219926.mem)[gtid_215102 * n_203572 +
                                               gtid_233984];
        
        double defunc_1_f_res_233987 = x_233985 - x_233986;
        
        ((double *) mem_220322.mem)[gtid_233984] = defunc_1_f_res_233987;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236659_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236659_end -
                 futhark_mc_segmap_parloop_236659_start;
        
        ctx->futhark_mc_segmap_parloop_236659_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236659_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236659_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236657(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233983 = tid;
    int num_tasks_234157 = info.nsubtasks;
    struct futhark_mc_task_236656 *futhark_mc_task_236656 =
                                  (struct futhark_mc_task_236656 *) args;
    struct futhark_context *ctx = futhark_mc_task_236656->ctx;
    uint64_t futhark_mc_segmap_task_236657_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236657_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236656->free_n_203572;
    int64_t gtid_215102 = futhark_mc_task_236656->free_gtid_215102;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236656->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236656->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220322 = {.desc ="mem_220322", .mem =
                                  futhark_mc_task_236656->free_mem_220322,
                                  .size =0, .references =NULL};
    int64_t iter_234158;
    struct futhark_mc_segmap_parloop_struct_236658
    futhark_mc_segmap_parloop_struct_236658;
    
    futhark_mc_segmap_parloop_struct_236658.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236658.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236658.free_gtid_215102 = gtid_215102;
    futhark_mc_segmap_parloop_struct_236658.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236658.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236658.free_mem_220322 = mem_220322.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236659_task;
    
    futhark_mc_segmap_parloop_236659_task.name =
        "futhark_mc_segmap_parloop_236659";
    futhark_mc_segmap_parloop_236659_task.fn = futhark_mc_segmap_parloop_236659;
    futhark_mc_segmap_parloop_236659_task.args =
        &futhark_mc_segmap_parloop_struct_236658;
    futhark_mc_segmap_parloop_236659_task.iterations = iterations;
    futhark_mc_segmap_parloop_236659_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236659_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236659_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236659_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236659_task);
    
    if (futhark_mc_segmap_parloop_236659_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236659_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236659_total_end -
                 futhark_mc_segmap_parloop_236659_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236659_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236659_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236659_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236657_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236657_end -
                 futhark_mc_segmap_task_236657_start;
        
        ctx->futhark_mc_segmap_task_236657_runs[tid]++;
        ctx->futhark_mc_segmap_task_236657_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236657_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236660 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215102;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220322;
    unsigned char *free_mem_220325;
    unsigned char *free_mem_220328;
};
struct futhark_mc_segmap_parloop_struct_236662 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215102;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220322;
    unsigned char *free_mem_220325;
    unsigned char *free_mem_220328;
};
static int futhark_mc_segmap_parloop_236663(void *args, int64_t start,
                                            int64_t end, int flat_tid_233988,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236662
    *futhark_mc_segmap_parloop_struct_236662 =
    (struct futhark_mc_segmap_parloop_struct_236662 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236662->ctx;
    uint64_t futhark_mc_segmap_parloop_236663_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236663_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236662->free_n_203572;
    int64_t gtid_215102 =
            futhark_mc_segmap_parloop_struct_236662->free_gtid_215102;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236662->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236662->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236662->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236662->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236662->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220322 = {.desc ="mem_220322", .mem =
                                  futhark_mc_segmap_parloop_struct_236662->free_mem_220322,
                                  .size =0, .references =NULL};
    struct memblock mem_220325 = {.desc ="mem_220325", .mem =
                                  futhark_mc_segmap_parloop_struct_236662->free_mem_220325,
                                  .size =0, .references =NULL};
    struct memblock mem_220328 = {.desc ="mem_220328", .mem =
                                  futhark_mc_segmap_parloop_struct_236662->free_mem_220328,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234162 = start;
    
    for (; iter_234162 < end; iter_234162++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234171 = n_203572;
        int64_t gtid_233989 = iter_234162;
        int64_t remnant_234172 = iter_234162 - gtid_233989;
        int64_t x_233990;
        
        x_233990 = ((int64_t *) mem_217458.mem)[gtid_215102 * n_203572 +
                                                gtid_233989];
        
        bool cond_233991 = sle64((int64_t) 0, x_233990);
        double defunc_0_f_res_233992;
        
        if (cond_233991) {
            bool y_234163 = slt64(x_233990, n_203572);
            bool bounds_check_234164 = cond_233991 && y_234163;
            bool index_certs_234165;
            
            if (!bounds_check_234164) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233990,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_234166;
            
            defunc_0_f_res_t_res_234166 = ((double *) mem_220322.mem)[x_233990];
            defunc_0_f_res_233992 = defunc_0_f_res_t_res_234166;
        } else {
            defunc_0_f_res_233992 = 0.0;
        }
        
        double defunc_0_f_res_233997;
        
        if (cond_233991) {
            bool y_234167 = slt64(x_233990, n_203572);
            bool bounds_check_234168 = cond_233991 && y_234167;
            bool index_certs_234169;
            
            if (!bounds_check_234168) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_233990,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_234170;
            
            defunc_0_f_res_t_res_234170 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_215102 *
                                                   ctx_param_ext_217985 +
                                                   x_233990 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_233997 = defunc_0_f_res_t_res_234170;
        } else {
            defunc_0_f_res_233997 = 0.0;
        }
        ((double *) mem_220325.mem)[gtid_233989] = defunc_0_f_res_233997;
        ((double *) mem_220328.mem)[gtid_233989] = defunc_0_f_res_233992;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236663_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236663_end -
                 futhark_mc_segmap_parloop_236663_start;
        
        ctx->futhark_mc_segmap_parloop_236663_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236663_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236663_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236661(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_233988 = tid;
    int num_tasks_234161 = info.nsubtasks;
    struct futhark_mc_task_236660 *futhark_mc_task_236660 =
                                  (struct futhark_mc_task_236660 *) args;
    struct futhark_context *ctx = futhark_mc_task_236660->ctx;
    uint64_t futhark_mc_segmap_task_236661_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236661_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236660->free_n_203572;
    int64_t gtid_215102 = futhark_mc_task_236660->free_gtid_215102;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236660->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236660->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236660->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236660->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236660->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220322 = {.desc ="mem_220322", .mem =
                                  futhark_mc_task_236660->free_mem_220322,
                                  .size =0, .references =NULL};
    struct memblock mem_220325 = {.desc ="mem_220325", .mem =
                                  futhark_mc_task_236660->free_mem_220325,
                                  .size =0, .references =NULL};
    struct memblock mem_220328 = {.desc ="mem_220328", .mem =
                                  futhark_mc_task_236660->free_mem_220328,
                                  .size =0, .references =NULL};
    int64_t iter_234162;
    struct futhark_mc_segmap_parloop_struct_236662
    futhark_mc_segmap_parloop_struct_236662;
    
    futhark_mc_segmap_parloop_struct_236662.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236662.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236662.free_gtid_215102 = gtid_215102;
    futhark_mc_segmap_parloop_struct_236662.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236662.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236662.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236662.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236662.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236662.free_mem_220322 = mem_220322.mem;
    futhark_mc_segmap_parloop_struct_236662.free_mem_220325 = mem_220325.mem;
    futhark_mc_segmap_parloop_struct_236662.free_mem_220328 = mem_220328.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236663_task;
    
    futhark_mc_segmap_parloop_236663_task.name =
        "futhark_mc_segmap_parloop_236663";
    futhark_mc_segmap_parloop_236663_task.fn = futhark_mc_segmap_parloop_236663;
    futhark_mc_segmap_parloop_236663_task.args =
        &futhark_mc_segmap_parloop_struct_236662;
    futhark_mc_segmap_parloop_236663_task.iterations = iterations;
    futhark_mc_segmap_parloop_236663_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236663_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236663_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236663_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236663_task);
    
    if (futhark_mc_segmap_parloop_236663_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236663_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236663_total_end -
                 futhark_mc_segmap_parloop_236663_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236663_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236663_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236663_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236661_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236661_end -
                 futhark_mc_segmap_task_236661_start;
        
        ctx->futhark_mc_segmap_task_236661_runs[tid]++;
        ctx->futhark_mc_segmap_task_236661_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236661_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236664 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_215102;
    int64_t free_x_215107;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220325;
    unsigned char *free_mem_220328;
    int64_t free_bytes_220330;
    unsigned char *free_mem_220367;
    unsigned char *free_mem_220370;
};
struct futhark_mc_segmap_parloop_struct_236666 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_215102;
    int64_t free_x_215107;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220325;
    unsigned char *free_mem_220328;
    int64_t free_bytes_220330;
    unsigned char *free_mem_220367;
    unsigned char *free_mem_220370;
};
static int futhark_mc_segmap_parloop_236667(void *args, int64_t start,
                                            int64_t end, int flat_tid_234079,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236666
    *futhark_mc_segmap_parloop_struct_236666 =
    (struct futhark_mc_segmap_parloop_struct_236666 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236666->ctx;
    uint64_t futhark_mc_segmap_parloop_236667_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236667_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236666->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236666->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236666->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236666->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236666->free_i_203760;
    int64_t gtid_215102 =
            futhark_mc_segmap_parloop_struct_236666->free_gtid_215102;
    int64_t x_215107 = futhark_mc_segmap_parloop_struct_236666->free_x_215107;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236666->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236666->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236666->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220325 = {.desc ="mem_220325", .mem =
                                  futhark_mc_segmap_parloop_struct_236666->free_mem_220325,
                                  .size =0, .references =NULL};
    struct memblock mem_220328 = {.desc ="mem_220328", .mem =
                                  futhark_mc_segmap_parloop_struct_236666->free_mem_220328,
                                  .size =0, .references =NULL};
    int64_t bytes_220330 =
            futhark_mc_segmap_parloop_struct_236666->free_bytes_220330;
    struct memblock mem_220367 = {.desc ="mem_220367", .mem =
                                  futhark_mc_segmap_parloop_struct_236666->free_mem_220367,
                                  .size =0, .references =NULL};
    struct memblock mem_220370 = {.desc ="mem_220370", .mem =
                                  futhark_mc_segmap_parloop_struct_236666->free_mem_220370,
                                  .size =0, .references =NULL};
    size_t mem_234086_cached_sizze_236668 = 0;
    unsigned char *mem_234086 = NULL;
    size_t mem_234088_cached_sizze_236669 = 0;
    unsigned char *mem_234088 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234174 = start;
    
    if (mem_234086_cached_sizze_236668 < (size_t) bytes_220330) {
        mem_234086 = realloc(mem_234086, bytes_220330);
        mem_234086_cached_sizze_236668 = bytes_220330;
    }
    if (mem_234088_cached_sizze_236669 < (size_t) bytes_220330) {
        mem_234088 = realloc(mem_234088, bytes_220330);
        mem_234088_cached_sizze_236669 = bytes_220330;
    }
    for (; iter_234174 < end; iter_234174++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234225 = t_n_m_203740;
        int64_t gtid_234080 = iter_234174;
        int64_t remnant_234226 = iter_234174 - gtid_234080;
        int64_t x_234081;
        
        x_234081 = ((int64_t *) mem_217953.mem)[gtid_215102 * t_n_m_203740 +
                                                gtid_234080];
        
        double x_234082;
        
        x_234082 = ((double *) mem_217957.mem)[gtid_215102 * t_n_m_203740 +
                                               gtid_234080];
        
        int64_t min_arg_234083 = mul64(jump_t_203582, gtid_234080);
        int64_t min_res_234084 = smin64(i_203760, min_arg_234083);
        int64_t defunc_0_g_res_234085 = add64((int64_t) 1, min_res_234084);
        double defunc_2_reduce_res_234090;
        double defunc_2_reduce_res_234091;
        double defunc_2_reduce_res_234092;
        double redout_234176;
        double redout_234177;
        double redout_234178;
        
        redout_234176 = 0.0;
        redout_234177 = 0.0;
        redout_234178 = 0.0;
        for (int64_t i_234175 = 0; i_234175 < q_t_203576; i_234175++) {
            bool cond_234181 = sle64(x_215107, i_234175);
            int64_t defunc_0_f_res_234182;
            
            if (cond_234181) {
                defunc_0_f_res_234182 = (int64_t) 0;
            } else {
                int64_t i_234183 = add64(x_234081, i_234175);
                int64_t defunc_0_add_arg_234184;
                
                defunc_0_add_arg_234184 =
                    ((int64_t *) mem_217458.mem)[gtid_215102 * n_203572 +
                                                 i_234183];
                
                int64_t defunc_1_add_res_234185 = add64((int64_t) 1,
                                                        defunc_0_add_arg_234184);
                
                defunc_0_f_res_234182 = defunc_1_add_res_234185;
            }
            
            double defunc_0_f_res_234186;
            
            if (cond_234181) {
                defunc_0_f_res_234186 = 0.0;
            } else {
                int64_t i_234187 = add64(x_234081, i_234175);
                double defunc_0_add_arg_234188;
                
                defunc_0_add_arg_234188 = ((double *) mem_220325.mem)[i_234187];
                defunc_0_f_res_234186 = defunc_0_add_arg_234188;
            }
            
            int64_t binop_p_234189 = sub64(defunc_0_f_res_234182,
                                           defunc_0_g_res_234085);
            double defunc_0_f_res_234190 = sitofp_i64_f64(binop_p_234189);
            double abs_res_234191 = fabs(defunc_0_f_res_234190);
            double tmp1_234192 = abs_res_234191 / x_234082;
            double x_234193 = tmp1_234192 * tmp1_234192;
            double y_234194 = tmp1_234192 * x_234193;
            double tmp2_234195 = 1.0 - y_234194;
            double x_234196 = tmp2_234195 * tmp2_234195;
            double tmp3_234197 = tmp2_234195 * x_234196;
            double tmp4_234198 = defunc_0_f_res_234186 * tmp3_234197;
            double defunc_1_f_res_234199 = defunc_0_f_res_234190 * tmp4_234198;
            double defunc_1_f_res_234200 = defunc_0_f_res_234190 *
                   defunc_1_f_res_234199;
            double defunc_1_op_res_234201 = tmp4_234198 + redout_234176;
            double defunc_1_op_res_234202 = defunc_1_f_res_234199 +
                   redout_234177;
            double defunc_1_op_res_234203 = defunc_1_f_res_234200 +
                   redout_234178;
            
            ((double *) mem_234086)[i_234175] = defunc_1_f_res_234199;
            ((double *) mem_234088)[i_234175] = tmp4_234198;
            
            double redout_tmp_234227 = defunc_1_op_res_234201;
            double redout_tmp_234228 = defunc_1_op_res_234202;
            double redout_tmp_234229 = defunc_1_op_res_234203;
            
            redout_234176 = redout_tmp_234227;
            redout_234177 = redout_tmp_234228;
            redout_234178 = redout_tmp_234229;
        }
        defunc_2_reduce_res_234090 = redout_234176;
        defunc_2_reduce_res_234091 = redout_234177;
        defunc_2_reduce_res_234092 = redout_234178;
        
        double x_234126 = defunc_2_reduce_res_234090 *
               defunc_2_reduce_res_234092;
        double y_234127 = defunc_2_reduce_res_234091 *
               defunc_2_reduce_res_234091;
        double y_234128 = x_234126 - y_234127;
        double det1_234129 = 1.0 / y_234128;
        double a11_234130 = defunc_2_reduce_res_234092 * det1_234129;
        double x_234131 = 0.0 - defunc_2_reduce_res_234091;
        double b11_234132 = det1_234129 * x_234131;
        double c11_234133 = defunc_2_reduce_res_234090 * det1_234129;
        double defunc_2_reduce_res_234134;
        double defunc_2_reduce_res_234135;
        double redout_234207;
        double redout_234208;
        
        redout_234207 = 0.0;
        redout_234208 = 0.0;
        for (int64_t i_234206 = 0; i_234206 < q_t_203576; i_234206++) {
            double x_234209;
            
            x_234209 = ((double *) mem_234088)[i_234206];
            
            double x_234210;
            
            x_234210 = ((double *) mem_234086)[i_234206];
            
            bool cond_234211 = sle64(x_215107, i_234206);
            double defunc_0_f_res_234212;
            
            if (cond_234211) {
                defunc_0_f_res_234212 = 0.0;
            } else {
                int64_t i_234213 = add64(x_234081, i_234206);
                double defunc_0_add_arg_234214;
                
                defunc_0_add_arg_234214 = ((double *) mem_220328.mem)[i_234213];
                defunc_0_f_res_234212 = defunc_0_add_arg_234214;
            }
            
            double x_234215 = a11_234130 * x_234209;
            double y_234216 = b11_234132 * x_234210;
            double x_234217 = x_234215 + y_234216;
            double defunc_9_fit_fun_res_234218 = defunc_0_f_res_234212 *
                   x_234217;
            double x_234219 = b11_234132 * x_234209;
            double y_234220 = c11_234133 * x_234210;
            double x_234221 = x_234219 + y_234220;
            double defunc_9_slope_fun_res_234222 = defunc_0_f_res_234212 *
                   x_234221;
            double defunc_1_op_res_234223 = defunc_9_fit_fun_res_234218 +
                   redout_234207;
            double defunc_1_op_res_234224 = defunc_9_slope_fun_res_234222 +
                   redout_234208;
            double redout_tmp_234232 = defunc_1_op_res_234223;
            double redout_tmp_234233 = defunc_1_op_res_234224;
            
            redout_234207 = redout_tmp_234232;
            redout_234208 = redout_tmp_234233;
        }
        defunc_2_reduce_res_234134 = redout_234207;
        defunc_2_reduce_res_234135 = redout_234208;
        ((double *) mem_220367.mem)[gtid_234080] = defunc_2_reduce_res_234134;
        ((double *) mem_220370.mem)[gtid_234080] = defunc_2_reduce_res_234135;
    }
    
  cleanup:
    { }
    free(mem_234086);
    free(mem_234088);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236667_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236667_end -
                 futhark_mc_segmap_parloop_236667_start;
        
        ctx->futhark_mc_segmap_parloop_236667_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236667_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236667_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236665(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234079 = tid;
    int num_tasks_234173 = info.nsubtasks;
    struct futhark_mc_task_236664 *futhark_mc_task_236664 =
                                  (struct futhark_mc_task_236664 *) args;
    struct futhark_context *ctx = futhark_mc_task_236664->ctx;
    uint64_t futhark_mc_segmap_task_236665_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236665_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236664->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236664->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236664->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236664->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236664->free_i_203760;
    int64_t gtid_215102 = futhark_mc_task_236664->free_gtid_215102;
    int64_t x_215107 = futhark_mc_task_236664->free_x_215107;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236664->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236664->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236664->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220325 = {.desc ="mem_220325", .mem =
                                  futhark_mc_task_236664->free_mem_220325,
                                  .size =0, .references =NULL};
    struct memblock mem_220328 = {.desc ="mem_220328", .mem =
                                  futhark_mc_task_236664->free_mem_220328,
                                  .size =0, .references =NULL};
    int64_t bytes_220330 = futhark_mc_task_236664->free_bytes_220330;
    struct memblock mem_220367 = {.desc ="mem_220367", .mem =
                                  futhark_mc_task_236664->free_mem_220367,
                                  .size =0, .references =NULL};
    struct memblock mem_220370 = {.desc ="mem_220370", .mem =
                                  futhark_mc_task_236664->free_mem_220370,
                                  .size =0, .references =NULL};
    int64_t iter_234174;
    struct futhark_mc_segmap_parloop_struct_236666
    futhark_mc_segmap_parloop_struct_236666;
    
    futhark_mc_segmap_parloop_struct_236666.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236666.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236666.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236666.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236666.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236666.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236666.free_gtid_215102 = gtid_215102;
    futhark_mc_segmap_parloop_struct_236666.free_x_215107 = x_215107;
    futhark_mc_segmap_parloop_struct_236666.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236666.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236666.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236666.free_mem_220325 = mem_220325.mem;
    futhark_mc_segmap_parloop_struct_236666.free_mem_220328 = mem_220328.mem;
    futhark_mc_segmap_parloop_struct_236666.free_bytes_220330 = bytes_220330;
    futhark_mc_segmap_parloop_struct_236666.free_mem_220367 = mem_220367.mem;
    futhark_mc_segmap_parloop_struct_236666.free_mem_220370 = mem_220370.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236667_task;
    
    futhark_mc_segmap_parloop_236667_task.name =
        "futhark_mc_segmap_parloop_236667";
    futhark_mc_segmap_parloop_236667_task.fn = futhark_mc_segmap_parloop_236667;
    futhark_mc_segmap_parloop_236667_task.args =
        &futhark_mc_segmap_parloop_struct_236666;
    futhark_mc_segmap_parloop_236667_task.iterations = iterations;
    futhark_mc_segmap_parloop_236667_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236667_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236667_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236667_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236667_task);
    
    if (futhark_mc_segmap_parloop_236667_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236667_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236667_total_end -
                 futhark_mc_segmap_parloop_236667_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236667_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236667_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236667_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236665_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236665_end -
                 futhark_mc_segmap_task_236665_start;
        
        ctx->futhark_mc_segmap_task_236665_runs[tid]++;
        ctx->futhark_mc_segmap_task_236665_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236665_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236671 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_215102;
    int64_t free_x_215107;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220325;
    unsigned char *free_mem_220328;
    int64_t free_bytes_220330;
    unsigned char *free_mem_220367;
    unsigned char *free_mem_220370;
};
struct futhark_mc_task_236675 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215102;
    int64_t free_x_215107;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220325;
    int64_t free_x_234004;
    double free_x_234005;
    int64_t free_defunc_0_g_res_234008;
    double *retval_defunc_2_reduce_res_234011;
    double *retval_defunc_2_reduce_res_234012;
    double *retval_defunc_2_reduce_res_234013;
    unsigned char *retval_mem_234009;
    unsigned char *retval_mem_234010;
};
struct futhark_mc_segred_stage_1_parloop_struct_236680 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215102;
    int64_t free_x_215107;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220325;
    int64_t free_x_234004;
    double free_x_234005;
    int64_t free_defunc_0_g_res_234008;
    unsigned char *free_mem_234009;
    unsigned char *free_mem_234010;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234291;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234293;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234295;
};
static int futhark_mc_segred_stage_1_parloop_236681(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_234235,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236680
    *futhark_mc_segred_stage_1_parloop_struct_236680 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236680 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236680->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236681_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236681_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236680->free_n_203572;
    int64_t gtid_215102 =
            futhark_mc_segred_stage_1_parloop_struct_236680->free_gtid_215102;
    int64_t x_215107 =
            futhark_mc_segred_stage_1_parloop_struct_236680->free_x_215107;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236680->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220325 = {.desc ="mem_220325", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236680->free_mem_220325,
                                  .size =0, .references =NULL};
    int64_t x_234004 =
            futhark_mc_segred_stage_1_parloop_struct_236680->free_x_234004;
    double x_234005 =
           futhark_mc_segred_stage_1_parloop_struct_236680->free_x_234005;
    int64_t defunc_0_g_res_234008 =
            futhark_mc_segred_stage_1_parloop_struct_236680->free_defunc_0_g_res_234008;
    struct memblock mem_234009 = {.desc ="mem_234009", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236680->free_mem_234009,
                                  .size =0, .references =NULL};
    struct memblock mem_234010 = {.desc ="mem_234010", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236680->free_mem_234010,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234291 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234291",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236680->free_reduce_stage_1_tid_res_arr_mem_234291,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234293 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234293",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236680->free_reduce_stage_1_tid_res_arr_mem_234293,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234295 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234295",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236680->free_reduce_stage_1_tid_res_arr_mem_234295,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234297 = start;
    double x_234237;
    double x_234238;
    double x_234240;
    double x_234241;
    double x_234243;
    double x_234244;
    double local_acc_234298 = 0.0;
    double local_acc_234299 = 0.0;
    double local_acc_234300 = 0.0;
    
    for (; iter_234297 < end; iter_234297++) {
        int64_t gtid_234236 = iter_234297;
        bool cond_234246 = sle64(x_215107, gtid_234236);
        int64_t defunc_0_f_res_234247;
        
        if (cond_234246) {
            defunc_0_f_res_234247 = (int64_t) 0;
        } else {
            int64_t i_234248 = add64(x_234004, gtid_234236);
            int64_t defunc_0_add_arg_234249;
            
            defunc_0_add_arg_234249 = ((int64_t *) mem_217458.mem)[gtid_215102 *
                                                                   n_203572 +
                                                                   i_234248];
            
            int64_t defunc_1_add_res_234250 = add64((int64_t) 1,
                                                    defunc_0_add_arg_234249);
            
            defunc_0_f_res_234247 = defunc_1_add_res_234250;
        }
        
        double defunc_0_f_res_234251;
        
        if (cond_234246) {
            defunc_0_f_res_234251 = 0.0;
        } else {
            int64_t i_234252 = add64(x_234004, gtid_234236);
            double defunc_0_add_arg_234253;
            
            defunc_0_add_arg_234253 = ((double *) mem_220325.mem)[i_234252];
            defunc_0_f_res_234251 = defunc_0_add_arg_234253;
        }
        
        int64_t binop_p_234254 = sub64(defunc_0_f_res_234247,
                                       defunc_0_g_res_234008);
        double defunc_0_f_res_234255 = sitofp_i64_f64(binop_p_234254);
        double abs_res_234256 = fabs(defunc_0_f_res_234255);
        double tmp1_234257 = abs_res_234256 / x_234005;
        double x_234258 = tmp1_234257 * tmp1_234257;
        double y_234259 = tmp1_234257 * x_234258;
        double tmp2_234260 = 1.0 - y_234259;
        double x_234261 = tmp2_234260 * tmp2_234260;
        double tmp3_234262 = tmp2_234260 * x_234261;
        double tmp4_234263 = defunc_0_f_res_234251 * tmp3_234262;
        double defunc_1_f_res_234264 = defunc_0_f_res_234255 * tmp4_234263;
        double defunc_1_f_res_234265 = defunc_0_f_res_234255 *
               defunc_1_f_res_234264;
        
        // save map-out results
        {
            ((double *) mem_234009.mem)[gtid_234236] = defunc_1_f_res_234264;
            ((double *) mem_234010.mem)[gtid_234236] = tmp4_234263;
        }
        // Load accum params
        {
            x_234237 = local_acc_234298;
        }
        // Load next params
        {
            x_234238 = tmp4_234263;
        }
        // Red body
        {
            double defunc_1_op_res_234239 = x_234237 + x_234238;
            
            local_acc_234298 = defunc_1_op_res_234239;
        }
        // Load accum params
        {
            x_234240 = local_acc_234299;
        }
        // Load next params
        {
            x_234241 = defunc_1_f_res_234264;
        }
        // Red body
        {
            double defunc_1_op_res_234242 = x_234240 + x_234241;
            
            local_acc_234299 = defunc_1_op_res_234242;
        }
        // Load accum params
        {
            x_234243 = local_acc_234300;
        }
        // Load next params
        {
            x_234244 = defunc_1_f_res_234265;
        }
        // Red body
        {
            double defunc_1_op_res_234245 = x_234243 + x_234244;
            
            local_acc_234300 = defunc_1_op_res_234245;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_234291.mem)[flat_tid_234235] =
        local_acc_234298;
    ((double *) reduce_stage_1_tid_res_arr_mem_234293.mem)[flat_tid_234235] =
        local_acc_234299;
    ((double *) reduce_stage_1_tid_res_arr_mem_234295.mem)[flat_tid_234235] =
        local_acc_234300;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236681_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236681_end -
                 futhark_mc_segred_stage_1_parloop_236681_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236681_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236681_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236681_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236676(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234235 = tid;
    int num_tasks_234290 = info.nsubtasks;
    struct futhark_mc_task_236675 *futhark_mc_task_236675 =
                                  (struct futhark_mc_task_236675 *) args;
    struct futhark_context *ctx = futhark_mc_task_236675->ctx;
    uint64_t futhark_mc_segred_task_236676_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236676_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236675->free_n_203572;
    int64_t gtid_215102 = futhark_mc_task_236675->free_gtid_215102;
    int64_t x_215107 = futhark_mc_task_236675->free_x_215107;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236675->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220325 = {.desc ="mem_220325", .mem =
                                  futhark_mc_task_236675->free_mem_220325,
                                  .size =0, .references =NULL};
    int64_t x_234004 = futhark_mc_task_236675->free_x_234004;
    double x_234005 = futhark_mc_task_236675->free_x_234005;
    int64_t defunc_0_g_res_234008 =
            futhark_mc_task_236675->free_defunc_0_g_res_234008;
    double defunc_2_reduce_res_234011 =
           *futhark_mc_task_236675->retval_defunc_2_reduce_res_234011;
    double defunc_2_reduce_res_234012 =
           *futhark_mc_task_236675->retval_defunc_2_reduce_res_234012;
    double defunc_2_reduce_res_234013 =
           *futhark_mc_task_236675->retval_defunc_2_reduce_res_234013;
    struct memblock mem_234009 = {.desc ="mem_234009", .mem =
                                  futhark_mc_task_236675->retval_mem_234009,
                                  .size =0, .references =NULL};
    struct memblock mem_234010 = {.desc ="mem_234010", .mem =
                                  futhark_mc_task_236675->retval_mem_234010,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_234291_cached_sizze_236677 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234291 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234293_cached_sizze_236678 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234293 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234295_cached_sizze_236679 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234295 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_234291_cached_sizze_236677 <
        (size_t) ((int64_t) 8 * num_tasks_234290)) {
        reduce_stage_1_tid_res_arr_mem_234291 =
            realloc(reduce_stage_1_tid_res_arr_mem_234291, (int64_t) 8 *
                    num_tasks_234290);
        reduce_stage_1_tid_res_arr_mem_234291_cached_sizze_236677 =
            (int64_t) 8 * num_tasks_234290;
    }
    if (reduce_stage_1_tid_res_arr_mem_234293_cached_sizze_236678 <
        (size_t) ((int64_t) 8 * num_tasks_234290)) {
        reduce_stage_1_tid_res_arr_mem_234293 =
            realloc(reduce_stage_1_tid_res_arr_mem_234293, (int64_t) 8 *
                    num_tasks_234290);
        reduce_stage_1_tid_res_arr_mem_234293_cached_sizze_236678 =
            (int64_t) 8 * num_tasks_234290;
    }
    if (reduce_stage_1_tid_res_arr_mem_234295_cached_sizze_236679 <
        (size_t) ((int64_t) 8 * num_tasks_234290)) {
        reduce_stage_1_tid_res_arr_mem_234295 =
            realloc(reduce_stage_1_tid_res_arr_mem_234295, (int64_t) 8 *
                    num_tasks_234290);
        reduce_stage_1_tid_res_arr_mem_234295_cached_sizze_236679 =
            (int64_t) 8 * num_tasks_234290;
    }
    
    int64_t iter_234297;
    struct futhark_mc_segred_stage_1_parloop_struct_236680
    futhark_mc_segred_stage_1_parloop_struct_236680;
    
    futhark_mc_segred_stage_1_parloop_struct_236680.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_gtid_215102 =
        gtid_215102;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_x_215107 = x_215107;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_mem_217458 =
        mem_217458.mem;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_mem_220325 =
        mem_220325.mem;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_x_234004 = x_234004;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_x_234005 = x_234005;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_defunc_0_g_res_234008 =
        defunc_0_g_res_234008;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_mem_234009 =
        mem_234009.mem;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_mem_234010 =
        mem_234010.mem;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_reduce_stage_1_tid_res_arr_mem_234291 =
        reduce_stage_1_tid_res_arr_mem_234291;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_reduce_stage_1_tid_res_arr_mem_234293 =
        reduce_stage_1_tid_res_arr_mem_234293;
    futhark_mc_segred_stage_1_parloop_struct_236680.free_reduce_stage_1_tid_res_arr_mem_234295 =
        reduce_stage_1_tid_res_arr_mem_234295;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236681_task;
    
    futhark_mc_segred_stage_1_parloop_236681_task.name =
        "futhark_mc_segred_stage_1_parloop_236681";
    futhark_mc_segred_stage_1_parloop_236681_task.fn =
        futhark_mc_segred_stage_1_parloop_236681;
    futhark_mc_segred_stage_1_parloop_236681_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236680;
    futhark_mc_segred_stage_1_parloop_236681_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236681_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236681_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236681_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236681_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236681_task);
    
    if (futhark_mc_segred_stage_1_parloop_236681_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236681_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236681_total_end -
                 futhark_mc_segred_stage_1_parloop_236681_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236681_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236681_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236681_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_234011 = 0.0;
        defunc_2_reduce_res_234012 = 0.0;
        defunc_2_reduce_res_234013 = 0.0;
    }
    
    double x_234301;
    double x_234302;
    double x_234304;
    double x_234305;
    double x_234307;
    double x_234308;
    
    for (int32_t i_234310 = 0; i_234310 < num_tasks_234290; i_234310++) {
        flat_tid_234235 = i_234310;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_234301 = defunc_2_reduce_res_234011;
            }
            // load next params
            {
                x_234302 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234291)[flat_tid_234235];
            }
            // red body
            {
                double defunc_1_op_res_234303 = x_234301 + x_234302;
                
                defunc_2_reduce_res_234011 = defunc_1_op_res_234303;
            }
            // load acc params
            {
                x_234304 = defunc_2_reduce_res_234012;
            }
            // load next params
            {
                x_234305 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234293)[flat_tid_234235];
            }
            // red body
            {
                double defunc_1_op_res_234306 = x_234304 + x_234305;
                
                defunc_2_reduce_res_234012 = defunc_1_op_res_234306;
            }
            // load acc params
            {
                x_234307 = defunc_2_reduce_res_234013;
            }
            // load next params
            {
                x_234308 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234295)[flat_tid_234235];
            }
            // red body
            {
                double defunc_1_op_res_234309 = x_234307 + x_234308;
                
                defunc_2_reduce_res_234013 = defunc_1_op_res_234309;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_234291);
        free(reduce_stage_1_tid_res_arr_mem_234293);
        free(reduce_stage_1_tid_res_arr_mem_234295);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236676_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236676_end -
                 futhark_mc_segred_task_236676_start;
        
        ctx->futhark_mc_segred_task_236676_runs[tid]++;
        ctx->futhark_mc_segred_task_236676_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236676_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236675->retval_defunc_2_reduce_res_234011 =
            defunc_2_reduce_res_234011;
        *futhark_mc_task_236675->retval_defunc_2_reduce_res_234012 =
            defunc_2_reduce_res_234012;
        *futhark_mc_task_236675->retval_defunc_2_reduce_res_234013 =
            defunc_2_reduce_res_234013;
        futhark_mc_task_236675->retval_mem_234009 = mem_234009.mem;
        futhark_mc_task_236675->retval_mem_234010 = mem_234010.mem;
    }
    return err;
}
struct futhark_mc_task_236682 {
    struct futhark_context *ctx;
    int64_t free_x_215107;
    unsigned char *free_mem_220328;
    int64_t free_x_234004;
    unsigned char *free_mem_234009;
    unsigned char *free_mem_234010;
    double free_a11_234051;
    double free_b11_234053;
    double free_c11_234054;
    double *retval_defunc_2_reduce_res_234055;
    double *retval_defunc_2_reduce_res_234056;
};
struct futhark_mc_segred_stage_1_parloop_struct_236686 {
    struct futhark_context *ctx;
    int64_t free_x_215107;
    unsigned char *free_mem_220328;
    int64_t free_x_234004;
    unsigned char *free_mem_234009;
    unsigned char *free_mem_234010;
    double free_a11_234051;
    double free_b11_234053;
    double free_c11_234054;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234312;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234314;
};
static int futhark_mc_segred_stage_1_parloop_236687(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_234266,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236686
    *futhark_mc_segred_stage_1_parloop_struct_236686 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236686 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236686->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236687_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236687_start = get_wall_time();
    
    int64_t x_215107 =
            futhark_mc_segred_stage_1_parloop_struct_236686->free_x_215107;
    struct memblock mem_220328 = {.desc ="mem_220328", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236686->free_mem_220328,
                                  .size =0, .references =NULL};
    int64_t x_234004 =
            futhark_mc_segred_stage_1_parloop_struct_236686->free_x_234004;
    struct memblock mem_234009 = {.desc ="mem_234009", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236686->free_mem_234009,
                                  .size =0, .references =NULL};
    struct memblock mem_234010 = {.desc ="mem_234010", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236686->free_mem_234010,
                                  .size =0, .references =NULL};
    double a11_234051 =
           futhark_mc_segred_stage_1_parloop_struct_236686->free_a11_234051;
    double b11_234053 =
           futhark_mc_segred_stage_1_parloop_struct_236686->free_b11_234053;
    double c11_234054 =
           futhark_mc_segred_stage_1_parloop_struct_236686->free_c11_234054;
    struct memblock reduce_stage_1_tid_res_arr_mem_234312 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234312",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236686->free_reduce_stage_1_tid_res_arr_mem_234312,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234314 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234314",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236686->free_reduce_stage_1_tid_res_arr_mem_234314,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234316 = start;
    double x_234268;
    double x_234269;
    double x_234271;
    double x_234272;
    double local_acc_234317 = 0.0;
    double local_acc_234318 = 0.0;
    
    for (; iter_234316 < end; iter_234316++) {
        int64_t gtid_234267 = iter_234316;
        double x_234274;
        
        x_234274 = ((double *) mem_234010.mem)[gtid_234267];
        
        double x_234275;
        
        x_234275 = ((double *) mem_234009.mem)[gtid_234267];
        
        bool cond_234276 = sle64(x_215107, gtid_234267);
        double defunc_0_f_res_234277;
        
        if (cond_234276) {
            defunc_0_f_res_234277 = 0.0;
        } else {
            int64_t i_234278 = add64(x_234004, gtid_234267);
            double defunc_0_add_arg_234279;
            
            defunc_0_add_arg_234279 = ((double *) mem_220328.mem)[i_234278];
            defunc_0_f_res_234277 = defunc_0_add_arg_234279;
        }
        
        double x_234280 = a11_234051 * x_234274;
        double y_234281 = b11_234053 * x_234275;
        double x_234282 = x_234280 + y_234281;
        double defunc_9_fit_fun_res_234283 = defunc_0_f_res_234277 * x_234282;
        double x_234284 = b11_234053 * x_234274;
        double y_234285 = c11_234054 * x_234275;
        double x_234286 = x_234284 + y_234285;
        double defunc_9_slope_fun_res_234287 = defunc_0_f_res_234277 * x_234286;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_234268 = local_acc_234317;
        }
        // Load next params
        {
            x_234269 = defunc_9_fit_fun_res_234283;
        }
        // Red body
        {
            double defunc_1_op_res_234270 = x_234268 + x_234269;
            
            local_acc_234317 = defunc_1_op_res_234270;
        }
        // Load accum params
        {
            x_234271 = local_acc_234318;
        }
        // Load next params
        {
            x_234272 = defunc_9_slope_fun_res_234287;
        }
        // Red body
        {
            double defunc_1_op_res_234273 = x_234271 + x_234272;
            
            local_acc_234318 = defunc_1_op_res_234273;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_234312.mem)[flat_tid_234266] =
        local_acc_234317;
    ((double *) reduce_stage_1_tid_res_arr_mem_234314.mem)[flat_tid_234266] =
        local_acc_234318;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236687_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236687_end -
                 futhark_mc_segred_stage_1_parloop_236687_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236687_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236687_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236687_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236683(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234266 = tid;
    int num_tasks_234311 = info.nsubtasks;
    struct futhark_mc_task_236682 *futhark_mc_task_236682 =
                                  (struct futhark_mc_task_236682 *) args;
    struct futhark_context *ctx = futhark_mc_task_236682->ctx;
    uint64_t futhark_mc_segred_task_236683_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236683_start = get_wall_time();
    
    int64_t x_215107 = futhark_mc_task_236682->free_x_215107;
    struct memblock mem_220328 = {.desc ="mem_220328", .mem =
                                  futhark_mc_task_236682->free_mem_220328,
                                  .size =0, .references =NULL};
    int64_t x_234004 = futhark_mc_task_236682->free_x_234004;
    struct memblock mem_234009 = {.desc ="mem_234009", .mem =
                                  futhark_mc_task_236682->free_mem_234009,
                                  .size =0, .references =NULL};
    struct memblock mem_234010 = {.desc ="mem_234010", .mem =
                                  futhark_mc_task_236682->free_mem_234010,
                                  .size =0, .references =NULL};
    double a11_234051 = futhark_mc_task_236682->free_a11_234051;
    double b11_234053 = futhark_mc_task_236682->free_b11_234053;
    double c11_234054 = futhark_mc_task_236682->free_c11_234054;
    double defunc_2_reduce_res_234055 =
           *futhark_mc_task_236682->retval_defunc_2_reduce_res_234055;
    double defunc_2_reduce_res_234056 =
           *futhark_mc_task_236682->retval_defunc_2_reduce_res_234056;
    size_t reduce_stage_1_tid_res_arr_mem_234312_cached_sizze_236684 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234312 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234314_cached_sizze_236685 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234314 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_234312_cached_sizze_236684 <
        (size_t) ((int64_t) 8 * num_tasks_234311)) {
        reduce_stage_1_tid_res_arr_mem_234312 =
            realloc(reduce_stage_1_tid_res_arr_mem_234312, (int64_t) 8 *
                    num_tasks_234311);
        reduce_stage_1_tid_res_arr_mem_234312_cached_sizze_236684 =
            (int64_t) 8 * num_tasks_234311;
    }
    if (reduce_stage_1_tid_res_arr_mem_234314_cached_sizze_236685 <
        (size_t) ((int64_t) 8 * num_tasks_234311)) {
        reduce_stage_1_tid_res_arr_mem_234314 =
            realloc(reduce_stage_1_tid_res_arr_mem_234314, (int64_t) 8 *
                    num_tasks_234311);
        reduce_stage_1_tid_res_arr_mem_234314_cached_sizze_236685 =
            (int64_t) 8 * num_tasks_234311;
    }
    
    int64_t iter_234316;
    struct futhark_mc_segred_stage_1_parloop_struct_236686
    futhark_mc_segred_stage_1_parloop_struct_236686;
    
    futhark_mc_segred_stage_1_parloop_struct_236686.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_x_215107 = x_215107;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_mem_220328 =
        mem_220328.mem;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_x_234004 = x_234004;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_mem_234009 =
        mem_234009.mem;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_mem_234010 =
        mem_234010.mem;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_a11_234051 =
        a11_234051;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_b11_234053 =
        b11_234053;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_c11_234054 =
        c11_234054;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_reduce_stage_1_tid_res_arr_mem_234312 =
        reduce_stage_1_tid_res_arr_mem_234312;
    futhark_mc_segred_stage_1_parloop_struct_236686.free_reduce_stage_1_tid_res_arr_mem_234314 =
        reduce_stage_1_tid_res_arr_mem_234314;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236687_task;
    
    futhark_mc_segred_stage_1_parloop_236687_task.name =
        "futhark_mc_segred_stage_1_parloop_236687";
    futhark_mc_segred_stage_1_parloop_236687_task.fn =
        futhark_mc_segred_stage_1_parloop_236687;
    futhark_mc_segred_stage_1_parloop_236687_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236686;
    futhark_mc_segred_stage_1_parloop_236687_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236687_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236687_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236687_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236687_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236687_task);
    
    if (futhark_mc_segred_stage_1_parloop_236687_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236687_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236687_total_end -
                 futhark_mc_segred_stage_1_parloop_236687_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236687_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236687_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236687_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_234055 = 0.0;
        defunc_2_reduce_res_234056 = 0.0;
    }
    
    double x_234319;
    double x_234320;
    double x_234322;
    double x_234323;
    
    for (int32_t i_234325 = 0; i_234325 < num_tasks_234311; i_234325++) {
        flat_tid_234266 = i_234325;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_234319 = defunc_2_reduce_res_234055;
            }
            // load next params
            {
                x_234320 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234312)[flat_tid_234266];
            }
            // red body
            {
                double defunc_1_op_res_234321 = x_234319 + x_234320;
                
                defunc_2_reduce_res_234055 = defunc_1_op_res_234321;
            }
            // load acc params
            {
                x_234322 = defunc_2_reduce_res_234056;
            }
            // load next params
            {
                x_234323 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234314)[flat_tid_234266];
            }
            // red body
            {
                double defunc_1_op_res_234324 = x_234322 + x_234323;
                
                defunc_2_reduce_res_234056 = defunc_1_op_res_234324;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_234312);
        free(reduce_stage_1_tid_res_arr_mem_234314);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236683_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236683_end -
                 futhark_mc_segred_task_236683_start;
        
        ctx->futhark_mc_segred_task_236683_runs[tid]++;
        ctx->futhark_mc_segred_task_236683_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236683_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236682->retval_defunc_2_reduce_res_234055 =
            defunc_2_reduce_res_234055;
        *futhark_mc_task_236682->retval_defunc_2_reduce_res_234056 =
            defunc_2_reduce_res_234056;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236672(void *args, int64_t start,
                                            int64_t end, int flat_tid_234002,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236671
    *futhark_mc_segmap_parloop_struct_236671 =
    (struct futhark_mc_segmap_parloop_struct_236671 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236671->ctx;
    uint64_t futhark_mc_segmap_parloop_236672_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236672_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236671->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236671->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236671->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236671->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236671->free_i_203760;
    int64_t gtid_215102 =
            futhark_mc_segmap_parloop_struct_236671->free_gtid_215102;
    int64_t x_215107 = futhark_mc_segmap_parloop_struct_236671->free_x_215107;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236671->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236671->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236671->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220325 = {.desc ="mem_220325", .mem =
                                  futhark_mc_segmap_parloop_struct_236671->free_mem_220325,
                                  .size =0, .references =NULL};
    struct memblock mem_220328 = {.desc ="mem_220328", .mem =
                                  futhark_mc_segmap_parloop_struct_236671->free_mem_220328,
                                  .size =0, .references =NULL};
    int64_t bytes_220330 =
            futhark_mc_segmap_parloop_struct_236671->free_bytes_220330;
    struct memblock mem_220367 = {.desc ="mem_220367", .mem =
                                  futhark_mc_segmap_parloop_struct_236671->free_mem_220367,
                                  .size =0, .references =NULL};
    struct memblock mem_220370 = {.desc ="mem_220370", .mem =
                                  futhark_mc_segmap_parloop_struct_236671->free_mem_220370,
                                  .size =0, .references =NULL};
    size_t mem_234009_cached_sizze_236673 = 0;
    unsigned char *mem_234009 = NULL;
    size_t mem_234010_cached_sizze_236674 = 0;
    unsigned char *mem_234010 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234234 = start;
    
    if (mem_234009_cached_sizze_236673 < (size_t) bytes_220330) {
        mem_234009 = realloc(mem_234009, bytes_220330);
        mem_234009_cached_sizze_236673 = bytes_220330;
    }
    if (mem_234010_cached_sizze_236674 < (size_t) bytes_220330) {
        mem_234010 = realloc(mem_234010, bytes_220330);
        mem_234010_cached_sizze_236674 = bytes_220330;
    }
    for (; iter_234234 < end; iter_234234++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234288 = t_n_m_203740;
        int64_t gtid_234003 = iter_234234;
        int64_t remnant_234289 = iter_234234 - gtid_234003;
        int64_t x_234004;
        
        x_234004 = ((int64_t *) mem_217953.mem)[gtid_215102 * t_n_m_203740 +
                                                gtid_234003];
        
        double x_234005;
        
        x_234005 = ((double *) mem_217957.mem)[gtid_215102 * t_n_m_203740 +
                                               gtid_234003];
        
        int64_t min_arg_234006 = mul64(jump_t_203582, gtid_234003);
        int64_t min_res_234007 = smin64(i_203760, min_arg_234006);
        int64_t defunc_0_g_res_234008 = add64((int64_t) 1, min_res_234007);
        double defunc_2_reduce_res_234011;
        double defunc_2_reduce_res_234012;
        double defunc_2_reduce_res_234013;
        int64_t flat_tid_234235 = (int64_t) 0;
        int32_t num_tasks_234290;
        
        defunc_2_reduce_res_234011 = 0.0;
        defunc_2_reduce_res_234012 = 0.0;
        defunc_2_reduce_res_234013 = 0.0;
        
        struct futhark_mc_task_236675 futhark_mc_task_236675;
        
        futhark_mc_task_236675.ctx = ctx;
        futhark_mc_task_236675.free_n_203572 = n_203572;
        futhark_mc_task_236675.free_gtid_215102 = gtid_215102;
        futhark_mc_task_236675.free_x_215107 = x_215107;
        futhark_mc_task_236675.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236675.free_mem_220325 = mem_220325.mem;
        futhark_mc_task_236675.free_x_234004 = x_234004;
        futhark_mc_task_236675.free_x_234005 = x_234005;
        futhark_mc_task_236675.free_defunc_0_g_res_234008 =
            defunc_0_g_res_234008;
        futhark_mc_task_236675.retval_defunc_2_reduce_res_234011 =
            &defunc_2_reduce_res_234011;
        futhark_mc_task_236675.retval_defunc_2_reduce_res_234012 =
            &defunc_2_reduce_res_234012;
        futhark_mc_task_236675.retval_defunc_2_reduce_res_234013 =
            &defunc_2_reduce_res_234013;
        futhark_mc_task_236675.retval_mem_234009 = mem_234009;
        futhark_mc_task_236675.retval_mem_234010 = mem_234010;
        
        struct scheduler_segop futhark_mc_task_236675_task;
        
        futhark_mc_task_236675_task.args = &futhark_mc_task_236675;
        futhark_mc_task_236675_task.top_level_fn =
            futhark_mc_segred_task_236676;
        futhark_mc_task_236675_task.name = "futhark_mc_segred_task_236676";
        futhark_mc_task_236675_task.iterations = q_t_203576;
        futhark_mc_task_236675_task.task_time =
            &ctx->futhark_mc_segred_task_236676_total_time;
        futhark_mc_task_236675_task.task_iter =
            &ctx->futhark_mc_segred_task_236676_total_iter;
        futhark_mc_task_236675_task.sched = STATIC;
        futhark_mc_task_236675_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236676_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236675_task);
        
        if (futhark_mc_segred_task_236676_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_234047 = defunc_2_reduce_res_234011 *
               defunc_2_reduce_res_234013;
        double y_234048 = defunc_2_reduce_res_234012 *
               defunc_2_reduce_res_234012;
        double y_234049 = x_234047 - y_234048;
        double det1_234050 = 1.0 / y_234049;
        double a11_234051 = defunc_2_reduce_res_234013 * det1_234050;
        double x_234052 = 0.0 - defunc_2_reduce_res_234012;
        double b11_234053 = det1_234050 * x_234052;
        double c11_234054 = defunc_2_reduce_res_234011 * det1_234050;
        double defunc_2_reduce_res_234055;
        double defunc_2_reduce_res_234056;
        int64_t flat_tid_234266 = (int64_t) 0;
        int32_t num_tasks_234311;
        
        defunc_2_reduce_res_234055 = 0.0;
        defunc_2_reduce_res_234056 = 0.0;
        
        struct futhark_mc_task_236682 futhark_mc_task_236682;
        
        futhark_mc_task_236682.ctx = ctx;
        futhark_mc_task_236682.free_x_215107 = x_215107;
        futhark_mc_task_236682.free_mem_220328 = mem_220328.mem;
        futhark_mc_task_236682.free_x_234004 = x_234004;
        futhark_mc_task_236682.free_mem_234009 = mem_234009;
        futhark_mc_task_236682.free_mem_234010 = mem_234010;
        futhark_mc_task_236682.free_a11_234051 = a11_234051;
        futhark_mc_task_236682.free_b11_234053 = b11_234053;
        futhark_mc_task_236682.free_c11_234054 = c11_234054;
        futhark_mc_task_236682.retval_defunc_2_reduce_res_234055 =
            &defunc_2_reduce_res_234055;
        futhark_mc_task_236682.retval_defunc_2_reduce_res_234056 =
            &defunc_2_reduce_res_234056;
        
        struct scheduler_segop futhark_mc_task_236682_task;
        
        futhark_mc_task_236682_task.args = &futhark_mc_task_236682;
        futhark_mc_task_236682_task.top_level_fn =
            futhark_mc_segred_task_236683;
        futhark_mc_task_236682_task.name = "futhark_mc_segred_task_236683";
        futhark_mc_task_236682_task.iterations = q_t_203576;
        futhark_mc_task_236682_task.task_time =
            &ctx->futhark_mc_segred_task_236683_total_time;
        futhark_mc_task_236682_task.task_iter =
            &ctx->futhark_mc_segred_task_236683_total_iter;
        futhark_mc_task_236682_task.sched = STATIC;
        futhark_mc_task_236682_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236683_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236682_task);
        
        if (futhark_mc_segred_task_236683_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_220367.mem)[gtid_234003] = defunc_2_reduce_res_234055;
        ((double *) mem_220370.mem)[gtid_234003] = defunc_2_reduce_res_234056;
    }
    
  cleanup:
    { }
    free(mem_234009);
    free(mem_234010);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236672_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236672_end -
                 futhark_mc_segmap_parloop_236672_start;
        
        ctx->futhark_mc_segmap_parloop_236672_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236672_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236672_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236670(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234002 = tid;
    int num_tasks_234173 = info.nsubtasks;
    struct futhark_mc_task_236664 *futhark_mc_task_236664 =
                                  (struct futhark_mc_task_236664 *) args;
    struct futhark_context *ctx = futhark_mc_task_236664->ctx;
    uint64_t futhark_mc_segmap_nested_task_236670_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236670_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236664->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236664->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236664->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236664->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236664->free_i_203760;
    int64_t gtid_215102 = futhark_mc_task_236664->free_gtid_215102;
    int64_t x_215107 = futhark_mc_task_236664->free_x_215107;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236664->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236664->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236664->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220325 = {.desc ="mem_220325", .mem =
                                  futhark_mc_task_236664->free_mem_220325,
                                  .size =0, .references =NULL};
    struct memblock mem_220328 = {.desc ="mem_220328", .mem =
                                  futhark_mc_task_236664->free_mem_220328,
                                  .size =0, .references =NULL};
    int64_t bytes_220330 = futhark_mc_task_236664->free_bytes_220330;
    struct memblock mem_220367 = {.desc ="mem_220367", .mem =
                                  futhark_mc_task_236664->free_mem_220367,
                                  .size =0, .references =NULL};
    struct memblock mem_220370 = {.desc ="mem_220370", .mem =
                                  futhark_mc_task_236664->free_mem_220370,
                                  .size =0, .references =NULL};
    int64_t iter_234234;
    struct futhark_mc_segmap_parloop_struct_236671
    futhark_mc_segmap_parloop_struct_236671;
    
    futhark_mc_segmap_parloop_struct_236671.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236671.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236671.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236671.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236671.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236671.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236671.free_gtid_215102 = gtid_215102;
    futhark_mc_segmap_parloop_struct_236671.free_x_215107 = x_215107;
    futhark_mc_segmap_parloop_struct_236671.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236671.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236671.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236671.free_mem_220325 = mem_220325.mem;
    futhark_mc_segmap_parloop_struct_236671.free_mem_220328 = mem_220328.mem;
    futhark_mc_segmap_parloop_struct_236671.free_bytes_220330 = bytes_220330;
    futhark_mc_segmap_parloop_struct_236671.free_mem_220367 = mem_220367.mem;
    futhark_mc_segmap_parloop_struct_236671.free_mem_220370 = mem_220370.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236672_task;
    
    futhark_mc_segmap_parloop_236672_task.name =
        "futhark_mc_segmap_parloop_236672";
    futhark_mc_segmap_parloop_236672_task.fn = futhark_mc_segmap_parloop_236672;
    futhark_mc_segmap_parloop_236672_task.args =
        &futhark_mc_segmap_parloop_struct_236671;
    futhark_mc_segmap_parloop_236672_task.iterations = iterations;
    futhark_mc_segmap_parloop_236672_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236672_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236672_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236672_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236672_task);
    
    if (futhark_mc_segmap_parloop_236672_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236672_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236672_total_end -
                 futhark_mc_segmap_parloop_236672_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236672_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236672_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236672_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236670_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236670_end -
                 futhark_mc_segmap_nested_task_236670_start;
        
        ctx->futhark_mc_segmap_nested_task_236670_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236670_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236670_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236650(void *args, int64_t start,
                                            int64_t end, int flat_tid_215101,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236649
    *futhark_mc_segmap_parloop_struct_236649 =
    (struct futhark_mc_segmap_parloop_struct_236649 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236649->ctx;
    uint64_t futhark_mc_segmap_parloop_236650_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236650_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236649->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236649->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236649->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236649->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236649->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236649->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236649->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236649->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236649->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236649->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236649->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236649->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236649->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236649->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236649->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236649->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236649->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236649->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220330 =
            futhark_mc_segmap_parloop_struct_236649->free_bytes_220330;
    struct memblock mem_220479 = {.desc ="mem_220479", .mem =
                                  futhark_mc_segmap_parloop_struct_236649->free_mem_220479,
                                  .size =0, .references =NULL};
    struct memblock mem_220483 = {.desc ="mem_220483", .mem =
                                  futhark_mc_segmap_parloop_struct_236649->free_mem_220483,
                                  .size =0, .references =NULL};
    size_t mem_220322_cached_sizze_236651 = 0;
    unsigned char *mem_220322 = NULL;
    size_t mem_220325_cached_sizze_236652 = 0;
    unsigned char *mem_220325 = NULL;
    size_t mem_220328_cached_sizze_236653 = 0;
    unsigned char *mem_220328 = NULL;
    size_t mem_220367_cached_sizze_236654 = 0;
    unsigned char *mem_220367 = NULL;
    size_t mem_220370_cached_sizze_236655 = 0;
    unsigned char *mem_220370 = NULL;
    int64_t iterations = end - start;
    int64_t iter_233982 = start;
    
    if (mem_220322_cached_sizze_236651 < (size_t) bytes_217420) {
        mem_220322 = realloc(mem_220322, bytes_217420);
        mem_220322_cached_sizze_236651 = bytes_217420;
    }
    if (mem_220325_cached_sizze_236652 < (size_t) bytes_217420) {
        mem_220325 = realloc(mem_220325, bytes_217420);
        mem_220325_cached_sizze_236652 = bytes_217420;
    }
    if (mem_220328_cached_sizze_236653 < (size_t) bytes_217420) {
        mem_220328 = realloc(mem_220328, bytes_217420);
        mem_220328_cached_sizze_236653 = bytes_217420;
    }
    if (mem_220367_cached_sizze_236654 < (size_t) bytes_217900) {
        mem_220367 = realloc(mem_220367, bytes_217900);
        mem_220367_cached_sizze_236654 = bytes_217900;
    }
    if (mem_220370_cached_sizze_236655 < (size_t) bytes_217900) {
        mem_220370 = realloc(mem_220370, bytes_217900);
        mem_220370_cached_sizze_236655 = bytes_217900;
    }
    for (; iter_233982 < end; iter_233982++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234155 = partition_sizze_203667;
        int64_t gtid_215102 = iter_233982;
        int64_t remnant_234156 = iter_233982 - gtid_215102;
        int64_t x_215107;
        
        x_215107 = ((int64_t *) mem_217461.mem)[gtid_215102];
        
        int64_t flat_tid_233983 = (int64_t) 0;
        int32_t num_tasks_234157;
        struct futhark_mc_task_236656 futhark_mc_task_236656;
        
        futhark_mc_task_236656.ctx = ctx;
        futhark_mc_task_236656.free_n_203572 = n_203572;
        futhark_mc_task_236656.free_gtid_215102 = gtid_215102;
        futhark_mc_task_236656.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_236656.free_mem_219926 = mem_219926.mem;
        futhark_mc_task_236656.free_mem_220322 = mem_220322;
        
        struct scheduler_segop futhark_mc_task_236656_task;
        
        futhark_mc_task_236656_task.args = &futhark_mc_task_236656;
        futhark_mc_task_236656_task.top_level_fn =
            futhark_mc_segmap_task_236657;
        futhark_mc_task_236656_task.name = "futhark_mc_segmap_task_236657";
        futhark_mc_task_236656_task.iterations = n_203572;
        futhark_mc_task_236656_task.task_time =
            &ctx->futhark_mc_segmap_task_236657_total_time;
        futhark_mc_task_236656_task.task_iter =
            &ctx->futhark_mc_segmap_task_236657_total_iter;
        futhark_mc_task_236656_task.sched = STATIC;
        futhark_mc_task_236656_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236657_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236656_task);
        
        if (futhark_mc_segmap_task_236657_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_233988 = (int64_t) 0;
        int32_t num_tasks_234161;
        struct futhark_mc_task_236660 futhark_mc_task_236660;
        
        futhark_mc_task_236660.ctx = ctx;
        futhark_mc_task_236660.free_n_203572 = n_203572;
        futhark_mc_task_236660.free_gtid_215102 = gtid_215102;
        futhark_mc_task_236660.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236660.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236660.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236660.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236660.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236660.free_mem_220322 = mem_220322;
        futhark_mc_task_236660.free_mem_220325 = mem_220325;
        futhark_mc_task_236660.free_mem_220328 = mem_220328;
        
        struct scheduler_segop futhark_mc_task_236660_task;
        
        futhark_mc_task_236660_task.args = &futhark_mc_task_236660;
        futhark_mc_task_236660_task.top_level_fn =
            futhark_mc_segmap_task_236661;
        futhark_mc_task_236660_task.name = "futhark_mc_segmap_task_236661";
        futhark_mc_task_236660_task.iterations = n_203572;
        futhark_mc_task_236660_task.task_time =
            &ctx->futhark_mc_segmap_task_236661_total_time;
        futhark_mc_task_236660_task.task_iter =
            &ctx->futhark_mc_segmap_task_236661_total_iter;
        futhark_mc_task_236660_task.sched = STATIC;
        futhark_mc_task_236660_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236661_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236660_task);
        
        if (futhark_mc_segmap_task_236661_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_234079 = (int64_t) 0;
        int32_t num_tasks_234173;
        int64_t flat_tid_234002 = (int64_t) 0;
        struct futhark_mc_task_236664 futhark_mc_task_236664;
        
        futhark_mc_task_236664.ctx = ctx;
        futhark_mc_task_236664.free_n_203572 = n_203572;
        futhark_mc_task_236664.free_q_t_203576 = q_t_203576;
        futhark_mc_task_236664.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236664.free_t_n_m_203740 = t_n_m_203740;
        futhark_mc_task_236664.free_i_203760 = i_203760;
        futhark_mc_task_236664.free_gtid_215102 = gtid_215102;
        futhark_mc_task_236664.free_x_215107 = x_215107;
        futhark_mc_task_236664.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236664.free_mem_217953 = mem_217953.mem;
        futhark_mc_task_236664.free_mem_217957 = mem_217957.mem;
        futhark_mc_task_236664.free_mem_220325 = mem_220325;
        futhark_mc_task_236664.free_mem_220328 = mem_220328;
        futhark_mc_task_236664.free_bytes_220330 = bytes_220330;
        futhark_mc_task_236664.free_mem_220367 = mem_220367;
        futhark_mc_task_236664.free_mem_220370 = mem_220370;
        
        struct scheduler_segop futhark_mc_task_236664_task;
        
        futhark_mc_task_236664_task.args = &futhark_mc_task_236664;
        futhark_mc_task_236664_task.top_level_fn =
            futhark_mc_segmap_task_236665;
        futhark_mc_task_236664_task.name = "futhark_mc_segmap_task_236665";
        futhark_mc_task_236664_task.iterations = t_n_m_203740;
        futhark_mc_task_236664_task.task_time =
            &ctx->futhark_mc_segmap_task_236665_total_time;
        futhark_mc_task_236664_task.task_iter =
            &ctx->futhark_mc_segmap_task_236665_total_iter;
        futhark_mc_task_236664_task.sched = STATIC;
        futhark_mc_task_236664_task.nested_fn =
            futhark_mc_segmap_nested_task_236670;
        
        int futhark_mc_segmap_task_236665_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236664_task);
        
        if (futhark_mc_segmap_task_236665_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220479.mem + gtid_215102 * t_n_m_203740 * (int64_t) 8,
                    mem_220367 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220483.mem + gtid_215102 * t_n_m_203740 * (int64_t) 8,
                    mem_220370 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220322);
    free(mem_220325);
    free(mem_220328);
    free(mem_220367);
    free(mem_220370);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236650_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236650_end -
                 futhark_mc_segmap_parloop_236650_start;
        
        ctx->futhark_mc_segmap_parloop_236650_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236650_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236650_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236648(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215101 = tid;
    int num_tasks_233866 = info.nsubtasks;
    struct futhark_mc_task_236637 *futhark_mc_task_236637 =
                                  (struct futhark_mc_task_236637 *) args;
    struct futhark_context *ctx = futhark_mc_task_236637->ctx;
    uint64_t futhark_mc_segmap_nested_task_236648_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236648_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236637->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236637->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236637->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236637->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236637->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236637->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236637->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236637->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236637->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236637->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236637->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236637->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236637->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236637->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236637->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236637->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236637->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236637->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220330 = futhark_mc_task_236637->free_bytes_220330;
    struct memblock mem_220479 = {.desc ="mem_220479", .mem =
                                  futhark_mc_task_236637->free_mem_220479,
                                  .size =0, .references =NULL};
    struct memblock mem_220483 = {.desc ="mem_220483", .mem =
                                  futhark_mc_task_236637->free_mem_220483,
                                  .size =0, .references =NULL};
    int64_t iter_233982;
    struct futhark_mc_segmap_parloop_struct_236649
    futhark_mc_segmap_parloop_struct_236649;
    
    futhark_mc_segmap_parloop_struct_236649.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236649.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236649.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236649.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236649.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236649.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236649.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236649.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236649.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236649.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236649.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236649.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236649.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236649.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236649.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236649.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236649.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236649.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236649.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236649.free_bytes_220330 = bytes_220330;
    futhark_mc_segmap_parloop_struct_236649.free_mem_220479 = mem_220479.mem;
    futhark_mc_segmap_parloop_struct_236649.free_mem_220483 = mem_220483.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236650_task;
    
    futhark_mc_segmap_parloop_236650_task.name =
        "futhark_mc_segmap_parloop_236650";
    futhark_mc_segmap_parloop_236650_task.fn = futhark_mc_segmap_parloop_236650;
    futhark_mc_segmap_parloop_236650_task.args =
        &futhark_mc_segmap_parloop_struct_236649;
    futhark_mc_segmap_parloop_236650_task.iterations = iterations;
    futhark_mc_segmap_parloop_236650_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236650_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236650_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236650_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236650_task);
    
    if (futhark_mc_segmap_parloop_236650_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236650_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236650_total_end -
                 futhark_mc_segmap_parloop_236650_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236650_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236650_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236650_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236648_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236648_end -
                 futhark_mc_segmap_nested_task_236648_start;
        
        ctx->futhark_mc_segmap_nested_task_236648_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236648_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236648_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236688 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    int64_t free_bytes_220494;
    unsigned char *free_mem_220709;
    unsigned char *free_mem_220713;
};
struct futhark_mc_segmap_parloop_struct_236690 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    int64_t free_bytes_220494;
    unsigned char *free_mem_220709;
    unsigned char *free_mem_220713;
};
static int futhark_mc_segmap_parloop_236691(void *args, int64_t start,
                                            int64_t end, int flat_tid_215286,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236690
    *futhark_mc_segmap_parloop_struct_236690 =
    (struct futhark_mc_segmap_parloop_struct_236690 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236690->ctx;
    uint64_t futhark_mc_segmap_parloop_236691_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236691_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236690->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236690->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236690->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236690->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236690->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236690->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236690->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236690->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236690->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236690->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236690->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236690->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236690->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236690->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236690->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236690->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236690->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236690->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220494 =
            futhark_mc_segmap_parloop_struct_236690->free_bytes_220494;
    struct memblock mem_220709 = {.desc ="mem_220709", .mem =
                                  futhark_mc_segmap_parloop_struct_236690->free_mem_220709,
                                  .size =0, .references =NULL};
    struct memblock mem_220713 = {.desc ="mem_220713", .mem =
                                  futhark_mc_segmap_parloop_struct_236690->free_mem_220713,
                                  .size =0, .references =NULL};
    size_t mem_220573_cached_sizze_236692 = 0;
    unsigned char *mem_220573 = NULL;
    size_t mem_220588_cached_sizze_236693 = 0;
    unsigned char *mem_220588 = NULL;
    size_t mem_220591_cached_sizze_236694 = 0;
    unsigned char *mem_220591 = NULL;
    size_t mem_220618_cached_sizze_236695 = 0;
    unsigned char *mem_220618 = NULL;
    size_t mem_220621_cached_sizze_236696 = 0;
    unsigned char *mem_220621 = NULL;
    size_t mem_220638_cached_sizze_236697 = 0;
    unsigned char *mem_220638 = NULL;
    size_t mem_220641_cached_sizze_236698 = 0;
    unsigned char *mem_220641 = NULL;
    size_t mem_220668_cached_sizze_236699 = 0;
    unsigned char *mem_220668 = NULL;
    size_t mem_220671_cached_sizze_236700 = 0;
    unsigned char *mem_220671 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234327 = start;
    
    if (mem_220573_cached_sizze_236692 < (size_t) bytes_217420) {
        mem_220573 = realloc(mem_220573, bytes_217420);
        mem_220573_cached_sizze_236692 = bytes_217420;
    }
    if (mem_220588_cached_sizze_236693 < (size_t) bytes_217420) {
        mem_220588 = realloc(mem_220588, bytes_217420);
        mem_220588_cached_sizze_236693 = bytes_217420;
    }
    if (mem_220591_cached_sizze_236694 < (size_t) bytes_217420) {
        mem_220591 = realloc(mem_220591, bytes_217420);
        mem_220591_cached_sizze_236694 = bytes_217420;
    }
    if (mem_220618_cached_sizze_236695 < (size_t) bytes_217900) {
        mem_220618 = realloc(mem_220618, bytes_217900);
        mem_220618_cached_sizze_236695 = bytes_217900;
    }
    if (mem_220621_cached_sizze_236696 < (size_t) bytes_217900) {
        mem_220621 = realloc(mem_220621, bytes_217900);
        mem_220621_cached_sizze_236696 = bytes_217900;
    }
    if (mem_220638_cached_sizze_236697 < (size_t) bytes_220494) {
        mem_220638 = realloc(mem_220638, bytes_220494);
        mem_220638_cached_sizze_236697 = bytes_220494;
    }
    if (mem_220641_cached_sizze_236698 < (size_t) bytes_220494) {
        mem_220641 = realloc(mem_220641, bytes_220494);
        mem_220641_cached_sizze_236698 = bytes_220494;
    }
    if (mem_220668_cached_sizze_236699 < (size_t) bytes_220494) {
        mem_220668 = realloc(mem_220668, bytes_220494);
        mem_220668_cached_sizze_236699 = bytes_220494;
    }
    if (mem_220671_cached_sizze_236700 < (size_t) bytes_220494) {
        mem_220671 = realloc(mem_220671, bytes_220494);
        mem_220671_cached_sizze_236700 = bytes_220494;
    }
    for (; iter_234327 < end; iter_234327++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234469 = partition_sizze_203667;
        int64_t gtid_215287 = iter_234327;
        int64_t remnant_234470 = iter_234327 - gtid_215287;
        int64_t x_206523;
        
        x_206523 = ((int64_t *) mem_217461.mem)[gtid_215287];
        for (int64_t i_234328 = 0; i_234328 < n_203572; i_234328++) {
            double x_234330;
            
            x_234330 = ((double *) mem_217415.mem)[gtid_215287 * n_203572 +
                                                   i_234328];
            
            double x_234331;
            
            x_234331 = ((double *) mem_219926.mem)[gtid_215287 * n_203572 +
                                                   i_234328];
            
            double defunc_1_f_res_234332 = x_234330 - x_234331;
            
            ((double *) mem_220573)[i_234328] = defunc_1_f_res_234332;
        }
        for (int64_t i_234334 = 0; i_234334 < n_203572; i_234334++) {
            int64_t x_234337;
            
            x_234337 = ((int64_t *) mem_217458.mem)[gtid_215287 * n_203572 +
                                                    i_234334];
            
            bool cond_234338 = sle64((int64_t) 0, x_234337);
            double defunc_0_f_res_234339;
            
            if (cond_234338) {
                bool y_234340 = slt64(x_234337, n_203572);
                bool bounds_check_234341 = cond_234338 && y_234340;
                bool index_certs_234342;
                
                if (!bounds_check_234341) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_234337,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_234343;
                
                defunc_0_f_res_t_res_234343 = ((double *) mem_220573)[x_234337];
                defunc_0_f_res_234339 = defunc_0_f_res_t_res_234343;
            } else {
                defunc_0_f_res_234339 = 0.0;
            }
            
            double defunc_0_f_res_234344;
            
            if (cond_234338) {
                bool y_234345 = slt64(x_234337, n_203572);
                bool bounds_check_234346 = cond_234338 && y_234345;
                bool index_certs_234347;
                
                if (!bounds_check_234346) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_234337,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_234348;
                
                defunc_0_f_res_t_res_234348 =
                    ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                      (gtid_215287 *
                                                       ctx_param_ext_217985 +
                                                       x_234337 *
                                                       ctx_param_ext_217987)];
                defunc_0_f_res_234344 = defunc_0_f_res_t_res_234348;
            } else {
                defunc_0_f_res_234344 = 0.0;
            }
            ((double *) mem_220588)[i_234334] = defunc_0_f_res_234344;
            ((double *) mem_220591)[i_234334] = defunc_0_f_res_234339;
        }
        for (int64_t i_234351 = 0; i_234351 < t_n_m_203740; i_234351++) {
            int64_t x_234354;
            
            x_234354 = ((int64_t *) mem_217953.mem)[gtid_215287 * t_n_m_203740 +
                                                    i_234351];
            
            double x_234355;
            
            x_234355 = ((double *) mem_217957.mem)[gtid_215287 * t_n_m_203740 +
                                                   i_234351];
            
            int64_t min_arg_234356 = mul64(jump_t_203582, i_234351);
            int64_t min_res_234357 = smin64(i_203760, min_arg_234356);
            int64_t defunc_0_g_res_234358 = add64((int64_t) 1, min_res_234357);
            
            for (int64_t i_234363 = 0; i_234363 < q_t_203576; i_234363++) {
                bool cond_234366 = sle64(x_206523, i_234363);
                int64_t defunc_0_f_res_234367;
                
                if (cond_234366) {
                    defunc_0_f_res_234367 = (int64_t) 0;
                } else {
                    int64_t i_234368 = add64(x_234354, i_234363);
                    int64_t defunc_0_add_arg_234369;
                    
                    defunc_0_add_arg_234369 =
                        ((int64_t *) mem_217458.mem)[gtid_215287 * n_203572 +
                                                     i_234368];
                    
                    int64_t defunc_1_add_res_234370 = add64((int64_t) 1,
                                                            defunc_0_add_arg_234369);
                    
                    defunc_0_f_res_234367 = defunc_1_add_res_234370;
                }
                
                double defunc_0_f_res_234371;
                
                if (cond_234366) {
                    defunc_0_f_res_234371 = 0.0;
                } else {
                    int64_t i_234372 = add64(x_234354, i_234363);
                    double defunc_0_add_arg_234373;
                    
                    defunc_0_add_arg_234373 = ((double *) mem_220588)[i_234372];
                    defunc_0_f_res_234371 = defunc_0_add_arg_234373;
                }
                
                int64_t binop_p_234374 = sub64(defunc_0_f_res_234367,
                                               defunc_0_g_res_234358);
                double defunc_0_f_res_234375 = sitofp_i64_f64(binop_p_234374);
                double abs_res_234376 = fabs(defunc_0_f_res_234375);
                double tmp1_234377 = abs_res_234376 / x_234355;
                double x_234378 = tmp1_234377 * tmp1_234377;
                double y_234379 = tmp1_234377 * x_234378;
                double tmp2_234380 = 1.0 - y_234379;
                double x_234381 = tmp2_234380 * tmp2_234380;
                double tmp3_234382 = tmp2_234380 * x_234381;
                double tmp4_234383 = defunc_0_f_res_234371 * tmp3_234382;
                
                ((double *) mem_220638)[i_234363] = defunc_0_f_res_234375;
                ((double *) mem_220641)[i_234363] = tmp4_234383;
            }
            
            double defunc_2_reduce_res_234388;
            double defunc_2_reduce_res_234389;
            double defunc_2_reduce_res_234390;
            double defunc_2_reduce_res_234391;
            double defunc_2_reduce_res_234392;
            double redout_234396;
            double redout_234397;
            double redout_234398;
            double redout_234399;
            double redout_234400;
            
            redout_234396 = 0.0;
            redout_234397 = 0.0;
            redout_234398 = 0.0;
            redout_234399 = 0.0;
            redout_234400 = 0.0;
            for (int64_t i_234395 = 0; i_234395 < q_t_203576; i_234395++) {
                double x_234403;
                
                x_234403 = ((double *) mem_220638)[i_234395];
                
                double x_234404;
                
                x_234404 = ((double *) mem_220641)[i_234395];
                
                double defunc_1_f_res_234405 = x_234403 * x_234404;
                double defunc_1_f_res_234406 = x_234403 * defunc_1_f_res_234405;
                double defunc_1_f_res_234407 = x_234403 * defunc_1_f_res_234406;
                double defunc_1_f_res_234408 = x_234403 * defunc_1_f_res_234407;
                double defunc_1_op_res_234409 = x_234404 + redout_234396;
                double defunc_1_op_res_234410 = defunc_1_f_res_234405 +
                       redout_234397;
                double defunc_1_op_res_234411 = defunc_1_f_res_234406 +
                       redout_234398;
                double defunc_1_op_res_234412 = defunc_1_f_res_234407 +
                       redout_234399;
                double defunc_1_op_res_234413 = defunc_1_f_res_234408 +
                       redout_234400;
                
                ((double *) mem_220668)[i_234395] = defunc_1_f_res_234406;
                ((double *) mem_220671)[i_234395] = defunc_1_f_res_234405;
                
                double redout_tmp_234478 = defunc_1_op_res_234409;
                double redout_tmp_234479 = defunc_1_op_res_234410;
                double redout_tmp_234480 = defunc_1_op_res_234411;
                double redout_tmp_234481 = defunc_1_op_res_234412;
                double redout_tmp_234482 = defunc_1_op_res_234413;
                
                redout_234396 = redout_tmp_234478;
                redout_234397 = redout_tmp_234479;
                redout_234398 = redout_tmp_234480;
                redout_234399 = redout_tmp_234481;
                redout_234400 = redout_tmp_234482;
            }
            defunc_2_reduce_res_234388 = redout_234396;
            defunc_2_reduce_res_234389 = redout_234397;
            defunc_2_reduce_res_234390 = redout_234398;
            defunc_2_reduce_res_234391 = redout_234399;
            defunc_2_reduce_res_234392 = redout_234400;
            
            double x_234416 = defunc_2_reduce_res_234390 *
                   defunc_2_reduce_res_234392;
            double y_234417 = defunc_2_reduce_res_234391 *
                   defunc_2_reduce_res_234391;
            double a12_234418 = x_234416 - y_234417;
            double x_234419 = defunc_2_reduce_res_234390 *
                   defunc_2_reduce_res_234391;
            double y_234420 = defunc_2_reduce_res_234389 *
                   defunc_2_reduce_res_234392;
            double b12_234421 = x_234419 - y_234420;
            double x_234422 = defunc_2_reduce_res_234389 *
                   defunc_2_reduce_res_234391;
            double y_234423 = defunc_2_reduce_res_234390 *
                   defunc_2_reduce_res_234390;
            double c12_234424 = x_234422 - y_234423;
            double x_234425 = defunc_2_reduce_res_234388 *
                   defunc_2_reduce_res_234392;
            double b2_234426 = x_234425 - y_234423;
            double x_234427 = defunc_2_reduce_res_234389 *
                   defunc_2_reduce_res_234390;
            double y_234428 = defunc_2_reduce_res_234388 *
                   defunc_2_reduce_res_234391;
            double c2_234429 = x_234427 - y_234428;
            double x_234430 = defunc_2_reduce_res_234388 * a12_234418;
            double y_234431 = defunc_2_reduce_res_234389 * b12_234421;
            double x_234432 = x_234430 + y_234431;
            double y_234433 = defunc_2_reduce_res_234390 * c12_234424;
            double y_234434 = x_234432 + y_234433;
            double det_234435 = 1.0 / y_234434;
            double a12_234436 = a12_234418 * det_234435;
            double b12_234437 = b12_234421 * det_234435;
            double c12_234438 = c12_234424 * det_234435;
            double b2_234439 = b2_234426 * det_234435;
            double c2_234440 = c2_234429 * det_234435;
            double defunc_2_reduce_res_234441;
            double defunc_2_reduce_res_234442;
            double redout_234444;
            double redout_234445;
            
            redout_234444 = 0.0;
            redout_234445 = 0.0;
            for (int64_t i_234443 = 0; i_234443 < q_t_203576; i_234443++) {
                double x_234446;
                
                x_234446 = ((double *) mem_220641)[i_234443];
                
                double x_234447;
                
                x_234447 = ((double *) mem_220671)[i_234443];
                
                double x_234448;
                
                x_234448 = ((double *) mem_220668)[i_234443];
                
                bool cond_234449 = sle64(x_206523, i_234443);
                double defunc_0_f_res_234450;
                
                if (cond_234449) {
                    defunc_0_f_res_234450 = 0.0;
                } else {
                    int64_t i_234451 = add64(x_234354, i_234443);
                    double defunc_0_add_arg_234452;
                    
                    defunc_0_add_arg_234452 = ((double *) mem_220591)[i_234451];
                    defunc_0_f_res_234450 = defunc_0_add_arg_234452;
                }
                
                double x_234453 = a12_234436 * x_234446;
                double y_234454 = b12_234437 * x_234447;
                double x_234455 = x_234453 + y_234454;
                double y_234456 = c12_234438 * x_234448;
                double x_234457 = x_234455 + y_234456;
                double defunc_9_fit_fun_res_234458 = defunc_0_f_res_234450 *
                       x_234457;
                double x_234459 = b12_234437 * x_234446;
                double y_234460 = b2_234439 * x_234447;
                double x_234461 = x_234459 + y_234460;
                double y_234462 = c2_234440 * x_234448;
                double x_234463 = x_234461 + y_234462;
                double defunc_9_slope_fun_res_234464 = defunc_0_f_res_234450 *
                       x_234463;
                double defunc_1_op_res_234465 = defunc_9_fit_fun_res_234458 +
                       redout_234444;
                double defunc_1_op_res_234466 = defunc_9_slope_fun_res_234464 +
                       redout_234445;
                double redout_tmp_234485 = defunc_1_op_res_234465;
                double redout_tmp_234486 = defunc_1_op_res_234466;
                
                redout_234444 = redout_tmp_234485;
                redout_234445 = redout_tmp_234486;
            }
            defunc_2_reduce_res_234441 = redout_234444;
            defunc_2_reduce_res_234442 = redout_234445;
            ((double *) mem_220618)[i_234351] = defunc_2_reduce_res_234441;
            ((double *) mem_220621)[i_234351] = defunc_2_reduce_res_234442;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220709.mem + gtid_215287 * t_n_m_203740 * (int64_t) 8,
                    mem_220618 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220713.mem + gtid_215287 * t_n_m_203740 * (int64_t) 8,
                    mem_220621 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220573);
    free(mem_220588);
    free(mem_220591);
    free(mem_220618);
    free(mem_220621);
    free(mem_220638);
    free(mem_220641);
    free(mem_220668);
    free(mem_220671);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236691_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236691_end -
                 futhark_mc_segmap_parloop_236691_start;
        
        ctx->futhark_mc_segmap_parloop_236691_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236691_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236691_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236689(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215286 = tid;
    int num_tasks_234326 = info.nsubtasks;
    struct futhark_mc_task_236688 *futhark_mc_task_236688 =
                                  (struct futhark_mc_task_236688 *) args;
    struct futhark_context *ctx = futhark_mc_task_236688->ctx;
    uint64_t futhark_mc_segmap_task_236689_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236689_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236688->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236688->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236688->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236688->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236688->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236688->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236688->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236688->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236688->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236688->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236688->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236688->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236688->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236688->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236688->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236688->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236688->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236688->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220494 = futhark_mc_task_236688->free_bytes_220494;
    struct memblock mem_220709 = {.desc ="mem_220709", .mem =
                                  futhark_mc_task_236688->free_mem_220709,
                                  .size =0, .references =NULL};
    struct memblock mem_220713 = {.desc ="mem_220713", .mem =
                                  futhark_mc_task_236688->free_mem_220713,
                                  .size =0, .references =NULL};
    int64_t iter_234327;
    struct futhark_mc_segmap_parloop_struct_236690
    futhark_mc_segmap_parloop_struct_236690;
    
    futhark_mc_segmap_parloop_struct_236690.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236690.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236690.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236690.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236690.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236690.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236690.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236690.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236690.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236690.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236690.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236690.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236690.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236690.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236690.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236690.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236690.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236690.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236690.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236690.free_bytes_220494 = bytes_220494;
    futhark_mc_segmap_parloop_struct_236690.free_mem_220709 = mem_220709.mem;
    futhark_mc_segmap_parloop_struct_236690.free_mem_220713 = mem_220713.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236691_task;
    
    futhark_mc_segmap_parloop_236691_task.name =
        "futhark_mc_segmap_parloop_236691";
    futhark_mc_segmap_parloop_236691_task.fn = futhark_mc_segmap_parloop_236691;
    futhark_mc_segmap_parloop_236691_task.args =
        &futhark_mc_segmap_parloop_struct_236690;
    futhark_mc_segmap_parloop_236691_task.iterations = iterations;
    futhark_mc_segmap_parloop_236691_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236691_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236691_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236691_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236691_task);
    
    if (futhark_mc_segmap_parloop_236691_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236691_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236691_total_end -
                 futhark_mc_segmap_parloop_236691_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236691_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236691_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236691_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236689_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236689_end -
                 futhark_mc_segmap_task_236689_start;
        
        ctx->futhark_mc_segmap_task_236689_runs[tid]++;
        ctx->futhark_mc_segmap_task_236689_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236689_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236702 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217461;
    int64_t free_bytes_217900;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_219926;
    int64_t free_bytes_220494;
    unsigned char *free_mem_220709;
    unsigned char *free_mem_220713;
};
struct futhark_mc_task_236709 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215421;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220486;
};
struct futhark_mc_segmap_parloop_struct_236711 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215421;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_219926;
    unsigned char *free_mem_220486;
};
static int futhark_mc_segmap_parloop_236712(void *args, int64_t start,
                                            int64_t end, int flat_tid_234488,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236711
    *futhark_mc_segmap_parloop_struct_236711 =
    (struct futhark_mc_segmap_parloop_struct_236711 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236711->ctx;
    uint64_t futhark_mc_segmap_parloop_236712_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236712_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236711->free_n_203572;
    int64_t gtid_215421 =
            futhark_mc_segmap_parloop_struct_236711->free_gtid_215421;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236711->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236711->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220486 = {.desc ="mem_220486", .mem =
                                  futhark_mc_segmap_parloop_struct_236711->free_mem_220486,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234746 = start;
    
    for (; iter_234746 < end; iter_234746++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234747 = n_203572;
        int64_t gtid_234489 = iter_234746;
        int64_t remnant_234748 = iter_234746 - gtid_234489;
        double x_234490;
        
        x_234490 = ((double *) mem_217415.mem)[gtid_215421 * n_203572 +
                                               gtid_234489];
        
        double x_234491;
        
        x_234491 = ((double *) mem_219926.mem)[gtid_215421 * n_203572 +
                                               gtid_234489];
        
        double defunc_1_f_res_234492 = x_234490 - x_234491;
        
        ((double *) mem_220486.mem)[gtid_234489] = defunc_1_f_res_234492;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236712_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236712_end -
                 futhark_mc_segmap_parloop_236712_start;
        
        ctx->futhark_mc_segmap_parloop_236712_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236712_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236712_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236710(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234488 = tid;
    int num_tasks_234745 = info.nsubtasks;
    struct futhark_mc_task_236709 *futhark_mc_task_236709 =
                                  (struct futhark_mc_task_236709 *) args;
    struct futhark_context *ctx = futhark_mc_task_236709->ctx;
    uint64_t futhark_mc_segmap_task_236710_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236710_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236709->free_n_203572;
    int64_t gtid_215421 = futhark_mc_task_236709->free_gtid_215421;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236709->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236709->free_mem_219926,
                                  .size =0, .references =NULL};
    struct memblock mem_220486 = {.desc ="mem_220486", .mem =
                                  futhark_mc_task_236709->free_mem_220486,
                                  .size =0, .references =NULL};
    int64_t iter_234746;
    struct futhark_mc_segmap_parloop_struct_236711
    futhark_mc_segmap_parloop_struct_236711;
    
    futhark_mc_segmap_parloop_struct_236711.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236711.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236711.free_gtid_215421 = gtid_215421;
    futhark_mc_segmap_parloop_struct_236711.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236711.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236711.free_mem_220486 = mem_220486.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236712_task;
    
    futhark_mc_segmap_parloop_236712_task.name =
        "futhark_mc_segmap_parloop_236712";
    futhark_mc_segmap_parloop_236712_task.fn = futhark_mc_segmap_parloop_236712;
    futhark_mc_segmap_parloop_236712_task.args =
        &futhark_mc_segmap_parloop_struct_236711;
    futhark_mc_segmap_parloop_236712_task.iterations = iterations;
    futhark_mc_segmap_parloop_236712_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236712_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236712_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236712_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236712_task);
    
    if (futhark_mc_segmap_parloop_236712_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236712_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236712_total_end -
                 futhark_mc_segmap_parloop_236712_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236712_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236712_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236712_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236710_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236710_end -
                 futhark_mc_segmap_task_236710_start;
        
        ctx->futhark_mc_segmap_task_236710_runs[tid]++;
        ctx->futhark_mc_segmap_task_236710_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236710_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236713 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215421;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220486;
    unsigned char *free_mem_220489;
    unsigned char *free_mem_220492;
};
struct futhark_mc_segmap_parloop_struct_236715 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215421;
    unsigned char *free_mem_217458;
    int64_t free_ctx_param_ext_217984;
    int64_t free_ctx_param_ext_217985;
    int64_t free_ctx_param_ext_217987;
    unsigned char *free_mem_param_217989;
    unsigned char *free_mem_220486;
    unsigned char *free_mem_220489;
    unsigned char *free_mem_220492;
};
static int futhark_mc_segmap_parloop_236716(void *args, int64_t start,
                                            int64_t end, int flat_tid_234493,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236715
    *futhark_mc_segmap_parloop_struct_236715 =
    (struct futhark_mc_segmap_parloop_struct_236715 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236715->ctx;
    uint64_t futhark_mc_segmap_parloop_236716_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236716_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236715->free_n_203572;
    int64_t gtid_215421 =
            futhark_mc_segmap_parloop_struct_236715->free_gtid_215421;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236715->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236715->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236715->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236715->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236715->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220486 = {.desc ="mem_220486", .mem =
                                  futhark_mc_segmap_parloop_struct_236715->free_mem_220486,
                                  .size =0, .references =NULL};
    struct memblock mem_220489 = {.desc ="mem_220489", .mem =
                                  futhark_mc_segmap_parloop_struct_236715->free_mem_220489,
                                  .size =0, .references =NULL};
    struct memblock mem_220492 = {.desc ="mem_220492", .mem =
                                  futhark_mc_segmap_parloop_struct_236715->free_mem_220492,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234750 = start;
    
    for (; iter_234750 < end; iter_234750++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234759 = n_203572;
        int64_t gtid_234494 = iter_234750;
        int64_t remnant_234760 = iter_234750 - gtid_234494;
        int64_t x_234495;
        
        x_234495 = ((int64_t *) mem_217458.mem)[gtid_215421 * n_203572 +
                                                gtid_234494];
        
        bool cond_234496 = sle64((int64_t) 0, x_234495);
        double defunc_0_f_res_234497;
        
        if (cond_234496) {
            bool y_234751 = slt64(x_234495, n_203572);
            bool bounds_check_234752 = cond_234496 && y_234751;
            bool index_certs_234753;
            
            if (!bounds_check_234752) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_234495,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_234754;
            
            defunc_0_f_res_t_res_234754 = ((double *) mem_220486.mem)[x_234495];
            defunc_0_f_res_234497 = defunc_0_f_res_t_res_234754;
        } else {
            defunc_0_f_res_234497 = 0.0;
        }
        
        double defunc_0_f_res_234502;
        
        if (cond_234496) {
            bool y_234755 = slt64(x_234495, n_203572);
            bool bounds_check_234756 = cond_234496 && y_234755;
            bool index_certs_234757;
            
            if (!bounds_check_234756) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_234495,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_234758;
            
            defunc_0_f_res_t_res_234758 =
                ((double *) mem_param_217989.mem)[ctx_param_ext_217984 +
                                                  (gtid_215421 *
                                                   ctx_param_ext_217985 +
                                                   x_234495 *
                                                   ctx_param_ext_217987)];
            defunc_0_f_res_234502 = defunc_0_f_res_t_res_234758;
        } else {
            defunc_0_f_res_234502 = 0.0;
        }
        ((double *) mem_220489.mem)[gtid_234494] = defunc_0_f_res_234502;
        ((double *) mem_220492.mem)[gtid_234494] = defunc_0_f_res_234497;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236716_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236716_end -
                 futhark_mc_segmap_parloop_236716_start;
        
        ctx->futhark_mc_segmap_parloop_236716_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236716_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236716_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236714(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234493 = tid;
    int num_tasks_234749 = info.nsubtasks;
    struct futhark_mc_task_236713 *futhark_mc_task_236713 =
                                  (struct futhark_mc_task_236713 *) args;
    struct futhark_context *ctx = futhark_mc_task_236713->ctx;
    uint64_t futhark_mc_segmap_task_236714_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236714_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236713->free_n_203572;
    int64_t gtid_215421 = futhark_mc_task_236713->free_gtid_215421;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236713->free_mem_217458,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236713->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236713->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236713->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236713->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_220486 = {.desc ="mem_220486", .mem =
                                  futhark_mc_task_236713->free_mem_220486,
                                  .size =0, .references =NULL};
    struct memblock mem_220489 = {.desc ="mem_220489", .mem =
                                  futhark_mc_task_236713->free_mem_220489,
                                  .size =0, .references =NULL};
    struct memblock mem_220492 = {.desc ="mem_220492", .mem =
                                  futhark_mc_task_236713->free_mem_220492,
                                  .size =0, .references =NULL};
    int64_t iter_234750;
    struct futhark_mc_segmap_parloop_struct_236715
    futhark_mc_segmap_parloop_struct_236715;
    
    futhark_mc_segmap_parloop_struct_236715.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236715.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236715.free_gtid_215421 = gtid_215421;
    futhark_mc_segmap_parloop_struct_236715.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236715.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236715.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236715.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236715.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236715.free_mem_220486 = mem_220486.mem;
    futhark_mc_segmap_parloop_struct_236715.free_mem_220489 = mem_220489.mem;
    futhark_mc_segmap_parloop_struct_236715.free_mem_220492 = mem_220492.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236716_task;
    
    futhark_mc_segmap_parloop_236716_task.name =
        "futhark_mc_segmap_parloop_236716";
    futhark_mc_segmap_parloop_236716_task.fn = futhark_mc_segmap_parloop_236716;
    futhark_mc_segmap_parloop_236716_task.args =
        &futhark_mc_segmap_parloop_struct_236715;
    futhark_mc_segmap_parloop_236716_task.iterations = iterations;
    futhark_mc_segmap_parloop_236716_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236716_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236716_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236716_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236716_task);
    
    if (futhark_mc_segmap_parloop_236716_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236716_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236716_total_end -
                 futhark_mc_segmap_parloop_236716_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236716_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236716_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236716_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236714_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236714_end -
                 futhark_mc_segmap_task_236714_start;
        
        ctx->futhark_mc_segmap_task_236714_runs[tid]++;
        ctx->futhark_mc_segmap_task_236714_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236714_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236717 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_215421;
    int64_t free_x_215426;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220489;
    unsigned char *free_mem_220492;
    int64_t free_bytes_220494;
    unsigned char *free_mem_220567;
    unsigned char *free_mem_220570;
};
struct futhark_mc_segmap_parloop_struct_236719 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_215421;
    int64_t free_x_215426;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220489;
    unsigned char *free_mem_220492;
    int64_t free_bytes_220494;
    unsigned char *free_mem_220567;
    unsigned char *free_mem_220570;
};
static int futhark_mc_segmap_parloop_236720(void *args, int64_t start,
                                            int64_t end, int flat_tid_234624,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236719
    *futhark_mc_segmap_parloop_struct_236719 =
    (struct futhark_mc_segmap_parloop_struct_236719 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236719->ctx;
    uint64_t futhark_mc_segmap_parloop_236720_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236720_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236719->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236719->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236719->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236719->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236719->free_i_203760;
    int64_t gtid_215421 =
            futhark_mc_segmap_parloop_struct_236719->free_gtid_215421;
    int64_t x_215426 = futhark_mc_segmap_parloop_struct_236719->free_x_215426;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236719->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236719->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236719->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220489 = {.desc ="mem_220489", .mem =
                                  futhark_mc_segmap_parloop_struct_236719->free_mem_220489,
                                  .size =0, .references =NULL};
    struct memblock mem_220492 = {.desc ="mem_220492", .mem =
                                  futhark_mc_segmap_parloop_struct_236719->free_mem_220492,
                                  .size =0, .references =NULL};
    int64_t bytes_220494 =
            futhark_mc_segmap_parloop_struct_236719->free_bytes_220494;
    struct memblock mem_220567 = {.desc ="mem_220567", .mem =
                                  futhark_mc_segmap_parloop_struct_236719->free_mem_220567,
                                  .size =0, .references =NULL};
    struct memblock mem_220570 = {.desc ="mem_220570", .mem =
                                  futhark_mc_segmap_parloop_struct_236719->free_mem_220570,
                                  .size =0, .references =NULL};
    size_t mem_234631_cached_sizze_236721 = 0;
    unsigned char *mem_234631 = NULL;
    size_t mem_234633_cached_sizze_236722 = 0;
    unsigned char *mem_234633 = NULL;
    size_t mem_234660_cached_sizze_236723 = 0;
    unsigned char *mem_234660 = NULL;
    size_t mem_234662_cached_sizze_236724 = 0;
    unsigned char *mem_234662 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234762 = start;
    
    if (mem_234631_cached_sizze_236721 < (size_t) bytes_220494) {
        mem_234631 = realloc(mem_234631, bytes_220494);
        mem_234631_cached_sizze_236721 = bytes_220494;
    }
    if (mem_234633_cached_sizze_236722 < (size_t) bytes_220494) {
        mem_234633 = realloc(mem_234633, bytes_220494);
        mem_234633_cached_sizze_236722 = bytes_220494;
    }
    if (mem_234660_cached_sizze_236723 < (size_t) bytes_220494) {
        mem_234660 = realloc(mem_234660, bytes_220494);
        mem_234660_cached_sizze_236723 = bytes_220494;
    }
    if (mem_234662_cached_sizze_236724 < (size_t) bytes_220494) {
        mem_234662 = realloc(mem_234662, bytes_220494);
        mem_234662_cached_sizze_236724 = bytes_220494;
    }
    for (; iter_234762 < end; iter_234762++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234831 = t_n_m_203740;
        int64_t gtid_234625 = iter_234762;
        int64_t remnant_234832 = iter_234762 - gtid_234625;
        int64_t x_234626;
        
        x_234626 = ((int64_t *) mem_217953.mem)[gtid_215421 * t_n_m_203740 +
                                                gtid_234625];
        
        double x_234627;
        
        x_234627 = ((double *) mem_217957.mem)[gtid_215421 * t_n_m_203740 +
                                               gtid_234625];
        
        int64_t min_arg_234628 = mul64(jump_t_203582, gtid_234625);
        int64_t min_res_234629 = smin64(i_203760, min_arg_234628);
        int64_t defunc_0_g_res_234630 = add64((int64_t) 1, min_res_234629);
        
        for (int64_t i_234763 = 0; i_234763 < q_t_203576; i_234763++) {
            bool cond_234766 = sle64(x_215426, i_234763);
            int64_t defunc_0_f_res_234767;
            
            if (cond_234766) {
                defunc_0_f_res_234767 = (int64_t) 0;
            } else {
                int64_t i_234768 = add64(x_234626, i_234763);
                int64_t defunc_0_add_arg_234769;
                
                defunc_0_add_arg_234769 =
                    ((int64_t *) mem_217458.mem)[gtid_215421 * n_203572 +
                                                 i_234768];
                
                int64_t defunc_1_add_res_234770 = add64((int64_t) 1,
                                                        defunc_0_add_arg_234769);
                
                defunc_0_f_res_234767 = defunc_1_add_res_234770;
            }
            
            double defunc_0_f_res_234771;
            
            if (cond_234766) {
                defunc_0_f_res_234771 = 0.0;
            } else {
                int64_t i_234772 = add64(x_234626, i_234763);
                double defunc_0_add_arg_234773;
                
                defunc_0_add_arg_234773 = ((double *) mem_220489.mem)[i_234772];
                defunc_0_f_res_234771 = defunc_0_add_arg_234773;
            }
            
            int64_t binop_p_234774 = sub64(defunc_0_f_res_234767,
                                           defunc_0_g_res_234630);
            double defunc_0_f_res_234775 = sitofp_i64_f64(binop_p_234774);
            double abs_res_234776 = fabs(defunc_0_f_res_234775);
            double tmp1_234777 = abs_res_234776 / x_234627;
            double x_234778 = tmp1_234777 * tmp1_234777;
            double y_234779 = tmp1_234777 * x_234778;
            double tmp2_234780 = 1.0 - y_234779;
            double x_234781 = tmp2_234780 * tmp2_234780;
            double tmp3_234782 = tmp2_234780 * x_234781;
            double tmp4_234783 = defunc_0_f_res_234771 * tmp3_234782;
            
            ((double *) mem_234631)[i_234763] = defunc_0_f_res_234775;
            ((double *) mem_234633)[i_234763] = tmp4_234783;
        }
        
        double defunc_2_reduce_res_234664;
        double defunc_2_reduce_res_234665;
        double defunc_2_reduce_res_234666;
        double defunc_2_reduce_res_234667;
        double defunc_2_reduce_res_234668;
        double redout_234787;
        double redout_234788;
        double redout_234789;
        double redout_234790;
        double redout_234791;
        
        redout_234787 = 0.0;
        redout_234788 = 0.0;
        redout_234789 = 0.0;
        redout_234790 = 0.0;
        redout_234791 = 0.0;
        for (int64_t i_234786 = 0; i_234786 < q_t_203576; i_234786++) {
            double x_234794;
            
            x_234794 = ((double *) mem_234631)[i_234786];
            
            double x_234795;
            
            x_234795 = ((double *) mem_234633)[i_234786];
            
            double defunc_1_f_res_234796 = x_234794 * x_234795;
            double defunc_1_f_res_234797 = x_234794 * defunc_1_f_res_234796;
            double defunc_1_f_res_234798 = x_234794 * defunc_1_f_res_234797;
            double defunc_1_f_res_234799 = x_234794 * defunc_1_f_res_234798;
            double defunc_1_op_res_234800 = x_234795 + redout_234787;
            double defunc_1_op_res_234801 = defunc_1_f_res_234796 +
                   redout_234788;
            double defunc_1_op_res_234802 = defunc_1_f_res_234797 +
                   redout_234789;
            double defunc_1_op_res_234803 = defunc_1_f_res_234798 +
                   redout_234790;
            double defunc_1_op_res_234804 = defunc_1_f_res_234799 +
                   redout_234791;
            
            ((double *) mem_234660)[i_234786] = defunc_1_f_res_234797;
            ((double *) mem_234662)[i_234786] = defunc_1_f_res_234796;
            
            double redout_tmp_234835 = defunc_1_op_res_234800;
            double redout_tmp_234836 = defunc_1_op_res_234801;
            double redout_tmp_234837 = defunc_1_op_res_234802;
            double redout_tmp_234838 = defunc_1_op_res_234803;
            double redout_tmp_234839 = defunc_1_op_res_234804;
            
            redout_234787 = redout_tmp_234835;
            redout_234788 = redout_tmp_234836;
            redout_234789 = redout_tmp_234837;
            redout_234790 = redout_tmp_234838;
            redout_234791 = redout_tmp_234839;
        }
        defunc_2_reduce_res_234664 = redout_234787;
        defunc_2_reduce_res_234665 = redout_234788;
        defunc_2_reduce_res_234666 = redout_234789;
        defunc_2_reduce_res_234667 = redout_234790;
        defunc_2_reduce_res_234668 = redout_234791;
        
        double x_234692 = defunc_2_reduce_res_234666 *
               defunc_2_reduce_res_234668;
        double y_234693 = defunc_2_reduce_res_234667 *
               defunc_2_reduce_res_234667;
        double a12_234694 = x_234692 - y_234693;
        double x_234695 = defunc_2_reduce_res_234666 *
               defunc_2_reduce_res_234667;
        double y_234696 = defunc_2_reduce_res_234665 *
               defunc_2_reduce_res_234668;
        double b12_234697 = x_234695 - y_234696;
        double x_234698 = defunc_2_reduce_res_234665 *
               defunc_2_reduce_res_234667;
        double y_234699 = defunc_2_reduce_res_234666 *
               defunc_2_reduce_res_234666;
        double c12_234700 = x_234698 - y_234699;
        double x_234701 = defunc_2_reduce_res_234664 *
               defunc_2_reduce_res_234668;
        double b2_234702 = x_234701 - y_234699;
        double x_234703 = defunc_2_reduce_res_234665 *
               defunc_2_reduce_res_234666;
        double y_234704 = defunc_2_reduce_res_234664 *
               defunc_2_reduce_res_234667;
        double c2_234705 = x_234703 - y_234704;
        double x_234706 = defunc_2_reduce_res_234664 * a12_234694;
        double y_234707 = defunc_2_reduce_res_234665 * b12_234697;
        double x_234708 = x_234706 + y_234707;
        double y_234709 = defunc_2_reduce_res_234666 * c12_234700;
        double y_234710 = x_234708 + y_234709;
        double det_234711 = 1.0 / y_234710;
        double a12_234712 = a12_234694 * det_234711;
        double b12_234713 = b12_234697 * det_234711;
        double c12_234714 = c12_234700 * det_234711;
        double b2_234715 = b2_234702 * det_234711;
        double c2_234716 = c2_234705 * det_234711;
        double defunc_2_reduce_res_234717;
        double defunc_2_reduce_res_234718;
        double redout_234808;
        double redout_234809;
        
        redout_234808 = 0.0;
        redout_234809 = 0.0;
        for (int64_t i_234807 = 0; i_234807 < q_t_203576; i_234807++) {
            double x_234810;
            
            x_234810 = ((double *) mem_234633)[i_234807];
            
            double x_234811;
            
            x_234811 = ((double *) mem_234662)[i_234807];
            
            double x_234812;
            
            x_234812 = ((double *) mem_234660)[i_234807];
            
            bool cond_234813 = sle64(x_215426, i_234807);
            double defunc_0_f_res_234814;
            
            if (cond_234813) {
                defunc_0_f_res_234814 = 0.0;
            } else {
                int64_t i_234815 = add64(x_234626, i_234807);
                double defunc_0_add_arg_234816;
                
                defunc_0_add_arg_234816 = ((double *) mem_220492.mem)[i_234815];
                defunc_0_f_res_234814 = defunc_0_add_arg_234816;
            }
            
            double x_234817 = a12_234712 * x_234810;
            double y_234818 = b12_234713 * x_234811;
            double x_234819 = x_234817 + y_234818;
            double y_234820 = c12_234714 * x_234812;
            double x_234821 = x_234819 + y_234820;
            double defunc_9_fit_fun_res_234822 = defunc_0_f_res_234814 *
                   x_234821;
            double x_234823 = b12_234713 * x_234810;
            double y_234824 = b2_234715 * x_234811;
            double x_234825 = x_234823 + y_234824;
            double y_234826 = c2_234716 * x_234812;
            double x_234827 = x_234825 + y_234826;
            double defunc_9_slope_fun_res_234828 = defunc_0_f_res_234814 *
                   x_234827;
            double defunc_1_op_res_234829 = defunc_9_fit_fun_res_234822 +
                   redout_234808;
            double defunc_1_op_res_234830 = defunc_9_slope_fun_res_234828 +
                   redout_234809;
            double redout_tmp_234842 = defunc_1_op_res_234829;
            double redout_tmp_234843 = defunc_1_op_res_234830;
            
            redout_234808 = redout_tmp_234842;
            redout_234809 = redout_tmp_234843;
        }
        defunc_2_reduce_res_234717 = redout_234808;
        defunc_2_reduce_res_234718 = redout_234809;
        ((double *) mem_220567.mem)[gtid_234625] = defunc_2_reduce_res_234717;
        ((double *) mem_220570.mem)[gtid_234625] = defunc_2_reduce_res_234718;
    }
    
  cleanup:
    { }
    free(mem_234631);
    free(mem_234633);
    free(mem_234660);
    free(mem_234662);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236720_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236720_end -
                 futhark_mc_segmap_parloop_236720_start;
        
        ctx->futhark_mc_segmap_parloop_236720_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236720_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236720_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236718(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234624 = tid;
    int num_tasks_234761 = info.nsubtasks;
    struct futhark_mc_task_236717 *futhark_mc_task_236717 =
                                  (struct futhark_mc_task_236717 *) args;
    struct futhark_context *ctx = futhark_mc_task_236717->ctx;
    uint64_t futhark_mc_segmap_task_236718_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236718_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236717->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236717->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236717->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236717->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236717->free_i_203760;
    int64_t gtid_215421 = futhark_mc_task_236717->free_gtid_215421;
    int64_t x_215426 = futhark_mc_task_236717->free_x_215426;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236717->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236717->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236717->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220489 = {.desc ="mem_220489", .mem =
                                  futhark_mc_task_236717->free_mem_220489,
                                  .size =0, .references =NULL};
    struct memblock mem_220492 = {.desc ="mem_220492", .mem =
                                  futhark_mc_task_236717->free_mem_220492,
                                  .size =0, .references =NULL};
    int64_t bytes_220494 = futhark_mc_task_236717->free_bytes_220494;
    struct memblock mem_220567 = {.desc ="mem_220567", .mem =
                                  futhark_mc_task_236717->free_mem_220567,
                                  .size =0, .references =NULL};
    struct memblock mem_220570 = {.desc ="mem_220570", .mem =
                                  futhark_mc_task_236717->free_mem_220570,
                                  .size =0, .references =NULL};
    int64_t iter_234762;
    struct futhark_mc_segmap_parloop_struct_236719
    futhark_mc_segmap_parloop_struct_236719;
    
    futhark_mc_segmap_parloop_struct_236719.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236719.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236719.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236719.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236719.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236719.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236719.free_gtid_215421 = gtid_215421;
    futhark_mc_segmap_parloop_struct_236719.free_x_215426 = x_215426;
    futhark_mc_segmap_parloop_struct_236719.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236719.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236719.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236719.free_mem_220489 = mem_220489.mem;
    futhark_mc_segmap_parloop_struct_236719.free_mem_220492 = mem_220492.mem;
    futhark_mc_segmap_parloop_struct_236719.free_bytes_220494 = bytes_220494;
    futhark_mc_segmap_parloop_struct_236719.free_mem_220567 = mem_220567.mem;
    futhark_mc_segmap_parloop_struct_236719.free_mem_220570 = mem_220570.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236720_task;
    
    futhark_mc_segmap_parloop_236720_task.name =
        "futhark_mc_segmap_parloop_236720";
    futhark_mc_segmap_parloop_236720_task.fn = futhark_mc_segmap_parloop_236720;
    futhark_mc_segmap_parloop_236720_task.args =
        &futhark_mc_segmap_parloop_struct_236719;
    futhark_mc_segmap_parloop_236720_task.iterations = iterations;
    futhark_mc_segmap_parloop_236720_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236720_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236720_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236720_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236720_task);
    
    if (futhark_mc_segmap_parloop_236720_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236720_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236720_total_end -
                 futhark_mc_segmap_parloop_236720_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236720_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236720_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236720_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236718_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236718_end -
                 futhark_mc_segmap_task_236718_start;
        
        ctx->futhark_mc_segmap_task_236718_runs[tid]++;
        ctx->futhark_mc_segmap_task_236718_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236718_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236726 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_gtid_215421;
    int64_t free_x_215426;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_217953;
    unsigned char *free_mem_217957;
    unsigned char *free_mem_220489;
    unsigned char *free_mem_220492;
    int64_t free_bytes_220494;
    unsigned char *free_mem_220567;
    unsigned char *free_mem_220570;
};
struct futhark_mc_task_236732 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_gtid_215421;
    int64_t free_x_215426;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220489;
    int64_t free_x_234509;
    double free_x_234510;
    int64_t free_defunc_0_g_res_234513;
    unsigned char *free_mem_234514;
    unsigned char *free_mem_234515;
};
struct futhark_mc_segmap_parloop_struct_236734 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_q_t_203576;
    int64_t free_gtid_215421;
    int64_t free_x_215426;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220489;
    int64_t free_x_234509;
    double free_x_234510;
    int64_t free_defunc_0_g_res_234513;
    unsigned char *free_mem_234514;
    unsigned char *free_mem_234515;
};
static int futhark_mc_segmap_parloop_236735(void *args, int64_t start,
                                            int64_t end, int flat_tid_234845,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236734
    *futhark_mc_segmap_parloop_struct_236734 =
    (struct futhark_mc_segmap_parloop_struct_236734 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236734->ctx;
    uint64_t futhark_mc_segmap_parloop_236735_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236735_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236734->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236734->free_q_t_203576;
    int64_t gtid_215421 =
            futhark_mc_segmap_parloop_struct_236734->free_gtid_215421;
    int64_t x_215426 = futhark_mc_segmap_parloop_struct_236734->free_x_215426;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236734->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220489 = {.desc ="mem_220489", .mem =
                                  futhark_mc_segmap_parloop_struct_236734->free_mem_220489,
                                  .size =0, .references =NULL};
    int64_t x_234509 = futhark_mc_segmap_parloop_struct_236734->free_x_234509;
    double x_234510 = futhark_mc_segmap_parloop_struct_236734->free_x_234510;
    int64_t defunc_0_g_res_234513 =
            futhark_mc_segmap_parloop_struct_236734->free_defunc_0_g_res_234513;
    struct memblock mem_234514 = {.desc ="mem_234514", .mem =
                                  futhark_mc_segmap_parloop_struct_236734->free_mem_234514,
                                  .size =0, .references =NULL};
    struct memblock mem_234515 = {.desc ="mem_234515", .mem =
                                  futhark_mc_segmap_parloop_struct_236734->free_mem_234515,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234918 = start;
    
    for (; iter_234918 < end; iter_234918++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234924 = q_t_203576;
        int64_t gtid_234846 = iter_234918;
        int64_t remnant_234925 = iter_234918 - gtid_234846;
        bool cond_234847 = sle64(x_215426, gtid_234846);
        int64_t defunc_0_f_res_234848;
        
        if (cond_234847) {
            defunc_0_f_res_234848 = (int64_t) 0;
        } else {
            int64_t i_234919 = add64(x_234509, gtid_234846);
            int64_t defunc_0_add_arg_234920;
            
            defunc_0_add_arg_234920 = ((int64_t *) mem_217458.mem)[gtid_215421 *
                                                                   n_203572 +
                                                                   i_234919];
            
            int64_t defunc_1_add_res_234921 = add64((int64_t) 1,
                                                    defunc_0_add_arg_234920);
            
            defunc_0_f_res_234848 = defunc_1_add_res_234921;
        }
        
        double defunc_0_f_res_234852;
        
        if (cond_234847) {
            defunc_0_f_res_234852 = 0.0;
        } else {
            int64_t i_234922 = add64(x_234509, gtid_234846);
            double defunc_0_add_arg_234923;
            
            defunc_0_add_arg_234923 = ((double *) mem_220489.mem)[i_234922];
            defunc_0_f_res_234852 = defunc_0_add_arg_234923;
        }
        
        int64_t binop_p_234855 = sub64(defunc_0_f_res_234848,
                                       defunc_0_g_res_234513);
        double defunc_0_f_res_234856 = sitofp_i64_f64(binop_p_234855);
        double abs_res_234857 = fabs(defunc_0_f_res_234856);
        double tmp1_234858 = abs_res_234857 / x_234510;
        double x_234859 = tmp1_234858 * tmp1_234858;
        double y_234860 = tmp1_234858 * x_234859;
        double tmp2_234861 = 1.0 - y_234860;
        double x_234862 = tmp2_234861 * tmp2_234861;
        double tmp3_234863 = tmp2_234861 * x_234862;
        double tmp4_234864 = defunc_0_f_res_234852 * tmp3_234863;
        
        ((double *) mem_234514.mem)[gtid_234846] = defunc_0_f_res_234856;
        ((double *) mem_234515.mem)[gtid_234846] = tmp4_234864;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236735_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236735_end -
                 futhark_mc_segmap_parloop_236735_start;
        
        ctx->futhark_mc_segmap_parloop_236735_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236735_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236735_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236733(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234845 = tid;
    int num_tasks_234917 = info.nsubtasks;
    struct futhark_mc_task_236732 *futhark_mc_task_236732 =
                                  (struct futhark_mc_task_236732 *) args;
    struct futhark_context *ctx = futhark_mc_task_236732->ctx;
    uint64_t futhark_mc_segmap_task_236733_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236733_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236732->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236732->free_q_t_203576;
    int64_t gtid_215421 = futhark_mc_task_236732->free_gtid_215421;
    int64_t x_215426 = futhark_mc_task_236732->free_x_215426;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236732->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220489 = {.desc ="mem_220489", .mem =
                                  futhark_mc_task_236732->free_mem_220489,
                                  .size =0, .references =NULL};
    int64_t x_234509 = futhark_mc_task_236732->free_x_234509;
    double x_234510 = futhark_mc_task_236732->free_x_234510;
    int64_t defunc_0_g_res_234513 =
            futhark_mc_task_236732->free_defunc_0_g_res_234513;
    struct memblock mem_234514 = {.desc ="mem_234514", .mem =
                                  futhark_mc_task_236732->free_mem_234514,
                                  .size =0, .references =NULL};
    struct memblock mem_234515 = {.desc ="mem_234515", .mem =
                                  futhark_mc_task_236732->free_mem_234515,
                                  .size =0, .references =NULL};
    int64_t iter_234918;
    struct futhark_mc_segmap_parloop_struct_236734
    futhark_mc_segmap_parloop_struct_236734;
    
    futhark_mc_segmap_parloop_struct_236734.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236734.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236734.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236734.free_gtid_215421 = gtid_215421;
    futhark_mc_segmap_parloop_struct_236734.free_x_215426 = x_215426;
    futhark_mc_segmap_parloop_struct_236734.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236734.free_mem_220489 = mem_220489.mem;
    futhark_mc_segmap_parloop_struct_236734.free_x_234509 = x_234509;
    futhark_mc_segmap_parloop_struct_236734.free_x_234510 = x_234510;
    futhark_mc_segmap_parloop_struct_236734.free_defunc_0_g_res_234513 =
        defunc_0_g_res_234513;
    futhark_mc_segmap_parloop_struct_236734.free_mem_234514 = mem_234514.mem;
    futhark_mc_segmap_parloop_struct_236734.free_mem_234515 = mem_234515.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236735_task;
    
    futhark_mc_segmap_parloop_236735_task.name =
        "futhark_mc_segmap_parloop_236735";
    futhark_mc_segmap_parloop_236735_task.fn = futhark_mc_segmap_parloop_236735;
    futhark_mc_segmap_parloop_236735_task.args =
        &futhark_mc_segmap_parloop_struct_236734;
    futhark_mc_segmap_parloop_236735_task.iterations = iterations;
    futhark_mc_segmap_parloop_236735_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236735_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236735_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236735_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236735_task);
    
    if (futhark_mc_segmap_parloop_236735_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236735_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236735_total_end -
                 futhark_mc_segmap_parloop_236735_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236735_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236735_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236735_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236733_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236733_end -
                 futhark_mc_segmap_task_236733_start;
        
        ctx->futhark_mc_segmap_task_236733_runs[tid]++;
        ctx->futhark_mc_segmap_task_236733_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236733_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236736 {
    struct futhark_context *ctx;
    unsigned char *free_mem_234514;
    unsigned char *free_mem_234515;
    double *retval_defunc_2_reduce_res_234540;
    double *retval_defunc_2_reduce_res_234541;
    double *retval_defunc_2_reduce_res_234542;
    double *retval_defunc_2_reduce_res_234543;
    double *retval_defunc_2_reduce_res_234544;
    unsigned char *retval_mem_234538;
    unsigned char *retval_mem_234539;
};
struct futhark_mc_segred_stage_1_parloop_struct_236743 {
    struct futhark_context *ctx;
    unsigned char *free_mem_234514;
    unsigned char *free_mem_234515;
    unsigned char *free_mem_234538;
    unsigned char *free_mem_234539;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234927;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234929;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234931;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234933;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234935;
};
static int futhark_mc_segred_stage_1_parloop_236744(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_234865,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236743
    *futhark_mc_segred_stage_1_parloop_struct_236743 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236743 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236743->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236744_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236744_start = get_wall_time();
    
    struct memblock mem_234514 = {.desc ="mem_234514", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236743->free_mem_234514,
                                  .size =0, .references =NULL};
    struct memblock mem_234515 = {.desc ="mem_234515", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236743->free_mem_234515,
                                  .size =0, .references =NULL};
    struct memblock mem_234538 = {.desc ="mem_234538", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236743->free_mem_234538,
                                  .size =0, .references =NULL};
    struct memblock mem_234539 = {.desc ="mem_234539", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236743->free_mem_234539,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234927 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234927",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236743->free_reduce_stage_1_tid_res_arr_mem_234927,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234929 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234929",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236743->free_reduce_stage_1_tid_res_arr_mem_234929,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234931 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234931",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236743->free_reduce_stage_1_tid_res_arr_mem_234931,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234933 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234933",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236743->free_reduce_stage_1_tid_res_arr_mem_234933,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234935 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234935",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236743->free_reduce_stage_1_tid_res_arr_mem_234935,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234937 = start;
    double x_234867;
    double x_234868;
    double x_234870;
    double x_234871;
    double x_234873;
    double x_234874;
    double x_234876;
    double x_234877;
    double x_234879;
    double x_234880;
    double local_acc_234938 = 0.0;
    double local_acc_234939 = 0.0;
    double local_acc_234940 = 0.0;
    double local_acc_234941 = 0.0;
    double local_acc_234942 = 0.0;
    
    for (; iter_234937 < end; iter_234937++) {
        int64_t gtid_234866 = iter_234937;
        double x_234882;
        
        x_234882 = ((double *) mem_234514.mem)[gtid_234866];
        
        double x_234883;
        
        x_234883 = ((double *) mem_234515.mem)[gtid_234866];
        
        double defunc_1_f_res_234884 = x_234882 * x_234883;
        double defunc_1_f_res_234885 = x_234882 * defunc_1_f_res_234884;
        double defunc_1_f_res_234886 = x_234882 * defunc_1_f_res_234885;
        double defunc_1_f_res_234887 = x_234882 * defunc_1_f_res_234886;
        
        // save map-out results
        {
            ((double *) mem_234538.mem)[gtid_234866] = defunc_1_f_res_234885;
            ((double *) mem_234539.mem)[gtid_234866] = defunc_1_f_res_234884;
        }
        // Load accum params
        {
            x_234867 = local_acc_234938;
        }
        // Load next params
        {
            x_234868 = x_234883;
        }
        // Red body
        {
            double defunc_1_op_res_234869 = x_234867 + x_234868;
            
            local_acc_234938 = defunc_1_op_res_234869;
        }
        // Load accum params
        {
            x_234870 = local_acc_234939;
        }
        // Load next params
        {
            x_234871 = defunc_1_f_res_234884;
        }
        // Red body
        {
            double defunc_1_op_res_234872 = x_234870 + x_234871;
            
            local_acc_234939 = defunc_1_op_res_234872;
        }
        // Load accum params
        {
            x_234873 = local_acc_234940;
        }
        // Load next params
        {
            x_234874 = defunc_1_f_res_234885;
        }
        // Red body
        {
            double defunc_1_op_res_234875 = x_234873 + x_234874;
            
            local_acc_234940 = defunc_1_op_res_234875;
        }
        // Load accum params
        {
            x_234876 = local_acc_234941;
        }
        // Load next params
        {
            x_234877 = defunc_1_f_res_234886;
        }
        // Red body
        {
            double defunc_1_op_res_234878 = x_234876 + x_234877;
            
            local_acc_234941 = defunc_1_op_res_234878;
        }
        // Load accum params
        {
            x_234879 = local_acc_234942;
        }
        // Load next params
        {
            x_234880 = defunc_1_f_res_234887;
        }
        // Red body
        {
            double defunc_1_op_res_234881 = x_234879 + x_234880;
            
            local_acc_234942 = defunc_1_op_res_234881;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_234927.mem)[flat_tid_234865] =
        local_acc_234938;
    ((double *) reduce_stage_1_tid_res_arr_mem_234929.mem)[flat_tid_234865] =
        local_acc_234939;
    ((double *) reduce_stage_1_tid_res_arr_mem_234931.mem)[flat_tid_234865] =
        local_acc_234940;
    ((double *) reduce_stage_1_tid_res_arr_mem_234933.mem)[flat_tid_234865] =
        local_acc_234941;
    ((double *) reduce_stage_1_tid_res_arr_mem_234935.mem)[flat_tid_234865] =
        local_acc_234942;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236744_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236744_end -
                 futhark_mc_segred_stage_1_parloop_236744_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236744_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236744_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236744_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236737(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234865 = tid;
    int num_tasks_234926 = info.nsubtasks;
    struct futhark_mc_task_236736 *futhark_mc_task_236736 =
                                  (struct futhark_mc_task_236736 *) args;
    struct futhark_context *ctx = futhark_mc_task_236736->ctx;
    uint64_t futhark_mc_segred_task_236737_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236737_start = get_wall_time();
    
    struct memblock mem_234514 = {.desc ="mem_234514", .mem =
                                  futhark_mc_task_236736->free_mem_234514,
                                  .size =0, .references =NULL};
    struct memblock mem_234515 = {.desc ="mem_234515", .mem =
                                  futhark_mc_task_236736->free_mem_234515,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_234540 =
           *futhark_mc_task_236736->retval_defunc_2_reduce_res_234540;
    double defunc_2_reduce_res_234541 =
           *futhark_mc_task_236736->retval_defunc_2_reduce_res_234541;
    double defunc_2_reduce_res_234542 =
           *futhark_mc_task_236736->retval_defunc_2_reduce_res_234542;
    double defunc_2_reduce_res_234543 =
           *futhark_mc_task_236736->retval_defunc_2_reduce_res_234543;
    double defunc_2_reduce_res_234544 =
           *futhark_mc_task_236736->retval_defunc_2_reduce_res_234544;
    struct memblock mem_234538 = {.desc ="mem_234538", .mem =
                                  futhark_mc_task_236736->retval_mem_234538,
                                  .size =0, .references =NULL};
    struct memblock mem_234539 = {.desc ="mem_234539", .mem =
                                  futhark_mc_task_236736->retval_mem_234539,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_234927_cached_sizze_236738 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234927 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234929_cached_sizze_236739 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234929 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234931_cached_sizze_236740 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234931 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234933_cached_sizze_236741 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234933 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234935_cached_sizze_236742 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234935 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_234927_cached_sizze_236738 <
        (size_t) ((int64_t) 8 * num_tasks_234926)) {
        reduce_stage_1_tid_res_arr_mem_234927 =
            realloc(reduce_stage_1_tid_res_arr_mem_234927, (int64_t) 8 *
                    num_tasks_234926);
        reduce_stage_1_tid_res_arr_mem_234927_cached_sizze_236738 =
            (int64_t) 8 * num_tasks_234926;
    }
    if (reduce_stage_1_tid_res_arr_mem_234929_cached_sizze_236739 <
        (size_t) ((int64_t) 8 * num_tasks_234926)) {
        reduce_stage_1_tid_res_arr_mem_234929 =
            realloc(reduce_stage_1_tid_res_arr_mem_234929, (int64_t) 8 *
                    num_tasks_234926);
        reduce_stage_1_tid_res_arr_mem_234929_cached_sizze_236739 =
            (int64_t) 8 * num_tasks_234926;
    }
    if (reduce_stage_1_tid_res_arr_mem_234931_cached_sizze_236740 <
        (size_t) ((int64_t) 8 * num_tasks_234926)) {
        reduce_stage_1_tid_res_arr_mem_234931 =
            realloc(reduce_stage_1_tid_res_arr_mem_234931, (int64_t) 8 *
                    num_tasks_234926);
        reduce_stage_1_tid_res_arr_mem_234931_cached_sizze_236740 =
            (int64_t) 8 * num_tasks_234926;
    }
    if (reduce_stage_1_tid_res_arr_mem_234933_cached_sizze_236741 <
        (size_t) ((int64_t) 8 * num_tasks_234926)) {
        reduce_stage_1_tid_res_arr_mem_234933 =
            realloc(reduce_stage_1_tid_res_arr_mem_234933, (int64_t) 8 *
                    num_tasks_234926);
        reduce_stage_1_tid_res_arr_mem_234933_cached_sizze_236741 =
            (int64_t) 8 * num_tasks_234926;
    }
    if (reduce_stage_1_tid_res_arr_mem_234935_cached_sizze_236742 <
        (size_t) ((int64_t) 8 * num_tasks_234926)) {
        reduce_stage_1_tid_res_arr_mem_234935 =
            realloc(reduce_stage_1_tid_res_arr_mem_234935, (int64_t) 8 *
                    num_tasks_234926);
        reduce_stage_1_tid_res_arr_mem_234935_cached_sizze_236742 =
            (int64_t) 8 * num_tasks_234926;
    }
    
    int64_t iter_234937;
    struct futhark_mc_segred_stage_1_parloop_struct_236743
    futhark_mc_segred_stage_1_parloop_struct_236743;
    
    futhark_mc_segred_stage_1_parloop_struct_236743.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236743.free_mem_234514 =
        mem_234514.mem;
    futhark_mc_segred_stage_1_parloop_struct_236743.free_mem_234515 =
        mem_234515.mem;
    futhark_mc_segred_stage_1_parloop_struct_236743.free_mem_234538 =
        mem_234538.mem;
    futhark_mc_segred_stage_1_parloop_struct_236743.free_mem_234539 =
        mem_234539.mem;
    futhark_mc_segred_stage_1_parloop_struct_236743.free_reduce_stage_1_tid_res_arr_mem_234927 =
        reduce_stage_1_tid_res_arr_mem_234927;
    futhark_mc_segred_stage_1_parloop_struct_236743.free_reduce_stage_1_tid_res_arr_mem_234929 =
        reduce_stage_1_tid_res_arr_mem_234929;
    futhark_mc_segred_stage_1_parloop_struct_236743.free_reduce_stage_1_tid_res_arr_mem_234931 =
        reduce_stage_1_tid_res_arr_mem_234931;
    futhark_mc_segred_stage_1_parloop_struct_236743.free_reduce_stage_1_tid_res_arr_mem_234933 =
        reduce_stage_1_tid_res_arr_mem_234933;
    futhark_mc_segred_stage_1_parloop_struct_236743.free_reduce_stage_1_tid_res_arr_mem_234935 =
        reduce_stage_1_tid_res_arr_mem_234935;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236744_task;
    
    futhark_mc_segred_stage_1_parloop_236744_task.name =
        "futhark_mc_segred_stage_1_parloop_236744";
    futhark_mc_segred_stage_1_parloop_236744_task.fn =
        futhark_mc_segred_stage_1_parloop_236744;
    futhark_mc_segred_stage_1_parloop_236744_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236743;
    futhark_mc_segred_stage_1_parloop_236744_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236744_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236744_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236744_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236744_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236744_task);
    
    if (futhark_mc_segred_stage_1_parloop_236744_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236744_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236744_total_end -
                 futhark_mc_segred_stage_1_parloop_236744_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236744_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236744_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236744_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_234540 = 0.0;
        defunc_2_reduce_res_234541 = 0.0;
        defunc_2_reduce_res_234542 = 0.0;
        defunc_2_reduce_res_234543 = 0.0;
        defunc_2_reduce_res_234544 = 0.0;
    }
    
    double x_234943;
    double x_234944;
    double x_234946;
    double x_234947;
    double x_234949;
    double x_234950;
    double x_234952;
    double x_234953;
    double x_234955;
    double x_234956;
    
    for (int32_t i_234958 = 0; i_234958 < num_tasks_234926; i_234958++) {
        flat_tid_234865 = i_234958;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_234943 = defunc_2_reduce_res_234540;
            }
            // load next params
            {
                x_234944 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234927)[flat_tid_234865];
            }
            // red body
            {
                double defunc_1_op_res_234945 = x_234943 + x_234944;
                
                defunc_2_reduce_res_234540 = defunc_1_op_res_234945;
            }
            // load acc params
            {
                x_234946 = defunc_2_reduce_res_234541;
            }
            // load next params
            {
                x_234947 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234929)[flat_tid_234865];
            }
            // red body
            {
                double defunc_1_op_res_234948 = x_234946 + x_234947;
                
                defunc_2_reduce_res_234541 = defunc_1_op_res_234948;
            }
            // load acc params
            {
                x_234949 = defunc_2_reduce_res_234542;
            }
            // load next params
            {
                x_234950 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234931)[flat_tid_234865];
            }
            // red body
            {
                double defunc_1_op_res_234951 = x_234949 + x_234950;
                
                defunc_2_reduce_res_234542 = defunc_1_op_res_234951;
            }
            // load acc params
            {
                x_234952 = defunc_2_reduce_res_234543;
            }
            // load next params
            {
                x_234953 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234933)[flat_tid_234865];
            }
            // red body
            {
                double defunc_1_op_res_234954 = x_234952 + x_234953;
                
                defunc_2_reduce_res_234543 = defunc_1_op_res_234954;
            }
            // load acc params
            {
                x_234955 = defunc_2_reduce_res_234544;
            }
            // load next params
            {
                x_234956 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234935)[flat_tid_234865];
            }
            // red body
            {
                double defunc_1_op_res_234957 = x_234955 + x_234956;
                
                defunc_2_reduce_res_234544 = defunc_1_op_res_234957;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_234927);
        free(reduce_stage_1_tid_res_arr_mem_234929);
        free(reduce_stage_1_tid_res_arr_mem_234931);
        free(reduce_stage_1_tid_res_arr_mem_234933);
        free(reduce_stage_1_tid_res_arr_mem_234935);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236737_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236737_end -
                 futhark_mc_segred_task_236737_start;
        
        ctx->futhark_mc_segred_task_236737_runs[tid]++;
        ctx->futhark_mc_segred_task_236737_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236737_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236736->retval_defunc_2_reduce_res_234540 =
            defunc_2_reduce_res_234540;
        *futhark_mc_task_236736->retval_defunc_2_reduce_res_234541 =
            defunc_2_reduce_res_234541;
        *futhark_mc_task_236736->retval_defunc_2_reduce_res_234542 =
            defunc_2_reduce_res_234542;
        *futhark_mc_task_236736->retval_defunc_2_reduce_res_234543 =
            defunc_2_reduce_res_234543;
        *futhark_mc_task_236736->retval_defunc_2_reduce_res_234544 =
            defunc_2_reduce_res_234544;
        futhark_mc_task_236736->retval_mem_234538 = mem_234538.mem;
        futhark_mc_task_236736->retval_mem_234539 = mem_234539.mem;
    }
    return err;
}
struct futhark_mc_task_236745 {
    struct futhark_context *ctx;
    int64_t free_x_215426;
    unsigned char *free_mem_220492;
    int64_t free_x_234509;
    unsigned char *free_mem_234515;
    unsigned char *free_mem_234538;
    unsigned char *free_mem_234539;
    double free_a12_234590;
    double free_b12_234591;
    double free_c12_234592;
    double free_b2_234593;
    double free_c2_234594;
    double *retval_defunc_2_reduce_res_234595;
    double *retval_defunc_2_reduce_res_234596;
};
struct futhark_mc_segred_stage_1_parloop_struct_236749 {
    struct futhark_context *ctx;
    int64_t free_x_215426;
    unsigned char *free_mem_220492;
    int64_t free_x_234509;
    unsigned char *free_mem_234515;
    unsigned char *free_mem_234538;
    unsigned char *free_mem_234539;
    double free_a12_234590;
    double free_b12_234591;
    double free_c12_234592;
    double free_b2_234593;
    double free_c2_234594;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234960;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_234962;
};
static int futhark_mc_segred_stage_1_parloop_236750(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_234888,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236749
    *futhark_mc_segred_stage_1_parloop_struct_236749 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236749 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236749->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236750_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236750_start = get_wall_time();
    
    int64_t x_215426 =
            futhark_mc_segred_stage_1_parloop_struct_236749->free_x_215426;
    struct memblock mem_220492 = {.desc ="mem_220492", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236749->free_mem_220492,
                                  .size =0, .references =NULL};
    int64_t x_234509 =
            futhark_mc_segred_stage_1_parloop_struct_236749->free_x_234509;
    struct memblock mem_234515 = {.desc ="mem_234515", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236749->free_mem_234515,
                                  .size =0, .references =NULL};
    struct memblock mem_234538 = {.desc ="mem_234538", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236749->free_mem_234538,
                                  .size =0, .references =NULL};
    struct memblock mem_234539 = {.desc ="mem_234539", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236749->free_mem_234539,
                                  .size =0, .references =NULL};
    double a12_234590 =
           futhark_mc_segred_stage_1_parloop_struct_236749->free_a12_234590;
    double b12_234591 =
           futhark_mc_segred_stage_1_parloop_struct_236749->free_b12_234591;
    double c12_234592 =
           futhark_mc_segred_stage_1_parloop_struct_236749->free_c12_234592;
    double b2_234593 =
           futhark_mc_segred_stage_1_parloop_struct_236749->free_b2_234593;
    double c2_234594 =
           futhark_mc_segred_stage_1_parloop_struct_236749->free_c2_234594;
    struct memblock reduce_stage_1_tid_res_arr_mem_234960 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234960",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236749->free_reduce_stage_1_tid_res_arr_mem_234960,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_234962 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_234962",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236749->free_reduce_stage_1_tid_res_arr_mem_234962,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_234964 = start;
    double x_234890;
    double x_234891;
    double x_234893;
    double x_234894;
    double local_acc_234965 = 0.0;
    double local_acc_234966 = 0.0;
    
    for (; iter_234964 < end; iter_234964++) {
        int64_t gtid_234889 = iter_234964;
        double x_234896;
        
        x_234896 = ((double *) mem_234515.mem)[gtid_234889];
        
        double x_234897;
        
        x_234897 = ((double *) mem_234539.mem)[gtid_234889];
        
        double x_234898;
        
        x_234898 = ((double *) mem_234538.mem)[gtid_234889];
        
        bool cond_234899 = sle64(x_215426, gtid_234889);
        double defunc_0_f_res_234900;
        
        if (cond_234899) {
            defunc_0_f_res_234900 = 0.0;
        } else {
            int64_t i_234901 = add64(x_234509, gtid_234889);
            double defunc_0_add_arg_234902;
            
            defunc_0_add_arg_234902 = ((double *) mem_220492.mem)[i_234901];
            defunc_0_f_res_234900 = defunc_0_add_arg_234902;
        }
        
        double x_234903 = a12_234590 * x_234896;
        double y_234904 = b12_234591 * x_234897;
        double x_234905 = x_234903 + y_234904;
        double y_234906 = c12_234592 * x_234898;
        double x_234907 = x_234905 + y_234906;
        double defunc_9_fit_fun_res_234908 = defunc_0_f_res_234900 * x_234907;
        double x_234909 = b12_234591 * x_234896;
        double y_234910 = b2_234593 * x_234897;
        double x_234911 = x_234909 + y_234910;
        double y_234912 = c2_234594 * x_234898;
        double x_234913 = x_234911 + y_234912;
        double defunc_9_slope_fun_res_234914 = defunc_0_f_res_234900 * x_234913;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_234890 = local_acc_234965;
        }
        // Load next params
        {
            x_234891 = defunc_9_fit_fun_res_234908;
        }
        // Red body
        {
            double defunc_1_op_res_234892 = x_234890 + x_234891;
            
            local_acc_234965 = defunc_1_op_res_234892;
        }
        // Load accum params
        {
            x_234893 = local_acc_234966;
        }
        // Load next params
        {
            x_234894 = defunc_9_slope_fun_res_234914;
        }
        // Red body
        {
            double defunc_1_op_res_234895 = x_234893 + x_234894;
            
            local_acc_234966 = defunc_1_op_res_234895;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_234960.mem)[flat_tid_234888] =
        local_acc_234965;
    ((double *) reduce_stage_1_tid_res_arr_mem_234962.mem)[flat_tid_234888] =
        local_acc_234966;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236750_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236750_end -
                 futhark_mc_segred_stage_1_parloop_236750_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236750_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236750_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236750_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236746(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234888 = tid;
    int num_tasks_234959 = info.nsubtasks;
    struct futhark_mc_task_236745 *futhark_mc_task_236745 =
                                  (struct futhark_mc_task_236745 *) args;
    struct futhark_context *ctx = futhark_mc_task_236745->ctx;
    uint64_t futhark_mc_segred_task_236746_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236746_start = get_wall_time();
    
    int64_t x_215426 = futhark_mc_task_236745->free_x_215426;
    struct memblock mem_220492 = {.desc ="mem_220492", .mem =
                                  futhark_mc_task_236745->free_mem_220492,
                                  .size =0, .references =NULL};
    int64_t x_234509 = futhark_mc_task_236745->free_x_234509;
    struct memblock mem_234515 = {.desc ="mem_234515", .mem =
                                  futhark_mc_task_236745->free_mem_234515,
                                  .size =0, .references =NULL};
    struct memblock mem_234538 = {.desc ="mem_234538", .mem =
                                  futhark_mc_task_236745->free_mem_234538,
                                  .size =0, .references =NULL};
    struct memblock mem_234539 = {.desc ="mem_234539", .mem =
                                  futhark_mc_task_236745->free_mem_234539,
                                  .size =0, .references =NULL};
    double a12_234590 = futhark_mc_task_236745->free_a12_234590;
    double b12_234591 = futhark_mc_task_236745->free_b12_234591;
    double c12_234592 = futhark_mc_task_236745->free_c12_234592;
    double b2_234593 = futhark_mc_task_236745->free_b2_234593;
    double c2_234594 = futhark_mc_task_236745->free_c2_234594;
    double defunc_2_reduce_res_234595 =
           *futhark_mc_task_236745->retval_defunc_2_reduce_res_234595;
    double defunc_2_reduce_res_234596 =
           *futhark_mc_task_236745->retval_defunc_2_reduce_res_234596;
    size_t reduce_stage_1_tid_res_arr_mem_234960_cached_sizze_236747 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234960 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_234962_cached_sizze_236748 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_234962 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_234960_cached_sizze_236747 <
        (size_t) ((int64_t) 8 * num_tasks_234959)) {
        reduce_stage_1_tid_res_arr_mem_234960 =
            realloc(reduce_stage_1_tid_res_arr_mem_234960, (int64_t) 8 *
                    num_tasks_234959);
        reduce_stage_1_tid_res_arr_mem_234960_cached_sizze_236747 =
            (int64_t) 8 * num_tasks_234959;
    }
    if (reduce_stage_1_tid_res_arr_mem_234962_cached_sizze_236748 <
        (size_t) ((int64_t) 8 * num_tasks_234959)) {
        reduce_stage_1_tid_res_arr_mem_234962 =
            realloc(reduce_stage_1_tid_res_arr_mem_234962, (int64_t) 8 *
                    num_tasks_234959);
        reduce_stage_1_tid_res_arr_mem_234962_cached_sizze_236748 =
            (int64_t) 8 * num_tasks_234959;
    }
    
    int64_t iter_234964;
    struct futhark_mc_segred_stage_1_parloop_struct_236749
    futhark_mc_segred_stage_1_parloop_struct_236749;
    
    futhark_mc_segred_stage_1_parloop_struct_236749.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_x_215426 = x_215426;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_mem_220492 =
        mem_220492.mem;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_x_234509 = x_234509;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_mem_234515 =
        mem_234515.mem;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_mem_234538 =
        mem_234538.mem;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_mem_234539 =
        mem_234539.mem;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_a12_234590 =
        a12_234590;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_b12_234591 =
        b12_234591;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_c12_234592 =
        c12_234592;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_b2_234593 = b2_234593;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_c2_234594 = c2_234594;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_reduce_stage_1_tid_res_arr_mem_234960 =
        reduce_stage_1_tid_res_arr_mem_234960;
    futhark_mc_segred_stage_1_parloop_struct_236749.free_reduce_stage_1_tid_res_arr_mem_234962 =
        reduce_stage_1_tid_res_arr_mem_234962;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236750_task;
    
    futhark_mc_segred_stage_1_parloop_236750_task.name =
        "futhark_mc_segred_stage_1_parloop_236750";
    futhark_mc_segred_stage_1_parloop_236750_task.fn =
        futhark_mc_segred_stage_1_parloop_236750;
    futhark_mc_segred_stage_1_parloop_236750_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236749;
    futhark_mc_segred_stage_1_parloop_236750_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236750_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236750_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236750_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236750_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236750_task);
    
    if (futhark_mc_segred_stage_1_parloop_236750_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236750_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236750_total_end -
                 futhark_mc_segred_stage_1_parloop_236750_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236750_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236750_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236750_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_234595 = 0.0;
        defunc_2_reduce_res_234596 = 0.0;
    }
    
    double x_234967;
    double x_234968;
    double x_234970;
    double x_234971;
    
    for (int32_t i_234973 = 0; i_234973 < num_tasks_234959; i_234973++) {
        flat_tid_234888 = i_234973;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_234967 = defunc_2_reduce_res_234595;
            }
            // load next params
            {
                x_234968 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234960)[flat_tid_234888];
            }
            // red body
            {
                double defunc_1_op_res_234969 = x_234967 + x_234968;
                
                defunc_2_reduce_res_234595 = defunc_1_op_res_234969;
            }
            // load acc params
            {
                x_234970 = defunc_2_reduce_res_234596;
            }
            // load next params
            {
                x_234971 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_234962)[flat_tid_234888];
            }
            // red body
            {
                double defunc_1_op_res_234972 = x_234970 + x_234971;
                
                defunc_2_reduce_res_234596 = defunc_1_op_res_234972;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_234960);
        free(reduce_stage_1_tid_res_arr_mem_234962);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236746_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236746_end -
                 futhark_mc_segred_task_236746_start;
        
        ctx->futhark_mc_segred_task_236746_runs[tid]++;
        ctx->futhark_mc_segred_task_236746_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236746_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236745->retval_defunc_2_reduce_res_234595 =
            defunc_2_reduce_res_234595;
        *futhark_mc_task_236745->retval_defunc_2_reduce_res_234596 =
            defunc_2_reduce_res_234596;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236727(void *args, int64_t start,
                                            int64_t end, int flat_tid_234507,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236726
    *futhark_mc_segmap_parloop_struct_236726 =
    (struct futhark_mc_segmap_parloop_struct_236726 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236726->ctx;
    uint64_t futhark_mc_segmap_parloop_236727_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236727_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236726->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236726->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236726->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236726->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236726->free_i_203760;
    int64_t gtid_215421 =
            futhark_mc_segmap_parloop_struct_236726->free_gtid_215421;
    int64_t x_215426 = futhark_mc_segmap_parloop_struct_236726->free_x_215426;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236726->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236726->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236726->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220489 = {.desc ="mem_220489", .mem =
                                  futhark_mc_segmap_parloop_struct_236726->free_mem_220489,
                                  .size =0, .references =NULL};
    struct memblock mem_220492 = {.desc ="mem_220492", .mem =
                                  futhark_mc_segmap_parloop_struct_236726->free_mem_220492,
                                  .size =0, .references =NULL};
    int64_t bytes_220494 =
            futhark_mc_segmap_parloop_struct_236726->free_bytes_220494;
    struct memblock mem_220567 = {.desc ="mem_220567", .mem =
                                  futhark_mc_segmap_parloop_struct_236726->free_mem_220567,
                                  .size =0, .references =NULL};
    struct memblock mem_220570 = {.desc ="mem_220570", .mem =
                                  futhark_mc_segmap_parloop_struct_236726->free_mem_220570,
                                  .size =0, .references =NULL};
    size_t mem_234514_cached_sizze_236728 = 0;
    unsigned char *mem_234514 = NULL;
    size_t mem_234515_cached_sizze_236729 = 0;
    unsigned char *mem_234515 = NULL;
    size_t mem_234538_cached_sizze_236730 = 0;
    unsigned char *mem_234538 = NULL;
    size_t mem_234539_cached_sizze_236731 = 0;
    unsigned char *mem_234539 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234844 = start;
    
    if (mem_234514_cached_sizze_236728 < (size_t) bytes_220494) {
        mem_234514 = realloc(mem_234514, bytes_220494);
        mem_234514_cached_sizze_236728 = bytes_220494;
    }
    if (mem_234515_cached_sizze_236729 < (size_t) bytes_220494) {
        mem_234515 = realloc(mem_234515, bytes_220494);
        mem_234515_cached_sizze_236729 = bytes_220494;
    }
    if (mem_234538_cached_sizze_236730 < (size_t) bytes_220494) {
        mem_234538 = realloc(mem_234538, bytes_220494);
        mem_234538_cached_sizze_236730 = bytes_220494;
    }
    if (mem_234539_cached_sizze_236731 < (size_t) bytes_220494) {
        mem_234539 = realloc(mem_234539, bytes_220494);
        mem_234539_cached_sizze_236731 = bytes_220494;
    }
    for (; iter_234844 < end; iter_234844++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234915 = t_n_m_203740;
        int64_t gtid_234508 = iter_234844;
        int64_t remnant_234916 = iter_234844 - gtid_234508;
        int64_t x_234509;
        
        x_234509 = ((int64_t *) mem_217953.mem)[gtid_215421 * t_n_m_203740 +
                                                gtid_234508];
        
        double x_234510;
        
        x_234510 = ((double *) mem_217957.mem)[gtid_215421 * t_n_m_203740 +
                                               gtid_234508];
        
        int64_t min_arg_234511 = mul64(jump_t_203582, gtid_234508);
        int64_t min_res_234512 = smin64(i_203760, min_arg_234511);
        int64_t defunc_0_g_res_234513 = add64((int64_t) 1, min_res_234512);
        int64_t flat_tid_234845 = (int64_t) 0;
        int32_t num_tasks_234917;
        struct futhark_mc_task_236732 futhark_mc_task_236732;
        
        futhark_mc_task_236732.ctx = ctx;
        futhark_mc_task_236732.free_n_203572 = n_203572;
        futhark_mc_task_236732.free_q_t_203576 = q_t_203576;
        futhark_mc_task_236732.free_gtid_215421 = gtid_215421;
        futhark_mc_task_236732.free_x_215426 = x_215426;
        futhark_mc_task_236732.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236732.free_mem_220489 = mem_220489.mem;
        futhark_mc_task_236732.free_x_234509 = x_234509;
        futhark_mc_task_236732.free_x_234510 = x_234510;
        futhark_mc_task_236732.free_defunc_0_g_res_234513 =
            defunc_0_g_res_234513;
        futhark_mc_task_236732.free_mem_234514 = mem_234514;
        futhark_mc_task_236732.free_mem_234515 = mem_234515;
        
        struct scheduler_segop futhark_mc_task_236732_task;
        
        futhark_mc_task_236732_task.args = &futhark_mc_task_236732;
        futhark_mc_task_236732_task.top_level_fn =
            futhark_mc_segmap_task_236733;
        futhark_mc_task_236732_task.name = "futhark_mc_segmap_task_236733";
        futhark_mc_task_236732_task.iterations = q_t_203576;
        futhark_mc_task_236732_task.task_time =
            &ctx->futhark_mc_segmap_task_236733_total_time;
        futhark_mc_task_236732_task.task_iter =
            &ctx->futhark_mc_segmap_task_236733_total_iter;
        futhark_mc_task_236732_task.sched = STATIC;
        futhark_mc_task_236732_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236733_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236732_task);
        
        if (futhark_mc_segmap_task_236733_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double defunc_2_reduce_res_234540;
        double defunc_2_reduce_res_234541;
        double defunc_2_reduce_res_234542;
        double defunc_2_reduce_res_234543;
        double defunc_2_reduce_res_234544;
        int64_t flat_tid_234865 = (int64_t) 0;
        int32_t num_tasks_234926;
        
        defunc_2_reduce_res_234540 = 0.0;
        defunc_2_reduce_res_234541 = 0.0;
        defunc_2_reduce_res_234542 = 0.0;
        defunc_2_reduce_res_234543 = 0.0;
        defunc_2_reduce_res_234544 = 0.0;
        
        struct futhark_mc_task_236736 futhark_mc_task_236736;
        
        futhark_mc_task_236736.ctx = ctx;
        futhark_mc_task_236736.free_mem_234514 = mem_234514;
        futhark_mc_task_236736.free_mem_234515 = mem_234515;
        futhark_mc_task_236736.retval_defunc_2_reduce_res_234540 =
            &defunc_2_reduce_res_234540;
        futhark_mc_task_236736.retval_defunc_2_reduce_res_234541 =
            &defunc_2_reduce_res_234541;
        futhark_mc_task_236736.retval_defunc_2_reduce_res_234542 =
            &defunc_2_reduce_res_234542;
        futhark_mc_task_236736.retval_defunc_2_reduce_res_234543 =
            &defunc_2_reduce_res_234543;
        futhark_mc_task_236736.retval_defunc_2_reduce_res_234544 =
            &defunc_2_reduce_res_234544;
        futhark_mc_task_236736.retval_mem_234538 = mem_234538;
        futhark_mc_task_236736.retval_mem_234539 = mem_234539;
        
        struct scheduler_segop futhark_mc_task_236736_task;
        
        futhark_mc_task_236736_task.args = &futhark_mc_task_236736;
        futhark_mc_task_236736_task.top_level_fn =
            futhark_mc_segred_task_236737;
        futhark_mc_task_236736_task.name = "futhark_mc_segred_task_236737";
        futhark_mc_task_236736_task.iterations = q_t_203576;
        futhark_mc_task_236736_task.task_time =
            &ctx->futhark_mc_segred_task_236737_total_time;
        futhark_mc_task_236736_task.task_iter =
            &ctx->futhark_mc_segred_task_236737_total_iter;
        futhark_mc_task_236736_task.sched = STATIC;
        futhark_mc_task_236736_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236737_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236736_task);
        
        if (futhark_mc_segred_task_236737_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double x_234570 = defunc_2_reduce_res_234542 *
               defunc_2_reduce_res_234544;
        double y_234571 = defunc_2_reduce_res_234543 *
               defunc_2_reduce_res_234543;
        double a12_234572 = x_234570 - y_234571;
        double x_234573 = defunc_2_reduce_res_234542 *
               defunc_2_reduce_res_234543;
        double y_234574 = defunc_2_reduce_res_234541 *
               defunc_2_reduce_res_234544;
        double b12_234575 = x_234573 - y_234574;
        double x_234576 = defunc_2_reduce_res_234541 *
               defunc_2_reduce_res_234543;
        double y_234577 = defunc_2_reduce_res_234542 *
               defunc_2_reduce_res_234542;
        double c12_234578 = x_234576 - y_234577;
        double x_234579 = defunc_2_reduce_res_234540 *
               defunc_2_reduce_res_234544;
        double b2_234580 = x_234579 - y_234577;
        double x_234581 = defunc_2_reduce_res_234541 *
               defunc_2_reduce_res_234542;
        double y_234582 = defunc_2_reduce_res_234540 *
               defunc_2_reduce_res_234543;
        double c2_234583 = x_234581 - y_234582;
        double x_234584 = defunc_2_reduce_res_234540 * a12_234572;
        double y_234585 = defunc_2_reduce_res_234541 * b12_234575;
        double x_234586 = x_234584 + y_234585;
        double y_234587 = defunc_2_reduce_res_234542 * c12_234578;
        double y_234588 = x_234586 + y_234587;
        double det_234589 = 1.0 / y_234588;
        double a12_234590 = a12_234572 * det_234589;
        double b12_234591 = b12_234575 * det_234589;
        double c12_234592 = c12_234578 * det_234589;
        double b2_234593 = b2_234580 * det_234589;
        double c2_234594 = c2_234583 * det_234589;
        double defunc_2_reduce_res_234595;
        double defunc_2_reduce_res_234596;
        int64_t flat_tid_234888 = (int64_t) 0;
        int32_t num_tasks_234959;
        
        defunc_2_reduce_res_234595 = 0.0;
        defunc_2_reduce_res_234596 = 0.0;
        
        struct futhark_mc_task_236745 futhark_mc_task_236745;
        
        futhark_mc_task_236745.ctx = ctx;
        futhark_mc_task_236745.free_x_215426 = x_215426;
        futhark_mc_task_236745.free_mem_220492 = mem_220492.mem;
        futhark_mc_task_236745.free_x_234509 = x_234509;
        futhark_mc_task_236745.free_mem_234515 = mem_234515;
        futhark_mc_task_236745.free_mem_234538 = mem_234538;
        futhark_mc_task_236745.free_mem_234539 = mem_234539;
        futhark_mc_task_236745.free_a12_234590 = a12_234590;
        futhark_mc_task_236745.free_b12_234591 = b12_234591;
        futhark_mc_task_236745.free_c12_234592 = c12_234592;
        futhark_mc_task_236745.free_b2_234593 = b2_234593;
        futhark_mc_task_236745.free_c2_234594 = c2_234594;
        futhark_mc_task_236745.retval_defunc_2_reduce_res_234595 =
            &defunc_2_reduce_res_234595;
        futhark_mc_task_236745.retval_defunc_2_reduce_res_234596 =
            &defunc_2_reduce_res_234596;
        
        struct scheduler_segop futhark_mc_task_236745_task;
        
        futhark_mc_task_236745_task.args = &futhark_mc_task_236745;
        futhark_mc_task_236745_task.top_level_fn =
            futhark_mc_segred_task_236746;
        futhark_mc_task_236745_task.name = "futhark_mc_segred_task_236746";
        futhark_mc_task_236745_task.iterations = q_t_203576;
        futhark_mc_task_236745_task.task_time =
            &ctx->futhark_mc_segred_task_236746_total_time;
        futhark_mc_task_236745_task.task_iter =
            &ctx->futhark_mc_segred_task_236746_total_iter;
        futhark_mc_task_236745_task.sched = STATIC;
        futhark_mc_task_236745_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236746_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236745_task);
        
        if (futhark_mc_segred_task_236746_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((double *) mem_220567.mem)[gtid_234508] = defunc_2_reduce_res_234595;
        ((double *) mem_220570.mem)[gtid_234508] = defunc_2_reduce_res_234596;
    }
    
  cleanup:
    { }
    free(mem_234514);
    free(mem_234515);
    free(mem_234538);
    free(mem_234539);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236727_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236727_end -
                 futhark_mc_segmap_parloop_236727_start;
        
        ctx->futhark_mc_segmap_parloop_236727_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236727_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236727_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236725(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_234507 = tid;
    int num_tasks_234761 = info.nsubtasks;
    struct futhark_mc_task_236717 *futhark_mc_task_236717 =
                                  (struct futhark_mc_task_236717 *) args;
    struct futhark_context *ctx = futhark_mc_task_236717->ctx;
    uint64_t futhark_mc_segmap_nested_task_236725_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236725_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236717->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236717->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236717->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236717->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236717->free_i_203760;
    int64_t gtid_215421 = futhark_mc_task_236717->free_gtid_215421;
    int64_t x_215426 = futhark_mc_task_236717->free_x_215426;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236717->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236717->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236717->free_mem_217957,
                                  .size =0, .references =NULL};
    struct memblock mem_220489 = {.desc ="mem_220489", .mem =
                                  futhark_mc_task_236717->free_mem_220489,
                                  .size =0, .references =NULL};
    struct memblock mem_220492 = {.desc ="mem_220492", .mem =
                                  futhark_mc_task_236717->free_mem_220492,
                                  .size =0, .references =NULL};
    int64_t bytes_220494 = futhark_mc_task_236717->free_bytes_220494;
    struct memblock mem_220567 = {.desc ="mem_220567", .mem =
                                  futhark_mc_task_236717->free_mem_220567,
                                  .size =0, .references =NULL};
    struct memblock mem_220570 = {.desc ="mem_220570", .mem =
                                  futhark_mc_task_236717->free_mem_220570,
                                  .size =0, .references =NULL};
    int64_t iter_234844;
    struct futhark_mc_segmap_parloop_struct_236726
    futhark_mc_segmap_parloop_struct_236726;
    
    futhark_mc_segmap_parloop_struct_236726.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236726.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236726.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236726.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236726.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236726.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236726.free_gtid_215421 = gtid_215421;
    futhark_mc_segmap_parloop_struct_236726.free_x_215426 = x_215426;
    futhark_mc_segmap_parloop_struct_236726.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236726.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236726.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236726.free_mem_220489 = mem_220489.mem;
    futhark_mc_segmap_parloop_struct_236726.free_mem_220492 = mem_220492.mem;
    futhark_mc_segmap_parloop_struct_236726.free_bytes_220494 = bytes_220494;
    futhark_mc_segmap_parloop_struct_236726.free_mem_220567 = mem_220567.mem;
    futhark_mc_segmap_parloop_struct_236726.free_mem_220570 = mem_220570.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236727_task;
    
    futhark_mc_segmap_parloop_236727_task.name =
        "futhark_mc_segmap_parloop_236727";
    futhark_mc_segmap_parloop_236727_task.fn = futhark_mc_segmap_parloop_236727;
    futhark_mc_segmap_parloop_236727_task.args =
        &futhark_mc_segmap_parloop_struct_236726;
    futhark_mc_segmap_parloop_236727_task.iterations = iterations;
    futhark_mc_segmap_parloop_236727_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236727_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236727_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236727_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236727_task);
    
    if (futhark_mc_segmap_parloop_236727_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236727_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236727_total_end -
                 futhark_mc_segmap_parloop_236727_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236727_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236727_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236727_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236725_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236725_end -
                 futhark_mc_segmap_nested_task_236725_start;
        
        ctx->futhark_mc_segmap_nested_task_236725_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236725_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236725_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236703(void *args, int64_t start,
                                            int64_t end, int flat_tid_215420,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236702
    *futhark_mc_segmap_parloop_struct_236702 =
    (struct futhark_mc_segmap_parloop_struct_236702 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236702->ctx;
    uint64_t futhark_mc_segmap_parloop_236703_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236703_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236702->free_n_203572;
    int64_t q_t_203576 =
            futhark_mc_segmap_parloop_struct_236702->free_q_t_203576;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236702->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236702->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236702->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236702->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236702->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236702->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236702->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_segmap_parloop_struct_236702->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 =
            futhark_mc_segmap_parloop_struct_236702->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_segmap_parloop_struct_236702->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_segmap_parloop_struct_236702->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_segmap_parloop_struct_236702->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_segmap_parloop_struct_236702->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_segmap_parloop_struct_236702->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_segmap_parloop_struct_236702->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_segmap_parloop_struct_236702->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220494 =
            futhark_mc_segmap_parloop_struct_236702->free_bytes_220494;
    struct memblock mem_220709 = {.desc ="mem_220709", .mem =
                                  futhark_mc_segmap_parloop_struct_236702->free_mem_220709,
                                  .size =0, .references =NULL};
    struct memblock mem_220713 = {.desc ="mem_220713", .mem =
                                  futhark_mc_segmap_parloop_struct_236702->free_mem_220713,
                                  .size =0, .references =NULL};
    size_t mem_220486_cached_sizze_236704 = 0;
    unsigned char *mem_220486 = NULL;
    size_t mem_220489_cached_sizze_236705 = 0;
    unsigned char *mem_220489 = NULL;
    size_t mem_220492_cached_sizze_236706 = 0;
    unsigned char *mem_220492 = NULL;
    size_t mem_220567_cached_sizze_236707 = 0;
    unsigned char *mem_220567 = NULL;
    size_t mem_220570_cached_sizze_236708 = 0;
    unsigned char *mem_220570 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234487 = start;
    
    if (mem_220486_cached_sizze_236704 < (size_t) bytes_217420) {
        mem_220486 = realloc(mem_220486, bytes_217420);
        mem_220486_cached_sizze_236704 = bytes_217420;
    }
    if (mem_220489_cached_sizze_236705 < (size_t) bytes_217420) {
        mem_220489 = realloc(mem_220489, bytes_217420);
        mem_220489_cached_sizze_236705 = bytes_217420;
    }
    if (mem_220492_cached_sizze_236706 < (size_t) bytes_217420) {
        mem_220492 = realloc(mem_220492, bytes_217420);
        mem_220492_cached_sizze_236706 = bytes_217420;
    }
    if (mem_220567_cached_sizze_236707 < (size_t) bytes_217900) {
        mem_220567 = realloc(mem_220567, bytes_217900);
        mem_220567_cached_sizze_236707 = bytes_217900;
    }
    if (mem_220570_cached_sizze_236708 < (size_t) bytes_217900) {
        mem_220570 = realloc(mem_220570, bytes_217900);
        mem_220570_cached_sizze_236708 = bytes_217900;
    }
    for (; iter_234487 < end; iter_234487++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_234743 = partition_sizze_203667;
        int64_t gtid_215421 = iter_234487;
        int64_t remnant_234744 = iter_234487 - gtid_215421;
        int64_t x_215426;
        
        x_215426 = ((int64_t *) mem_217461.mem)[gtid_215421];
        
        int64_t flat_tid_234488 = (int64_t) 0;
        int32_t num_tasks_234745;
        struct futhark_mc_task_236709 futhark_mc_task_236709;
        
        futhark_mc_task_236709.ctx = ctx;
        futhark_mc_task_236709.free_n_203572 = n_203572;
        futhark_mc_task_236709.free_gtid_215421 = gtid_215421;
        futhark_mc_task_236709.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_236709.free_mem_219926 = mem_219926.mem;
        futhark_mc_task_236709.free_mem_220486 = mem_220486;
        
        struct scheduler_segop futhark_mc_task_236709_task;
        
        futhark_mc_task_236709_task.args = &futhark_mc_task_236709;
        futhark_mc_task_236709_task.top_level_fn =
            futhark_mc_segmap_task_236710;
        futhark_mc_task_236709_task.name = "futhark_mc_segmap_task_236710";
        futhark_mc_task_236709_task.iterations = n_203572;
        futhark_mc_task_236709_task.task_time =
            &ctx->futhark_mc_segmap_task_236710_total_time;
        futhark_mc_task_236709_task.task_iter =
            &ctx->futhark_mc_segmap_task_236710_total_iter;
        futhark_mc_task_236709_task.sched = STATIC;
        futhark_mc_task_236709_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236710_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236709_task);
        
        if (futhark_mc_segmap_task_236710_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_234493 = (int64_t) 0;
        int32_t num_tasks_234749;
        struct futhark_mc_task_236713 futhark_mc_task_236713;
        
        futhark_mc_task_236713.ctx = ctx;
        futhark_mc_task_236713.free_n_203572 = n_203572;
        futhark_mc_task_236713.free_gtid_215421 = gtid_215421;
        futhark_mc_task_236713.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236713.free_ctx_param_ext_217984 = ctx_param_ext_217984;
        futhark_mc_task_236713.free_ctx_param_ext_217985 = ctx_param_ext_217985;
        futhark_mc_task_236713.free_ctx_param_ext_217987 = ctx_param_ext_217987;
        futhark_mc_task_236713.free_mem_param_217989 = mem_param_217989.mem;
        futhark_mc_task_236713.free_mem_220486 = mem_220486;
        futhark_mc_task_236713.free_mem_220489 = mem_220489;
        futhark_mc_task_236713.free_mem_220492 = mem_220492;
        
        struct scheduler_segop futhark_mc_task_236713_task;
        
        futhark_mc_task_236713_task.args = &futhark_mc_task_236713;
        futhark_mc_task_236713_task.top_level_fn =
            futhark_mc_segmap_task_236714;
        futhark_mc_task_236713_task.name = "futhark_mc_segmap_task_236714";
        futhark_mc_task_236713_task.iterations = n_203572;
        futhark_mc_task_236713_task.task_time =
            &ctx->futhark_mc_segmap_task_236714_total_time;
        futhark_mc_task_236713_task.task_iter =
            &ctx->futhark_mc_segmap_task_236714_total_iter;
        futhark_mc_task_236713_task.sched = STATIC;
        futhark_mc_task_236713_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236714_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236713_task);
        
        if (futhark_mc_segmap_task_236714_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_234624 = (int64_t) 0;
        int32_t num_tasks_234761;
        int64_t flat_tid_234507 = (int64_t) 0;
        struct futhark_mc_task_236717 futhark_mc_task_236717;
        
        futhark_mc_task_236717.ctx = ctx;
        futhark_mc_task_236717.free_n_203572 = n_203572;
        futhark_mc_task_236717.free_q_t_203576 = q_t_203576;
        futhark_mc_task_236717.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236717.free_t_n_m_203740 = t_n_m_203740;
        futhark_mc_task_236717.free_i_203760 = i_203760;
        futhark_mc_task_236717.free_gtid_215421 = gtid_215421;
        futhark_mc_task_236717.free_x_215426 = x_215426;
        futhark_mc_task_236717.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236717.free_mem_217953 = mem_217953.mem;
        futhark_mc_task_236717.free_mem_217957 = mem_217957.mem;
        futhark_mc_task_236717.free_mem_220489 = mem_220489;
        futhark_mc_task_236717.free_mem_220492 = mem_220492;
        futhark_mc_task_236717.free_bytes_220494 = bytes_220494;
        futhark_mc_task_236717.free_mem_220567 = mem_220567;
        futhark_mc_task_236717.free_mem_220570 = mem_220570;
        
        struct scheduler_segop futhark_mc_task_236717_task;
        
        futhark_mc_task_236717_task.args = &futhark_mc_task_236717;
        futhark_mc_task_236717_task.top_level_fn =
            futhark_mc_segmap_task_236718;
        futhark_mc_task_236717_task.name = "futhark_mc_segmap_task_236718";
        futhark_mc_task_236717_task.iterations = t_n_m_203740;
        futhark_mc_task_236717_task.task_time =
            &ctx->futhark_mc_segmap_task_236718_total_time;
        futhark_mc_task_236717_task.task_iter =
            &ctx->futhark_mc_segmap_task_236718_total_iter;
        futhark_mc_task_236717_task.sched = STATIC;
        futhark_mc_task_236717_task.nested_fn =
            futhark_mc_segmap_nested_task_236725;
        
        int futhark_mc_segmap_task_236718_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236717_task);
        
        if (futhark_mc_segmap_task_236718_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220709.mem + gtid_215421 * t_n_m_203740 * (int64_t) 8,
                    mem_220567 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
        if (t_n_m_203740 * (int64_t) 8 > 0)
            memmove(mem_220713.mem + gtid_215421 * t_n_m_203740 * (int64_t) 8,
                    mem_220570 + (int64_t) 0, t_n_m_203740 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220486);
    free(mem_220489);
    free(mem_220492);
    free(mem_220567);
    free(mem_220570);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236703_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236703_end -
                 futhark_mc_segmap_parloop_236703_start;
        
        ctx->futhark_mc_segmap_parloop_236703_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236703_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236703_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236701(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215420 = tid;
    int num_tasks_234326 = info.nsubtasks;
    struct futhark_mc_task_236688 *futhark_mc_task_236688 =
                                  (struct futhark_mc_task_236688 *) args;
    struct futhark_context *ctx = futhark_mc_task_236688->ctx;
    uint64_t futhark_mc_segmap_nested_task_236701_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236701_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236688->free_n_203572;
    int64_t q_t_203576 = futhark_mc_task_236688->free_q_t_203576;
    int64_t jump_t_203582 = futhark_mc_task_236688->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236688->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236688->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236688->free_i_203760;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236688->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236688->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236688->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_217461 = {.desc ="mem_217461", .mem =
                                  futhark_mc_task_236688->free_mem_217461,
                                  .size =0, .references =NULL};
    int64_t bytes_217900 = futhark_mc_task_236688->free_bytes_217900;
    struct memblock mem_217953 = {.desc ="mem_217953", .mem =
                                  futhark_mc_task_236688->free_mem_217953,
                                  .size =0, .references =NULL};
    struct memblock mem_217957 = {.desc ="mem_217957", .mem =
                                  futhark_mc_task_236688->free_mem_217957,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_217984 =
            futhark_mc_task_236688->free_ctx_param_ext_217984;
    int64_t ctx_param_ext_217985 =
            futhark_mc_task_236688->free_ctx_param_ext_217985;
    int64_t ctx_param_ext_217987 =
            futhark_mc_task_236688->free_ctx_param_ext_217987;
    struct memblock mem_param_217989 = {.desc ="mem_param_217989", .mem =
                                        futhark_mc_task_236688->free_mem_param_217989,
                                        .size =0, .references =NULL};
    struct memblock mem_219926 = {.desc ="mem_219926", .mem =
                                  futhark_mc_task_236688->free_mem_219926,
                                  .size =0, .references =NULL};
    int64_t bytes_220494 = futhark_mc_task_236688->free_bytes_220494;
    struct memblock mem_220709 = {.desc ="mem_220709", .mem =
                                  futhark_mc_task_236688->free_mem_220709,
                                  .size =0, .references =NULL};
    struct memblock mem_220713 = {.desc ="mem_220713", .mem =
                                  futhark_mc_task_236688->free_mem_220713,
                                  .size =0, .references =NULL};
    int64_t iter_234487;
    struct futhark_mc_segmap_parloop_struct_236702
    futhark_mc_segmap_parloop_struct_236702;
    
    futhark_mc_segmap_parloop_struct_236702.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236702.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236702.free_q_t_203576 = q_t_203576;
    futhark_mc_segmap_parloop_struct_236702.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236702.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236702.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236702.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236702.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236702.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236702.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236702.free_mem_217461 = mem_217461.mem;
    futhark_mc_segmap_parloop_struct_236702.free_bytes_217900 = bytes_217900;
    futhark_mc_segmap_parloop_struct_236702.free_mem_217953 = mem_217953.mem;
    futhark_mc_segmap_parloop_struct_236702.free_mem_217957 = mem_217957.mem;
    futhark_mc_segmap_parloop_struct_236702.free_ctx_param_ext_217984 =
        ctx_param_ext_217984;
    futhark_mc_segmap_parloop_struct_236702.free_ctx_param_ext_217985 =
        ctx_param_ext_217985;
    futhark_mc_segmap_parloop_struct_236702.free_ctx_param_ext_217987 =
        ctx_param_ext_217987;
    futhark_mc_segmap_parloop_struct_236702.free_mem_param_217989 =
        mem_param_217989.mem;
    futhark_mc_segmap_parloop_struct_236702.free_mem_219926 = mem_219926.mem;
    futhark_mc_segmap_parloop_struct_236702.free_bytes_220494 = bytes_220494;
    futhark_mc_segmap_parloop_struct_236702.free_mem_220709 = mem_220709.mem;
    futhark_mc_segmap_parloop_struct_236702.free_mem_220713 = mem_220713.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236703_task;
    
    futhark_mc_segmap_parloop_236703_task.name =
        "futhark_mc_segmap_parloop_236703";
    futhark_mc_segmap_parloop_236703_task.fn = futhark_mc_segmap_parloop_236703;
    futhark_mc_segmap_parloop_236703_task.args =
        &futhark_mc_segmap_parloop_struct_236702;
    futhark_mc_segmap_parloop_236703_task.iterations = iterations;
    futhark_mc_segmap_parloop_236703_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236703_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236703_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236703_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236703_task);
    
    if (futhark_mc_segmap_parloop_236703_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236703_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236703_total_end -
                 futhark_mc_segmap_parloop_236703_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236703_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236703_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236703_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236701_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236701_end -
                 futhark_mc_segmap_nested_task_236701_start;
        
        ctx->futhark_mc_segmap_nested_task_236701_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236701_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236701_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236751 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_y_206673;
    int64_t free_bytes_217420;
    unsigned char *free_ext_mem_220718;
    unsigned char *free_ext_mem_220719;
    unsigned char *free_mem_220741;
};
struct futhark_mc_segmap_parloop_struct_236753 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_y_206673;
    int64_t free_bytes_217420;
    unsigned char *free_ext_mem_220718;
    unsigned char *free_ext_mem_220719;
    unsigned char *free_mem_220741;
};
static int futhark_mc_segmap_parloop_236754(void *args, int64_t start,
                                            int64_t end, int flat_tid_215679,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236753
    *futhark_mc_segmap_parloop_struct_236753 =
    (struct futhark_mc_segmap_parloop_struct_236753 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236753->ctx;
    uint64_t futhark_mc_segmap_parloop_236754_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236754_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236753->free_n_203572;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236753->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236753->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236753->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236753->free_i_203760;
    int64_t y_206673 = futhark_mc_segmap_parloop_struct_236753->free_y_206673;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236753->free_bytes_217420;
    struct memblock ext_mem_220718 = {.desc ="ext_mem_220718", .mem =
                                      futhark_mc_segmap_parloop_struct_236753->free_ext_mem_220718,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220719 = {.desc ="ext_mem_220719", .mem =
                                      futhark_mc_segmap_parloop_struct_236753->free_ext_mem_220719,
                                      .size =0, .references =NULL};
    struct memblock mem_220741 = {.desc ="mem_220741", .mem =
                                  futhark_mc_segmap_parloop_struct_236753->free_mem_220741,
                                  .size =0, .references =NULL};
    size_t mem_220725_cached_sizze_236755 = 0;
    unsigned char *mem_220725 = NULL;
    int64_t iterations = end - start;
    int64_t iter_234975 = start;
    
    if (mem_220725_cached_sizze_236755 < (size_t) bytes_217420) {
        mem_220725 = realloc(mem_220725, bytes_217420);
        mem_220725_cached_sizze_236755 = bytes_217420;
    }
    for (; iter_234975 < end; iter_234975++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235025 = partition_sizze_203667;
        int64_t gtid_215680 = iter_234975;
        int64_t remnant_235026 = iter_234975 - gtid_215680;
        
        for (int64_t i_234976 = 0; i_234976 < n_203572; i_234976++) {
            int64_t m_v_234978 = sdiv64(i_234976, jump_t_203582);
            bool cond_234979 = m_v_234978 == y_206673;
            int64_t j_234980;
            
            if (cond_234979) {
                int64_t j_t_res_234981 = sub64(m_v_234978, (int64_t) 1);
                
                j_234980 = j_t_res_234981;
            } else {
                j_234980 = m_v_234978;
            }
            
            int64_t min_arg_234982 = mul64(jump_t_203582, j_234980);
            int64_t min_res_234983 = smin64(i_203760, min_arg_234982);
            int64_t defunc_0_m_fun_arg_234984 = add64((int64_t) 1, j_234980);
            int64_t min_arg_234985 = mul64(jump_t_203582,
                                           defunc_0_m_fun_arg_234984);
            int64_t min_res_234986 = smin64(i_203760, min_arg_234985);
            int64_t i64_arg_234987 = sub64(min_res_234986, min_res_234983);
            double i64_res_234988 = sitofp_i64_f64(i64_arg_234987);
            int64_t i64_arg_234989 = sub64(i_234976, min_res_234983);
            double i64_res_234990 = sitofp_i64_f64(i64_arg_234989);
            double u_234991 = i64_res_234990 / i64_res_234988;
            double u2_234992 = u_234991 * u_234991;
            double u3_234993 = u_234991 * u2_234992;
            double x_234994 = 2.0 * u3_234993;
            double y_234995 = 3.0 * u2_234992;
            double x_234996 = x_234994 - y_234995;
            double x_234997 = 1.0 + x_234996;
            bool x_234998 = sle64((int64_t) 0, j_234980);
            bool y_234999 = slt64(j_234980, t_n_m_203740);
            bool bounds_check_235000 = x_234998 && y_234999;
            bool index_certs_235001;
            
            if (!bounds_check_235000) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) j_234980,
                              "] out of bounds for array of shape [",
                              (long long) t_n_m_203740, "].",
                              "-> #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_235002;
            
            y_235002 = ((double *) ext_mem_220719.mem)[gtid_215680 *
                                                       t_n_m_203740 + j_234980];
            
            double x_235003 = x_234997 * y_235002;
            double x_235004 = y_234995 - x_234994;
            bool x_235005 = sle64((int64_t) 0, defunc_0_m_fun_arg_234984);
            bool y_235006 = slt64(defunc_0_m_fun_arg_234984, t_n_m_203740);
            bool bounds_check_235007 = x_235005 && y_235006;
            bool index_certs_235008;
            
            if (!bounds_check_235007) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) defunc_0_m_fun_arg_234984,
                              "] out of bounds for array of shape [",
                              (long long) t_n_m_203740, "].",
                              "-> #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_235009;
            
            y_235009 = ((double *) ext_mem_220719.mem)[gtid_215680 *
                                                       t_n_m_203740 +
                                                       defunc_0_m_fun_arg_234984];
            
            double y_235010 = x_235004 * y_235009;
            double x_235011 = x_235003 + y_235010;
            double y_235012 = 2.0 * u2_234992;
            double x_235013 = u3_234993 - y_235012;
            double x_235014 = u_234991 + x_235013;
            double y_235015;
            
            y_235015 = ((double *) ext_mem_220718.mem)[gtid_215680 *
                                                       t_n_m_203740 + j_234980];
            
            double x_235016 = x_235014 * y_235015;
            double y_235017 = i64_res_234988 * x_235016;
            double x_235018 = x_235011 + y_235017;
            double x_235019 = u3_234993 - u2_234992;
            double y_235020;
            
            y_235020 = ((double *) ext_mem_220718.mem)[gtid_215680 *
                                                       t_n_m_203740 +
                                                       defunc_0_m_fun_arg_234984];
            
            double x_235021 = x_235019 * y_235020;
            double y_235022 = i64_res_234988 * x_235021;
            double defunc_4_interpolate_proc_res_235023 = x_235018 + y_235022;
            
            ((double *) mem_220725)[i_234976] =
                defunc_4_interpolate_proc_res_235023;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220741.mem + gtid_215680 * n_203572 * (int64_t) 8,
                    mem_220725 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220725);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236754_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236754_end -
                 futhark_mc_segmap_parloop_236754_start;
        
        ctx->futhark_mc_segmap_parloop_236754_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236754_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236754_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236752(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215679 = tid;
    int num_tasks_234974 = info.nsubtasks;
    struct futhark_mc_task_236751 *futhark_mc_task_236751 =
                                  (struct futhark_mc_task_236751 *) args;
    struct futhark_context *ctx = futhark_mc_task_236751->ctx;
    uint64_t futhark_mc_segmap_task_236752_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236752_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236751->free_n_203572;
    int64_t jump_t_203582 = futhark_mc_task_236751->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236751->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236751->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236751->free_i_203760;
    int64_t y_206673 = futhark_mc_task_236751->free_y_206673;
    int64_t bytes_217420 = futhark_mc_task_236751->free_bytes_217420;
    struct memblock ext_mem_220718 = {.desc ="ext_mem_220718", .mem =
                                      futhark_mc_task_236751->free_ext_mem_220718,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220719 = {.desc ="ext_mem_220719", .mem =
                                      futhark_mc_task_236751->free_ext_mem_220719,
                                      .size =0, .references =NULL};
    struct memblock mem_220741 = {.desc ="mem_220741", .mem =
                                  futhark_mc_task_236751->free_mem_220741,
                                  .size =0, .references =NULL};
    int64_t iter_234975;
    struct futhark_mc_segmap_parloop_struct_236753
    futhark_mc_segmap_parloop_struct_236753;
    
    futhark_mc_segmap_parloop_struct_236753.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236753.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236753.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236753.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236753.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236753.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236753.free_y_206673 = y_206673;
    futhark_mc_segmap_parloop_struct_236753.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236753.free_ext_mem_220718 =
        ext_mem_220718.mem;
    futhark_mc_segmap_parloop_struct_236753.free_ext_mem_220719 =
        ext_mem_220719.mem;
    futhark_mc_segmap_parloop_struct_236753.free_mem_220741 = mem_220741.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236754_task;
    
    futhark_mc_segmap_parloop_236754_task.name =
        "futhark_mc_segmap_parloop_236754";
    futhark_mc_segmap_parloop_236754_task.fn = futhark_mc_segmap_parloop_236754;
    futhark_mc_segmap_parloop_236754_task.args =
        &futhark_mc_segmap_parloop_struct_236753;
    futhark_mc_segmap_parloop_236754_task.iterations = iterations;
    futhark_mc_segmap_parloop_236754_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236754_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236754_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236754_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236754_task);
    
    if (futhark_mc_segmap_parloop_236754_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236754_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236754_total_end -
                 futhark_mc_segmap_parloop_236754_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236754_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236754_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236754_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236752_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236752_end -
                 futhark_mc_segmap_task_236752_start;
        
        ctx->futhark_mc_segmap_task_236752_runs[tid]++;
        ctx->futhark_mc_segmap_task_236752_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236752_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236757 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_t_203582;
    int64_t free_partition_sizze_203667;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_y_206673;
    int64_t free_bytes_217420;
    unsigned char *free_ext_mem_220718;
    unsigned char *free_ext_mem_220719;
    unsigned char *free_mem_220741;
};
struct futhark_mc_task_236760 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_y_206673;
    int64_t free_gtid_215686;
    unsigned char *free_ext_mem_220718;
    unsigned char *free_ext_mem_220719;
    unsigned char *free_mem_220722;
};
struct futhark_mc_segmap_parloop_struct_236762 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_jump_t_203582;
    int64_t free_t_n_m_203740;
    int64_t free_i_203760;
    int64_t free_y_206673;
    int64_t free_gtid_215686;
    unsigned char *free_ext_mem_220718;
    unsigned char *free_ext_mem_220719;
    unsigned char *free_mem_220722;
};
static int futhark_mc_segmap_parloop_236763(void *args, int64_t start,
                                            int64_t end, int flat_tid_235029,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236762
    *futhark_mc_segmap_parloop_struct_236762 =
    (struct futhark_mc_segmap_parloop_struct_236762 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236762->ctx;
    uint64_t futhark_mc_segmap_parloop_236763_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236763_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236762->free_n_203572;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236762->free_jump_t_203582;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236762->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236762->free_i_203760;
    int64_t y_206673 = futhark_mc_segmap_parloop_struct_236762->free_y_206673;
    int64_t gtid_215686 =
            futhark_mc_segmap_parloop_struct_236762->free_gtid_215686;
    struct memblock ext_mem_220718 = {.desc ="ext_mem_220718", .mem =
                                      futhark_mc_segmap_parloop_struct_236762->free_ext_mem_220718,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220719 = {.desc ="ext_mem_220719", .mem =
                                      futhark_mc_segmap_parloop_struct_236762->free_ext_mem_220719,
                                      .size =0, .references =NULL};
    struct memblock mem_220722 = {.desc ="mem_220722", .mem =
                                  futhark_mc_segmap_parloop_struct_236762->free_mem_220722,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235080 = start;
    
    for (; iter_235080 < end; iter_235080++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235082 = n_203572;
        int64_t gtid_235030 = iter_235080;
        int64_t remnant_235083 = iter_235080 - gtid_235030;
        int64_t m_v_235031 = sdiv64(gtid_235030, jump_t_203582);
        bool cond_235032 = m_v_235031 == y_206673;
        int64_t j_235033;
        
        if (cond_235032) {
            int64_t j_t_res_235081 = sub64(m_v_235031, (int64_t) 1);
            
            j_235033 = j_t_res_235081;
        } else {
            j_235033 = m_v_235031;
        }
        
        int64_t min_arg_235035 = mul64(jump_t_203582, j_235033);
        int64_t min_res_235036 = smin64(i_203760, min_arg_235035);
        int64_t defunc_0_m_fun_arg_235037 = add64((int64_t) 1, j_235033);
        int64_t min_arg_235038 = mul64(jump_t_203582,
                                       defunc_0_m_fun_arg_235037);
        int64_t min_res_235039 = smin64(i_203760, min_arg_235038);
        int64_t i64_arg_235040 = sub64(min_res_235039, min_res_235036);
        double i64_res_235041 = sitofp_i64_f64(i64_arg_235040);
        int64_t i64_arg_235042 = sub64(gtid_235030, min_res_235036);
        double i64_res_235043 = sitofp_i64_f64(i64_arg_235042);
        double u_235044 = i64_res_235043 / i64_res_235041;
        double u2_235045 = u_235044 * u_235044;
        double u3_235046 = u_235044 * u2_235045;
        double x_235047 = 2.0 * u3_235046;
        double y_235048 = 3.0 * u2_235045;
        double x_235049 = x_235047 - y_235048;
        double x_235050 = 1.0 + x_235049;
        bool x_235051 = sle64((int64_t) 0, j_235033);
        bool y_235052 = slt64(j_235033, t_n_m_203740);
        bool bounds_check_235053 = x_235051 && y_235052;
        bool index_certs_235054;
        
        if (!bounds_check_235053) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) j_235033,
                                   "] out of bounds for array of shape [",
                                   (long long) t_n_m_203740, "].",
                                   "-> #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_235055;
        
        y_235055 = ((double *) ext_mem_220719.mem)[gtid_215686 * t_n_m_203740 +
                                                   j_235033];
        
        double x_235056 = x_235050 * y_235055;
        double x_235057 = y_235048 - x_235047;
        bool x_235058 = sle64((int64_t) 0, defunc_0_m_fun_arg_235037);
        bool y_235059 = slt64(defunc_0_m_fun_arg_235037, t_n_m_203740);
        bool bounds_check_235060 = x_235058 && y_235059;
        bool index_certs_235061;
        
        if (!bounds_check_235060) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [",
                                   (long long) defunc_0_m_fun_arg_235037,
                                   "] out of bounds for array of shape [",
                                   (long long) t_n_m_203740, "].",
                                   "-> #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_235062;
        
        y_235062 = ((double *) ext_mem_220719.mem)[gtid_215686 * t_n_m_203740 +
                                                   defunc_0_m_fun_arg_235037];
        
        double y_235063 = x_235057 * y_235062;
        double x_235064 = x_235056 + y_235063;
        double y_235065 = 2.0 * u2_235045;
        double x_235066 = u3_235046 - y_235065;
        double x_235067 = u_235044 + x_235066;
        double y_235068;
        
        y_235068 = ((double *) ext_mem_220718.mem)[gtid_215686 * t_n_m_203740 +
                                                   j_235033];
        
        double x_235069 = x_235067 * y_235068;
        double y_235070 = i64_res_235041 * x_235069;
        double x_235071 = x_235064 + y_235070;
        double x_235072 = u3_235046 - u2_235045;
        double y_235073;
        
        y_235073 = ((double *) ext_mem_220718.mem)[gtid_215686 * t_n_m_203740 +
                                                   defunc_0_m_fun_arg_235037];
        
        double x_235074 = x_235072 * y_235073;
        double y_235075 = i64_res_235041 * x_235074;
        double defunc_4_interpolate_proc_res_235076 = x_235071 + y_235075;
        
        ((double *) mem_220722.mem)[gtid_235030] =
            defunc_4_interpolate_proc_res_235076;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236763_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236763_end -
                 futhark_mc_segmap_parloop_236763_start;
        
        ctx->futhark_mc_segmap_parloop_236763_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236763_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236763_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236761(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235029 = tid;
    int num_tasks_235079 = info.nsubtasks;
    struct futhark_mc_task_236760 *futhark_mc_task_236760 =
                                  (struct futhark_mc_task_236760 *) args;
    struct futhark_context *ctx = futhark_mc_task_236760->ctx;
    uint64_t futhark_mc_segmap_task_236761_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236761_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236760->free_n_203572;
    int64_t jump_t_203582 = futhark_mc_task_236760->free_jump_t_203582;
    int64_t t_n_m_203740 = futhark_mc_task_236760->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236760->free_i_203760;
    int64_t y_206673 = futhark_mc_task_236760->free_y_206673;
    int64_t gtid_215686 = futhark_mc_task_236760->free_gtid_215686;
    struct memblock ext_mem_220718 = {.desc ="ext_mem_220718", .mem =
                                      futhark_mc_task_236760->free_ext_mem_220718,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220719 = {.desc ="ext_mem_220719", .mem =
                                      futhark_mc_task_236760->free_ext_mem_220719,
                                      .size =0, .references =NULL};
    struct memblock mem_220722 = {.desc ="mem_220722", .mem =
                                  futhark_mc_task_236760->free_mem_220722,
                                  .size =0, .references =NULL};
    int64_t iter_235080;
    struct futhark_mc_segmap_parloop_struct_236762
    futhark_mc_segmap_parloop_struct_236762;
    
    futhark_mc_segmap_parloop_struct_236762.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236762.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236762.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236762.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236762.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236762.free_y_206673 = y_206673;
    futhark_mc_segmap_parloop_struct_236762.free_gtid_215686 = gtid_215686;
    futhark_mc_segmap_parloop_struct_236762.free_ext_mem_220718 =
        ext_mem_220718.mem;
    futhark_mc_segmap_parloop_struct_236762.free_ext_mem_220719 =
        ext_mem_220719.mem;
    futhark_mc_segmap_parloop_struct_236762.free_mem_220722 = mem_220722.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236763_task;
    
    futhark_mc_segmap_parloop_236763_task.name =
        "futhark_mc_segmap_parloop_236763";
    futhark_mc_segmap_parloop_236763_task.fn = futhark_mc_segmap_parloop_236763;
    futhark_mc_segmap_parloop_236763_task.args =
        &futhark_mc_segmap_parloop_struct_236762;
    futhark_mc_segmap_parloop_236763_task.iterations = iterations;
    futhark_mc_segmap_parloop_236763_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236763_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236763_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236763_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236763_task);
    
    if (futhark_mc_segmap_parloop_236763_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236763_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236763_total_end -
                 futhark_mc_segmap_parloop_236763_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236763_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236763_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236763_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236761_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236761_end -
                 futhark_mc_segmap_task_236761_start;
        
        ctx->futhark_mc_segmap_task_236761_runs[tid]++;
        ctx->futhark_mc_segmap_task_236761_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236761_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236758(void *args, int64_t start,
                                            int64_t end, int flat_tid_215685,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236757
    *futhark_mc_segmap_parloop_struct_236757 =
    (struct futhark_mc_segmap_parloop_struct_236757 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236757->ctx;
    uint64_t futhark_mc_segmap_parloop_236758_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236758_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236757->free_n_203572;
    int64_t jump_t_203582 =
            futhark_mc_segmap_parloop_struct_236757->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236757->free_partition_sizze_203667;
    int64_t t_n_m_203740 =
            futhark_mc_segmap_parloop_struct_236757->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236757->free_i_203760;
    int64_t y_206673 = futhark_mc_segmap_parloop_struct_236757->free_y_206673;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236757->free_bytes_217420;
    struct memblock ext_mem_220718 = {.desc ="ext_mem_220718", .mem =
                                      futhark_mc_segmap_parloop_struct_236757->free_ext_mem_220718,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220719 = {.desc ="ext_mem_220719", .mem =
                                      futhark_mc_segmap_parloop_struct_236757->free_ext_mem_220719,
                                      .size =0, .references =NULL};
    struct memblock mem_220741 = {.desc ="mem_220741", .mem =
                                  futhark_mc_segmap_parloop_struct_236757->free_mem_220741,
                                  .size =0, .references =NULL};
    size_t mem_220722_cached_sizze_236759 = 0;
    unsigned char *mem_220722 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235028 = start;
    
    if (mem_220722_cached_sizze_236759 < (size_t) bytes_217420) {
        mem_220722 = realloc(mem_220722, bytes_217420);
        mem_220722_cached_sizze_236759 = bytes_217420;
    }
    for (; iter_235028 < end; iter_235028++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235077 = partition_sizze_203667;
        int64_t gtid_215686 = iter_235028;
        int64_t remnant_235078 = iter_235028 - gtid_215686;
        int64_t flat_tid_235029 = (int64_t) 0;
        int32_t num_tasks_235079;
        struct futhark_mc_task_236760 futhark_mc_task_236760;
        
        futhark_mc_task_236760.ctx = ctx;
        futhark_mc_task_236760.free_n_203572 = n_203572;
        futhark_mc_task_236760.free_jump_t_203582 = jump_t_203582;
        futhark_mc_task_236760.free_t_n_m_203740 = t_n_m_203740;
        futhark_mc_task_236760.free_i_203760 = i_203760;
        futhark_mc_task_236760.free_y_206673 = y_206673;
        futhark_mc_task_236760.free_gtid_215686 = gtid_215686;
        futhark_mc_task_236760.free_ext_mem_220718 = ext_mem_220718.mem;
        futhark_mc_task_236760.free_ext_mem_220719 = ext_mem_220719.mem;
        futhark_mc_task_236760.free_mem_220722 = mem_220722;
        
        struct scheduler_segop futhark_mc_task_236760_task;
        
        futhark_mc_task_236760_task.args = &futhark_mc_task_236760;
        futhark_mc_task_236760_task.top_level_fn =
            futhark_mc_segmap_task_236761;
        futhark_mc_task_236760_task.name = "futhark_mc_segmap_task_236761";
        futhark_mc_task_236760_task.iterations = n_203572;
        futhark_mc_task_236760_task.task_time =
            &ctx->futhark_mc_segmap_task_236761_total_time;
        futhark_mc_task_236760_task.task_iter =
            &ctx->futhark_mc_segmap_task_236761_total_iter;
        futhark_mc_task_236760_task.sched = STATIC;
        futhark_mc_task_236760_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236761_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236760_task);
        
        if (futhark_mc_segmap_task_236761_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220741.mem + gtid_215686 * n_203572 * (int64_t) 8,
                    mem_220722 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220722);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236758_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236758_end -
                 futhark_mc_segmap_parloop_236758_start;
        
        ctx->futhark_mc_segmap_parloop_236758_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236758_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236758_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236756(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215685 = tid;
    int num_tasks_234974 = info.nsubtasks;
    struct futhark_mc_task_236751 *futhark_mc_task_236751 =
                                  (struct futhark_mc_task_236751 *) args;
    struct futhark_context *ctx = futhark_mc_task_236751->ctx;
    uint64_t futhark_mc_segmap_nested_task_236756_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236756_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236751->free_n_203572;
    int64_t jump_t_203582 = futhark_mc_task_236751->free_jump_t_203582;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236751->free_partition_sizze_203667;
    int64_t t_n_m_203740 = futhark_mc_task_236751->free_t_n_m_203740;
    int64_t i_203760 = futhark_mc_task_236751->free_i_203760;
    int64_t y_206673 = futhark_mc_task_236751->free_y_206673;
    int64_t bytes_217420 = futhark_mc_task_236751->free_bytes_217420;
    struct memblock ext_mem_220718 = {.desc ="ext_mem_220718", .mem =
                                      futhark_mc_task_236751->free_ext_mem_220718,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220719 = {.desc ="ext_mem_220719", .mem =
                                      futhark_mc_task_236751->free_ext_mem_220719,
                                      .size =0, .references =NULL};
    struct memblock mem_220741 = {.desc ="mem_220741", .mem =
                                  futhark_mc_task_236751->free_mem_220741,
                                  .size =0, .references =NULL};
    int64_t iter_235028;
    struct futhark_mc_segmap_parloop_struct_236757
    futhark_mc_segmap_parloop_struct_236757;
    
    futhark_mc_segmap_parloop_struct_236757.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236757.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236757.free_jump_t_203582 = jump_t_203582;
    futhark_mc_segmap_parloop_struct_236757.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236757.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_segmap_parloop_struct_236757.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236757.free_y_206673 = y_206673;
    futhark_mc_segmap_parloop_struct_236757.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236757.free_ext_mem_220718 =
        ext_mem_220718.mem;
    futhark_mc_segmap_parloop_struct_236757.free_ext_mem_220719 =
        ext_mem_220719.mem;
    futhark_mc_segmap_parloop_struct_236757.free_mem_220741 = mem_220741.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236758_task;
    
    futhark_mc_segmap_parloop_236758_task.name =
        "futhark_mc_segmap_parloop_236758";
    futhark_mc_segmap_parloop_236758_task.fn = futhark_mc_segmap_parloop_236758;
    futhark_mc_segmap_parloop_236758_task.args =
        &futhark_mc_segmap_parloop_struct_236757;
    futhark_mc_segmap_parloop_236758_task.iterations = iterations;
    futhark_mc_segmap_parloop_236758_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236758_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236758_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236758_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236758_task);
    
    if (futhark_mc_segmap_parloop_236758_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236758_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236758_total_end -
                 futhark_mc_segmap_parloop_236758_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236758_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236758_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236758_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236756_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236756_end -
                 futhark_mc_segmap_nested_task_236756_start;
        
        ctx->futhark_mc_segmap_nested_task_236756_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236756_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236756_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236764 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_ext_mem_220748;
    unsigned char *free_ext_mem_220749;
    int64_t free_ext_220753;
    unsigned char *free_mem_220803;
    unsigned char *free_mem_220807;
};
struct futhark_mc_segmap_parloop_struct_236766 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_ext_mem_220748;
    unsigned char *free_ext_mem_220749;
    int64_t free_ext_220753;
    unsigned char *free_mem_220803;
    unsigned char *free_mem_220807;
};
static int futhark_mc_segmap_parloop_236767(void *args, int64_t start,
                                            int64_t end, int flat_tid_215739,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236766
    *futhark_mc_segmap_parloop_struct_236766 =
    (struct futhark_mc_segmap_parloop_struct_236766 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236766->ctx;
    uint64_t futhark_mc_segmap_parloop_236767_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236767_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236766->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236766->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236766->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236766->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236766->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220748 = {.desc ="ext_mem_220748", .mem =
                                      futhark_mc_segmap_parloop_struct_236766->free_ext_mem_220748,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220749 = {.desc ="ext_mem_220749", .mem =
                                      futhark_mc_segmap_parloop_struct_236766->free_ext_mem_220749,
                                      .size =0, .references =NULL};
    int64_t ext_220753 =
            futhark_mc_segmap_parloop_struct_236766->free_ext_220753;
    struct memblock mem_220803 = {.desc ="mem_220803", .mem =
                                  futhark_mc_segmap_parloop_struct_236766->free_mem_220803,
                                  .size =0, .references =NULL};
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_segmap_parloop_struct_236766->free_mem_220807,
                                  .size =0, .references =NULL};
    size_t mem_220772_cached_sizze_236768 = 0;
    unsigned char *mem_220772 = NULL;
    size_t mem_220787_cached_sizze_236769 = 0;
    unsigned char *mem_220787 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235085 = start;
    
    if (mem_220772_cached_sizze_236768 < (size_t) bytes_217420) {
        mem_220772 = realloc(mem_220772, bytes_217420);
        mem_220772_cached_sizze_236768 = bytes_217420;
    }
    if (mem_220787_cached_sizze_236769 < (size_t) bytes_217420) {
        mem_220787 = realloc(mem_220787, bytes_217420);
        mem_220787_cached_sizze_236769 = bytes_217420;
    }
    for (; iter_235085 < end; iter_235085++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235107 = partition_sizze_203667;
        int64_t gtid_215740 = iter_235085;
        int64_t remnant_235108 = iter_235085 - gtid_215740;
        
        for (int64_t i_235086 = 0; i_235086 < n_203572; i_235086++) {
            double x_235088;
            
            x_235088 = ((double *) mem_217415.mem)[gtid_215740 * n_203572 +
                                                   i_235086];
            
            double x_235089;
            
            x_235089 = ((double *) ext_mem_220749.mem)[gtid_215740 * n_203572 +
                                                       i_235086];
            
            double x_235090;
            
            x_235090 = ((double *) ext_mem_220748.mem)[gtid_215740 *
                                                       ext_220753 + i_235086];
            
            double x_235091 = x_235088 - x_235089;
            double defunc_2_f_res_235092 = x_235091 - x_235090;
            bool isnan_res_235093;
            
            isnan_res_235093 = futrts_isnan64(defunc_2_f_res_235092);
            
            double defunc_0_f_res_235094;
            
            if (isnan_res_235093) {
                defunc_0_f_res_235094 = defunc_2_f_res_235092;
            } else {
                double abs_res_235095 = fabs(defunc_2_f_res_235092);
                
                defunc_0_f_res_235094 = abs_res_235095;
            }
            ((double *) mem_220772)[i_235086] = defunc_0_f_res_235094;
        }
        for (int64_t i_235097 = 0; i_235097 < n_203572; i_235097++) {
            int64_t x_235099;
            
            x_235099 = ((int64_t *) mem_217458.mem)[gtid_215740 * n_203572 +
                                                    i_235097];
            
            bool cond_235100 = sle64((int64_t) 0, x_235099);
            double defunc_0_f_res_235101;
            
            if (cond_235100) {
                bool y_235102 = slt64(x_235099, n_203572);
                bool bounds_check_235103 = cond_235100 && y_235102;
                bool index_certs_235104;
                
                if (!bounds_check_235103) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) x_235099,
                                  "] out of bounds for array of shape [",
                                  (long long) n_203572, "].",
                                  "-> #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_235105;
                
                defunc_0_f_res_t_res_235105 = ((double *) mem_220772)[x_235099];
                defunc_0_f_res_235101 = defunc_0_f_res_t_res_235105;
            } else {
                defunc_0_f_res_235101 = INFINITY;
            }
            ((double *) mem_220787)[i_235097] = defunc_0_f_res_235101;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220803.mem + gtid_215740 * n_203572 * (int64_t) 8,
                    mem_220787 + (int64_t) 0, n_203572 * (int64_t) 8);
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220807.mem + gtid_215740 * n_203572 * (int64_t) 8,
                    mem_220772 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220772);
    free(mem_220787);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236767_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236767_end -
                 futhark_mc_segmap_parloop_236767_start;
        
        ctx->futhark_mc_segmap_parloop_236767_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236767_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236767_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236765(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215739 = tid;
    int num_tasks_235084 = info.nsubtasks;
    struct futhark_mc_task_236764 *futhark_mc_task_236764 =
                                  (struct futhark_mc_task_236764 *) args;
    struct futhark_context *ctx = futhark_mc_task_236764->ctx;
    uint64_t futhark_mc_segmap_task_236765_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236765_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236764->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236764->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236764->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236764->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236764->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220748 = {.desc ="ext_mem_220748", .mem =
                                      futhark_mc_task_236764->free_ext_mem_220748,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220749 = {.desc ="ext_mem_220749", .mem =
                                      futhark_mc_task_236764->free_ext_mem_220749,
                                      .size =0, .references =NULL};
    int64_t ext_220753 = futhark_mc_task_236764->free_ext_220753;
    struct memblock mem_220803 = {.desc ="mem_220803", .mem =
                                  futhark_mc_task_236764->free_mem_220803,
                                  .size =0, .references =NULL};
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_task_236764->free_mem_220807,
                                  .size =0, .references =NULL};
    int64_t iter_235085;
    struct futhark_mc_segmap_parloop_struct_236766
    futhark_mc_segmap_parloop_struct_236766;
    
    futhark_mc_segmap_parloop_struct_236766.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236766.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236766.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236766.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236766.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236766.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236766.free_ext_mem_220748 =
        ext_mem_220748.mem;
    futhark_mc_segmap_parloop_struct_236766.free_ext_mem_220749 =
        ext_mem_220749.mem;
    futhark_mc_segmap_parloop_struct_236766.free_ext_220753 = ext_220753;
    futhark_mc_segmap_parloop_struct_236766.free_mem_220803 = mem_220803.mem;
    futhark_mc_segmap_parloop_struct_236766.free_mem_220807 = mem_220807.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236767_task;
    
    futhark_mc_segmap_parloop_236767_task.name =
        "futhark_mc_segmap_parloop_236767";
    futhark_mc_segmap_parloop_236767_task.fn = futhark_mc_segmap_parloop_236767;
    futhark_mc_segmap_parloop_236767_task.args =
        &futhark_mc_segmap_parloop_struct_236766;
    futhark_mc_segmap_parloop_236767_task.iterations = iterations;
    futhark_mc_segmap_parloop_236767_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236767_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236767_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236767_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236767_task);
    
    if (futhark_mc_segmap_parloop_236767_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236767_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236767_total_end -
                 futhark_mc_segmap_parloop_236767_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236767_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236767_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236767_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236765_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236765_end -
                 futhark_mc_segmap_task_236765_start;
        
        ctx->futhark_mc_segmap_task_236765_runs[tid]++;
        ctx->futhark_mc_segmap_task_236765_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236765_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236771 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    unsigned char *free_mem_217415;
    int64_t free_bytes_217420;
    unsigned char *free_mem_217458;
    unsigned char *free_ext_mem_220748;
    unsigned char *free_ext_mem_220749;
    int64_t free_ext_220753;
    unsigned char *free_mem_220803;
    unsigned char *free_mem_220807;
};
struct futhark_mc_task_236775 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215748;
    unsigned char *free_mem_217415;
    unsigned char *free_ext_mem_220748;
    unsigned char *free_ext_mem_220749;
    int64_t free_ext_220753;
    unsigned char *free_mem_220766;
};
struct futhark_mc_segmap_parloop_struct_236777 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215748;
    unsigned char *free_mem_217415;
    unsigned char *free_ext_mem_220748;
    unsigned char *free_ext_mem_220749;
    int64_t free_ext_220753;
    unsigned char *free_mem_220766;
};
static int futhark_mc_segmap_parloop_236778(void *args, int64_t start,
                                            int64_t end, int flat_tid_235112,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236777
    *futhark_mc_segmap_parloop_struct_236777 =
    (struct futhark_mc_segmap_parloop_struct_236777 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236777->ctx;
    uint64_t futhark_mc_segmap_parloop_236778_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236778_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236777->free_n_203572;
    int64_t gtid_215748 =
            futhark_mc_segmap_parloop_struct_236777->free_gtid_215748;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236777->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220748 = {.desc ="ext_mem_220748", .mem =
                                      futhark_mc_segmap_parloop_struct_236777->free_ext_mem_220748,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220749 = {.desc ="ext_mem_220749", .mem =
                                      futhark_mc_segmap_parloop_struct_236777->free_ext_mem_220749,
                                      .size =0, .references =NULL};
    int64_t ext_220753 =
            futhark_mc_segmap_parloop_struct_236777->free_ext_220753;
    struct memblock mem_220766 = {.desc ="mem_220766", .mem =
                                  futhark_mc_segmap_parloop_struct_236777->free_mem_220766,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235134 = start;
    
    for (; iter_235134 < end; iter_235134++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235136 = n_203572;
        int64_t gtid_235113 = iter_235134;
        int64_t remnant_235137 = iter_235134 - gtid_235113;
        double x_235114;
        
        x_235114 = ((double *) mem_217415.mem)[gtid_215748 * n_203572 +
                                               gtid_235113];
        
        double x_235115;
        
        x_235115 = ((double *) ext_mem_220749.mem)[gtid_215748 * n_203572 +
                                                   gtid_235113];
        
        double x_235116;
        
        x_235116 = ((double *) ext_mem_220748.mem)[gtid_215748 * ext_220753 +
                                                   gtid_235113];
        
        double x_235117 = x_235114 - x_235115;
        double defunc_2_f_res_235118 = x_235117 - x_235116;
        bool isnan_res_235119;
        
        isnan_res_235119 = futrts_isnan64(defunc_2_f_res_235118);
        
        double defunc_0_f_res_235120;
        
        if (isnan_res_235119) {
            defunc_0_f_res_235120 = defunc_2_f_res_235118;
        } else {
            double abs_res_235135 = fabs(defunc_2_f_res_235118);
            
            defunc_0_f_res_235120 = abs_res_235135;
        }
        ((double *) mem_220766.mem)[gtid_235113] = defunc_0_f_res_235120;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236778_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236778_end -
                 futhark_mc_segmap_parloop_236778_start;
        
        ctx->futhark_mc_segmap_parloop_236778_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236778_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236778_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236776(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235112 = tid;
    int num_tasks_235133 = info.nsubtasks;
    struct futhark_mc_task_236775 *futhark_mc_task_236775 =
                                  (struct futhark_mc_task_236775 *) args;
    struct futhark_context *ctx = futhark_mc_task_236775->ctx;
    uint64_t futhark_mc_segmap_task_236776_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236776_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236775->free_n_203572;
    int64_t gtid_215748 = futhark_mc_task_236775->free_gtid_215748;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236775->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220748 = {.desc ="ext_mem_220748", .mem =
                                      futhark_mc_task_236775->free_ext_mem_220748,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220749 = {.desc ="ext_mem_220749", .mem =
                                      futhark_mc_task_236775->free_ext_mem_220749,
                                      .size =0, .references =NULL};
    int64_t ext_220753 = futhark_mc_task_236775->free_ext_220753;
    struct memblock mem_220766 = {.desc ="mem_220766", .mem =
                                  futhark_mc_task_236775->free_mem_220766,
                                  .size =0, .references =NULL};
    int64_t iter_235134;
    struct futhark_mc_segmap_parloop_struct_236777
    futhark_mc_segmap_parloop_struct_236777;
    
    futhark_mc_segmap_parloop_struct_236777.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236777.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236777.free_gtid_215748 = gtid_215748;
    futhark_mc_segmap_parloop_struct_236777.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236777.free_ext_mem_220748 =
        ext_mem_220748.mem;
    futhark_mc_segmap_parloop_struct_236777.free_ext_mem_220749 =
        ext_mem_220749.mem;
    futhark_mc_segmap_parloop_struct_236777.free_ext_220753 = ext_220753;
    futhark_mc_segmap_parloop_struct_236777.free_mem_220766 = mem_220766.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236778_task;
    
    futhark_mc_segmap_parloop_236778_task.name =
        "futhark_mc_segmap_parloop_236778";
    futhark_mc_segmap_parloop_236778_task.fn = futhark_mc_segmap_parloop_236778;
    futhark_mc_segmap_parloop_236778_task.args =
        &futhark_mc_segmap_parloop_struct_236777;
    futhark_mc_segmap_parloop_236778_task.iterations = iterations;
    futhark_mc_segmap_parloop_236778_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236778_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236778_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236778_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236778_task);
    
    if (futhark_mc_segmap_parloop_236778_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236778_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236778_total_end -
                 futhark_mc_segmap_parloop_236778_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236778_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236778_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236778_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236776_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236776_end -
                 futhark_mc_segmap_task_236776_start;
        
        ctx->futhark_mc_segmap_task_236776_runs[tid]++;
        ctx->futhark_mc_segmap_task_236776_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236776_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236779 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215748;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220766;
    unsigned char *free_mem_220769;
};
struct futhark_mc_segmap_parloop_struct_236781 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215748;
    unsigned char *free_mem_217458;
    unsigned char *free_mem_220766;
    unsigned char *free_mem_220769;
};
static int futhark_mc_segmap_parloop_236782(void *args, int64_t start,
                                            int64_t end, int flat_tid_235122,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236781
    *futhark_mc_segmap_parloop_struct_236781 =
    (struct futhark_mc_segmap_parloop_struct_236781 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236781->ctx;
    uint64_t futhark_mc_segmap_parloop_236782_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236782_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236781->free_n_203572;
    int64_t gtid_215748 =
            futhark_mc_segmap_parloop_struct_236781->free_gtid_215748;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236781->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220766 = {.desc ="mem_220766", .mem =
                                  futhark_mc_segmap_parloop_struct_236781->free_mem_220766,
                                  .size =0, .references =NULL};
    struct memblock mem_220769 = {.desc ="mem_220769", .mem =
                                  futhark_mc_segmap_parloop_struct_236781->free_mem_220769,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235139 = start;
    
    for (; iter_235139 < end; iter_235139++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235144 = n_203572;
        int64_t gtid_235123 = iter_235139;
        int64_t remnant_235145 = iter_235139 - gtid_235123;
        int64_t x_235124;
        
        x_235124 = ((int64_t *) mem_217458.mem)[gtid_215748 * n_203572 +
                                                gtid_235123];
        
        bool cond_235125 = sle64((int64_t) 0, x_235124);
        double defunc_0_f_res_235126;
        
        if (cond_235125) {
            bool y_235140 = slt64(x_235124, n_203572);
            bool bounds_check_235141 = cond_235125 && y_235140;
            bool index_certs_235142;
            
            if (!bounds_check_235141) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) x_235124,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_235143;
            
            defunc_0_f_res_t_res_235143 = ((double *) mem_220766.mem)[x_235124];
            defunc_0_f_res_235126 = defunc_0_f_res_t_res_235143;
        } else {
            defunc_0_f_res_235126 = INFINITY;
        }
        ((double *) mem_220769.mem)[gtid_235123] = defunc_0_f_res_235126;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236782_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236782_end -
                 futhark_mc_segmap_parloop_236782_start;
        
        ctx->futhark_mc_segmap_parloop_236782_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236782_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236782_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236780(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235122 = tid;
    int num_tasks_235138 = info.nsubtasks;
    struct futhark_mc_task_236779 *futhark_mc_task_236779 =
                                  (struct futhark_mc_task_236779 *) args;
    struct futhark_context *ctx = futhark_mc_task_236779->ctx;
    uint64_t futhark_mc_segmap_task_236780_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236780_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236779->free_n_203572;
    int64_t gtid_215748 = futhark_mc_task_236779->free_gtid_215748;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236779->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock mem_220766 = {.desc ="mem_220766", .mem =
                                  futhark_mc_task_236779->free_mem_220766,
                                  .size =0, .references =NULL};
    struct memblock mem_220769 = {.desc ="mem_220769", .mem =
                                  futhark_mc_task_236779->free_mem_220769,
                                  .size =0, .references =NULL};
    int64_t iter_235139;
    struct futhark_mc_segmap_parloop_struct_236781
    futhark_mc_segmap_parloop_struct_236781;
    
    futhark_mc_segmap_parloop_struct_236781.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236781.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236781.free_gtid_215748 = gtid_215748;
    futhark_mc_segmap_parloop_struct_236781.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236781.free_mem_220766 = mem_220766.mem;
    futhark_mc_segmap_parloop_struct_236781.free_mem_220769 = mem_220769.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236782_task;
    
    futhark_mc_segmap_parloop_236782_task.name =
        "futhark_mc_segmap_parloop_236782";
    futhark_mc_segmap_parloop_236782_task.fn = futhark_mc_segmap_parloop_236782;
    futhark_mc_segmap_parloop_236782_task.args =
        &futhark_mc_segmap_parloop_struct_236781;
    futhark_mc_segmap_parloop_236782_task.iterations = iterations;
    futhark_mc_segmap_parloop_236782_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236782_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236782_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236782_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236782_task);
    
    if (futhark_mc_segmap_parloop_236782_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236782_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236782_total_end -
                 futhark_mc_segmap_parloop_236782_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236782_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236782_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236782_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236780_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236780_end -
                 futhark_mc_segmap_task_236780_start;
        
        ctx->futhark_mc_segmap_task_236780_runs[tid]++;
        ctx->futhark_mc_segmap_task_236780_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236780_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236772(void *args, int64_t start,
                                            int64_t end, int flat_tid_215747,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236771
    *futhark_mc_segmap_parloop_struct_236771 =
    (struct futhark_mc_segmap_parloop_struct_236771 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236771->ctx;
    uint64_t futhark_mc_segmap_parloop_236772_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236772_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236771->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236771->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236771->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236771->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_segmap_parloop_struct_236771->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220748 = {.desc ="ext_mem_220748", .mem =
                                      futhark_mc_segmap_parloop_struct_236771->free_ext_mem_220748,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220749 = {.desc ="ext_mem_220749", .mem =
                                      futhark_mc_segmap_parloop_struct_236771->free_ext_mem_220749,
                                      .size =0, .references =NULL};
    int64_t ext_220753 =
            futhark_mc_segmap_parloop_struct_236771->free_ext_220753;
    struct memblock mem_220803 = {.desc ="mem_220803", .mem =
                                  futhark_mc_segmap_parloop_struct_236771->free_mem_220803,
                                  .size =0, .references =NULL};
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_segmap_parloop_struct_236771->free_mem_220807,
                                  .size =0, .references =NULL};
    size_t mem_220766_cached_sizze_236773 = 0;
    unsigned char *mem_220766 = NULL;
    size_t mem_220769_cached_sizze_236774 = 0;
    unsigned char *mem_220769 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235111 = start;
    
    if (mem_220766_cached_sizze_236773 < (size_t) bytes_217420) {
        mem_220766 = realloc(mem_220766, bytes_217420);
        mem_220766_cached_sizze_236773 = bytes_217420;
    }
    if (mem_220769_cached_sizze_236774 < (size_t) bytes_217420) {
        mem_220769 = realloc(mem_220769, bytes_217420);
        mem_220769_cached_sizze_236774 = bytes_217420;
    }
    for (; iter_235111 < end; iter_235111++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235131 = partition_sizze_203667;
        int64_t gtid_215748 = iter_235111;
        int64_t remnant_235132 = iter_235111 - gtid_215748;
        int64_t flat_tid_235112 = (int64_t) 0;
        int32_t num_tasks_235133;
        struct futhark_mc_task_236775 futhark_mc_task_236775;
        
        futhark_mc_task_236775.ctx = ctx;
        futhark_mc_task_236775.free_n_203572 = n_203572;
        futhark_mc_task_236775.free_gtid_215748 = gtid_215748;
        futhark_mc_task_236775.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_236775.free_ext_mem_220748 = ext_mem_220748.mem;
        futhark_mc_task_236775.free_ext_mem_220749 = ext_mem_220749.mem;
        futhark_mc_task_236775.free_ext_220753 = ext_220753;
        futhark_mc_task_236775.free_mem_220766 = mem_220766;
        
        struct scheduler_segop futhark_mc_task_236775_task;
        
        futhark_mc_task_236775_task.args = &futhark_mc_task_236775;
        futhark_mc_task_236775_task.top_level_fn =
            futhark_mc_segmap_task_236776;
        futhark_mc_task_236775_task.name = "futhark_mc_segmap_task_236776";
        futhark_mc_task_236775_task.iterations = n_203572;
        futhark_mc_task_236775_task.task_time =
            &ctx->futhark_mc_segmap_task_236776_total_time;
        futhark_mc_task_236775_task.task_iter =
            &ctx->futhark_mc_segmap_task_236776_total_iter;
        futhark_mc_task_236775_task.sched = STATIC;
        futhark_mc_task_236775_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236776_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236775_task);
        
        if (futhark_mc_segmap_task_236776_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_235122 = (int64_t) 0;
        int32_t num_tasks_235138;
        struct futhark_mc_task_236779 futhark_mc_task_236779;
        
        futhark_mc_task_236779.ctx = ctx;
        futhark_mc_task_236779.free_n_203572 = n_203572;
        futhark_mc_task_236779.free_gtid_215748 = gtid_215748;
        futhark_mc_task_236779.free_mem_217458 = mem_217458.mem;
        futhark_mc_task_236779.free_mem_220766 = mem_220766;
        futhark_mc_task_236779.free_mem_220769 = mem_220769;
        
        struct scheduler_segop futhark_mc_task_236779_task;
        
        futhark_mc_task_236779_task.args = &futhark_mc_task_236779;
        futhark_mc_task_236779_task.top_level_fn =
            futhark_mc_segmap_task_236780;
        futhark_mc_task_236779_task.name = "futhark_mc_segmap_task_236780";
        futhark_mc_task_236779_task.iterations = n_203572;
        futhark_mc_task_236779_task.task_time =
            &ctx->futhark_mc_segmap_task_236780_total_time;
        futhark_mc_task_236779_task.task_iter =
            &ctx->futhark_mc_segmap_task_236780_total_iter;
        futhark_mc_task_236779_task.sched = STATIC;
        futhark_mc_task_236779_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236780_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236779_task);
        
        if (futhark_mc_segmap_task_236780_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220803.mem + gtid_215748 * n_203572 * (int64_t) 8,
                    mem_220769 + (int64_t) 0, n_203572 * (int64_t) 8);
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220807.mem + gtid_215748 * n_203572 * (int64_t) 8,
                    mem_220766 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220766);
    free(mem_220769);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236772_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236772_end -
                 futhark_mc_segmap_parloop_236772_start;
        
        ctx->futhark_mc_segmap_parloop_236772_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236772_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236772_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236770(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215747 = tid;
    int num_tasks_235084 = info.nsubtasks;
    struct futhark_mc_task_236764 *futhark_mc_task_236764 =
                                  (struct futhark_mc_task_236764 *) args;
    struct futhark_context *ctx = futhark_mc_task_236764->ctx;
    uint64_t futhark_mc_segmap_nested_task_236770_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236770_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236764->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236764->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236764->free_mem_217415,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236764->free_bytes_217420;
    struct memblock mem_217458 = {.desc ="mem_217458", .mem =
                                  futhark_mc_task_236764->free_mem_217458,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220748 = {.desc ="ext_mem_220748", .mem =
                                      futhark_mc_task_236764->free_ext_mem_220748,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220749 = {.desc ="ext_mem_220749", .mem =
                                      futhark_mc_task_236764->free_ext_mem_220749,
                                      .size =0, .references =NULL};
    int64_t ext_220753 = futhark_mc_task_236764->free_ext_220753;
    struct memblock mem_220803 = {.desc ="mem_220803", .mem =
                                  futhark_mc_task_236764->free_mem_220803,
                                  .size =0, .references =NULL};
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_task_236764->free_mem_220807,
                                  .size =0, .references =NULL};
    int64_t iter_235111;
    struct futhark_mc_segmap_parloop_struct_236771
    futhark_mc_segmap_parloop_struct_236771;
    
    futhark_mc_segmap_parloop_struct_236771.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236771.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236771.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236771.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236771.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236771.free_mem_217458 = mem_217458.mem;
    futhark_mc_segmap_parloop_struct_236771.free_ext_mem_220748 =
        ext_mem_220748.mem;
    futhark_mc_segmap_parloop_struct_236771.free_ext_mem_220749 =
        ext_mem_220749.mem;
    futhark_mc_segmap_parloop_struct_236771.free_ext_220753 = ext_220753;
    futhark_mc_segmap_parloop_struct_236771.free_mem_220803 = mem_220803.mem;
    futhark_mc_segmap_parloop_struct_236771.free_mem_220807 = mem_220807.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236772_task;
    
    futhark_mc_segmap_parloop_236772_task.name =
        "futhark_mc_segmap_parloop_236772";
    futhark_mc_segmap_parloop_236772_task.fn = futhark_mc_segmap_parloop_236772;
    futhark_mc_segmap_parloop_236772_task.args =
        &futhark_mc_segmap_parloop_struct_236771;
    futhark_mc_segmap_parloop_236772_task.iterations = iterations;
    futhark_mc_segmap_parloop_236772_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236772_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236772_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236772_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236772_task);
    
    if (futhark_mc_segmap_parloop_236772_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236772_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236772_total_end -
                 futhark_mc_segmap_parloop_236772_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236772_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236772_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236772_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236770_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236770_end -
                 futhark_mc_segmap_nested_task_236770_start;
        
        ctx->futhark_mc_segmap_nested_task_236770_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236770_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236770_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236783 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_i_203760;
    int32_t free_iters_206755;
    int64_t free_bytes_217420;
    unsigned char *free_mem_220803;
    int64_t free_bytes_220832;
    unsigned char *free_mem_220953;
    int64_t free_num_bytes_221138;
    int64_t free_num_bytes_221143;
};
struct futhark_mc_segmap_parloop_struct_236785 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_i_203760;
    int32_t free_iters_206755;
    int64_t free_bytes_217420;
    unsigned char *free_mem_220803;
    int64_t free_bytes_220832;
    unsigned char *free_mem_220953;
    int64_t free_num_bytes_221143;
};
static int futhark_mc_segmap_parloop_236786(void *args, int64_t start,
                                            int64_t end, int flat_tid_215774,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236785
    *futhark_mc_segmap_parloop_struct_236785 =
    (struct futhark_mc_segmap_parloop_struct_236785 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236785->ctx;
    uint64_t futhark_mc_segmap_parloop_236786_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236786_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236785->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236785->free_partition_sizze_203667;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236785->free_i_203760;
    int32_t iters_206755 =
            futhark_mc_segmap_parloop_struct_236785->free_iters_206755;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236785->free_bytes_217420;
    struct memblock mem_220803 = {.desc ="mem_220803", .mem =
                                  futhark_mc_segmap_parloop_struct_236785->free_mem_220803,
                                  .size =0, .references =NULL};
    int64_t bytes_220832 =
            futhark_mc_segmap_parloop_struct_236785->free_bytes_220832;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_segmap_parloop_struct_236785->free_mem_220953,
                                  .size =0, .references =NULL};
    int64_t num_bytes_221143 =
            futhark_mc_segmap_parloop_struct_236785->free_num_bytes_221143;
    size_t mem_220857_cached_sizze_236787 = 0;
    unsigned char *mem_220857 = NULL;
    size_t mem_220860_cached_sizze_236788 = 0;
    unsigned char *mem_220860 = NULL;
    size_t mem_220863_cached_sizze_236789 = 0;
    unsigned char *mem_220863 = NULL;
    size_t mem_220866_cached_sizze_236790 = 0;
    unsigned char *mem_220866 = NULL;
    size_t mem_220869_cached_sizze_236791 = 0;
    unsigned char *mem_220869 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235147 = start;
    
    if (mem_220857_cached_sizze_236787 < (size_t) bytes_217420) {
        mem_220857 = realloc(mem_220857, bytes_217420);
        mem_220857_cached_sizze_236787 = bytes_217420;
    }
    if (mem_220860_cached_sizze_236788 < (size_t) bytes_217420) {
        mem_220860 = realloc(mem_220860, bytes_217420);
        mem_220860_cached_sizze_236788 = bytes_217420;
    }
    if (mem_220863_cached_sizze_236789 < (size_t) bytes_217420) {
        mem_220863 = realloc(mem_220863, bytes_217420);
        mem_220863_cached_sizze_236789 = bytes_217420;
    }
    if (mem_220866_cached_sizze_236790 < (size_t) bytes_217420) {
        mem_220866 = realloc(mem_220866, bytes_217420);
        mem_220866_cached_sizze_236790 = bytes_217420;
    }
    if (mem_220869_cached_sizze_236791 < (size_t) bytes_220832) {
        mem_220869 = realloc(mem_220869, bytes_220832);
        mem_220869_cached_sizze_236791 = bytes_220832;
    }
    
    struct memblock mem_in_221144;
    
    mem_in_221144.references = NULL;
    if (memblock_alloc(ctx, &mem_in_221144, num_bytes_221143,
                       "mem_in_221144")) {
        err = 1;
        goto cleanup;
    }
    
    struct memblock mem_220932;
    
    mem_220932.references = NULL;
    if (memblock_alloc(ctx, &mem_220932, bytes_217420, "mem_220932")) {
        err = 1;
        goto cleanup;
    }
    
    struct memblock ext_mem_220945;
    
    ext_mem_220945.references = NULL;
    
    struct memblock ext_mem_unused_221145;
    
    ext_mem_unused_221145.references = NULL;
    
    struct memblock mem_param_235149;
    
    mem_param_235149.references = NULL;
    
    struct memblock mem_param_out_235150;
    
    mem_param_out_235150.references = NULL;
    for (; iter_235147 < end; iter_235147++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235257 = partition_sizze_203667;
        int64_t gtid_215775 = iter_235147;
        int64_t remnant_235258 = iter_235147 - gtid_215775;
        
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_in_221144.mem + (int64_t) 0, mem_220803.mem +
                    gtid_215775 * n_203572 * (int64_t) 8, n_203572 *
                    (int64_t) 8);
        if (memblock_set(ctx, &mem_param_235149, &mem_in_221144,
                         "mem_in_221144") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_out_235150, &mem_220932,
                         "mem_220932") != 0)
            return 1;
        for (int32_t i_235148 = 0; i_235148 < iters_206755; i_235148++) {
            int32_t defunc_2_radix_sort_step_arg_235152 = mul32(2, i_235148);
            int32_t defunc_0_get_bit_arg_235153 = add32(1,
                                                        defunc_2_radix_sort_step_arg_235152);
            bool cond_f_res_235154 = defunc_0_get_bit_arg_235153 == 63;
            bool cond_f_res_235155 = defunc_2_radix_sort_step_arg_235152 == 63;
            int64_t unsign_arg_235156 =
                    zext_i32_i64(defunc_0_get_bit_arg_235153);
            int64_t unsign_arg_235157 =
                    zext_i32_i64(defunc_2_radix_sort_step_arg_235152);
            int64_t discard_235163;
            int64_t discard_235164;
            int64_t discard_235165;
            int64_t discard_235166;
            int64_t scanacc_235173;
            int64_t scanacc_235174;
            int64_t scanacc_235175;
            int64_t scanacc_235176;
            
            scanacc_235173 = (int64_t) 0;
            scanacc_235174 = (int64_t) 0;
            scanacc_235175 = (int64_t) 0;
            scanacc_235176 = (int64_t) 0;
            for (int64_t i_235172 = 0; i_235172 < n_203572; i_235172++) {
                double x_235182;
                
                x_235182 = ((double *) mem_param_235149.mem)[i_235172];
                
                int64_t i64_arg_235183;
                
                i64_arg_235183 = futrts_to_bits64(x_235182);
                
                int64_t unsign_arg_235184 = ashr64(i64_arg_235183,
                                                   unsign_arg_235156);
                int64_t unsign_arg_235185 = (int64_t) 1 & unsign_arg_235184;
                int32_t to_i32_res_235186 = zext_i64_i32(unsign_arg_235185);
                int64_t unsign_arg_235187 = ashr64(i64_arg_235183,
                                                   (int64_t) 63);
                int64_t unsign_arg_235188 = (int64_t) 1 & unsign_arg_235187;
                int32_t to_i32_res_235189 = zext_i64_i32(unsign_arg_235188);
                bool cond_235190 = to_i32_res_235189 == 1;
                bool x_235191 = !cond_235190;
                bool y_235192 = cond_f_res_235154 && x_235191;
                bool cond_235193 = cond_235190 || y_235192;
                int32_t defunc_1_get_bit_res_235194;
                
                if (cond_235193) {
                    int32_t defunc_1_get_bit_res_t_res_235195 = 1 ^
                            to_i32_res_235186;
                    
                    defunc_1_get_bit_res_235194 =
                        defunc_1_get_bit_res_t_res_235195;
                } else {
                    defunc_1_get_bit_res_235194 = to_i32_res_235186;
                }
                
                int32_t x_235196 = mul32(2, defunc_1_get_bit_res_235194);
                int64_t unsign_arg_235197 = ashr64(i64_arg_235183,
                                                   unsign_arg_235157);
                int64_t unsign_arg_235198 = (int64_t) 1 & unsign_arg_235197;
                int32_t to_i32_res_235199 = zext_i64_i32(unsign_arg_235198);
                bool y_235200 = cond_f_res_235155 && x_235191;
                bool cond_235201 = cond_235190 || y_235200;
                int32_t defunc_1_get_bit_res_235202;
                
                if (cond_235201) {
                    int32_t defunc_1_get_bit_res_t_res_235203 = 1 ^
                            to_i32_res_235199;
                    
                    defunc_1_get_bit_res_235202 =
                        defunc_1_get_bit_res_t_res_235203;
                } else {
                    defunc_1_get_bit_res_235202 = to_i32_res_235199;
                }
                
                int32_t defunc_0_f_res_235204 = add32(x_235196,
                                                      defunc_1_get_bit_res_235202);
                bool cond_235205 = defunc_0_f_res_235204 == 0;
                int64_t defunc_0_f_res_235206 = btoi_bool_i64(cond_235205);
                int64_t defunc_0_f_res_235207;
                int64_t defunc_0_f_res_235208;
                int64_t defunc_0_f_res_235209;
                
                if (cond_235205) {
                    defunc_0_f_res_235207 = (int64_t) 0;
                    defunc_0_f_res_235208 = (int64_t) 0;
                    defunc_0_f_res_235209 = (int64_t) 0;
                } else {
                    bool cond_235210 = defunc_0_f_res_235204 == 1;
                    int64_t defunc_0_f_res_f_res_235211 =
                            btoi_bool_i64(cond_235210);
                    int64_t defunc_0_f_res_f_res_235212;
                    int64_t defunc_0_f_res_f_res_235213;
                    
                    if (cond_235210) {
                        defunc_0_f_res_f_res_235212 = (int64_t) 0;
                        defunc_0_f_res_f_res_235213 = (int64_t) 0;
                    } else {
                        bool cond_235214 = defunc_0_f_res_235204 == 2;
                        int64_t defunc_0_f_res_f_res_f_res_235215 =
                                btoi_bool_i64(cond_235214);
                        bool cond_neg_235216 = !cond_235214;
                        int64_t defunc_0_f_res_f_res_f_res_235217 =
                                btoi_bool_i64(cond_neg_235216);
                        
                        defunc_0_f_res_f_res_235212 =
                            defunc_0_f_res_f_res_f_res_235215;
                        defunc_0_f_res_f_res_235213 =
                            defunc_0_f_res_f_res_f_res_235217;
                    }
                    defunc_0_f_res_235207 = defunc_0_f_res_f_res_235211;
                    defunc_0_f_res_235208 = defunc_0_f_res_f_res_235212;
                    defunc_0_f_res_235209 = defunc_0_f_res_f_res_235213;
                }
                
                int64_t defunc_1_op_res_235218 = add64(defunc_0_f_res_235206,
                                                       scanacc_235173);
                int64_t defunc_1_op_res_235219 = add64(defunc_0_f_res_235207,
                                                       scanacc_235174);
                int64_t defunc_1_op_res_235220 = add64(defunc_0_f_res_235208,
                                                       scanacc_235175);
                int64_t defunc_1_op_res_235221 = add64(defunc_0_f_res_235209,
                                                       scanacc_235176);
                
                ((int64_t *) mem_220857)[i_235172] = defunc_1_op_res_235218;
                ((int64_t *) mem_220860)[i_235172] = defunc_1_op_res_235219;
                ((int64_t *) mem_220863)[i_235172] = defunc_1_op_res_235220;
                ((int64_t *) mem_220866)[i_235172] = defunc_1_op_res_235221;
                ((int32_t *) mem_220869)[i_235172] = defunc_0_f_res_235204;
                
                int64_t scanacc_tmp_235262 = defunc_1_op_res_235218;
                int64_t scanacc_tmp_235263 = defunc_1_op_res_235219;
                int64_t scanacc_tmp_235264 = defunc_1_op_res_235220;
                int64_t scanacc_tmp_235265 = defunc_1_op_res_235221;
                
                scanacc_235173 = scanacc_tmp_235262;
                scanacc_235174 = scanacc_tmp_235263;
                scanacc_235175 = scanacc_tmp_235264;
                scanacc_235176 = scanacc_tmp_235265;
            }
            discard_235163 = scanacc_235173;
            discard_235164 = scanacc_235174;
            discard_235165 = scanacc_235175;
            discard_235166 = scanacc_235176;
            
            int64_t last_res_235227;
            
            last_res_235227 = ((int64_t *) mem_220857)[i_203760];
            
            int64_t last_res_235228;
            
            last_res_235228 = ((int64_t *) mem_220860)[i_203760];
            
            int64_t last_res_235229;
            
            last_res_235229 = ((int64_t *) mem_220863)[i_203760];
            if (n_203572 * (int64_t) 8 > 0)
                memmove(mem_param_out_235150.mem + (int64_t) 0,
                        mem_param_235149.mem + (int64_t) 0, n_203572 *
                        (int64_t) 8);
            for (int64_t write_iter_235232 = 0; write_iter_235232 < n_203572;
                 write_iter_235232++) {
                int32_t write_iv_235234;
                
                write_iv_235234 = ((int32_t *) mem_220869)[write_iter_235232];
                
                bool match_lit_235235 = 0 == write_iv_235234;
                int64_t defunc_1_f_res_235236;
                
                if (match_lit_235235) {
                    int64_t write_iv_235237;
                    
                    write_iv_235237 =
                        ((int64_t *) mem_220857)[write_iter_235232];
                    
                    int64_t case_res_235238 = sub64(write_iv_235237,
                                                    (int64_t) 1);
                    
                    defunc_1_f_res_235236 = case_res_235238;
                } else {
                    bool match_lit_235239 = 1 == write_iv_235234;
                    int64_t x_235240;
                    
                    if (match_lit_235239) {
                        int64_t write_iv_235241;
                        
                        write_iv_235241 =
                            ((int64_t *) mem_220860)[write_iter_235232];
                        
                        int64_t x_235242 = add64(last_res_235227,
                                                 write_iv_235241);
                        int64_t case_res_235243 = sub64(x_235242, (int64_t) 1);
                        
                        x_235240 = case_res_235243;
                    } else {
                        bool match_lit_235244 = 2 == write_iv_235234;
                        int64_t x_235245;
                        
                        if (match_lit_235244) {
                            int64_t write_iv_235246;
                            
                            write_iv_235246 =
                                ((int64_t *) mem_220863)[write_iter_235232];
                            
                            int64_t x_235247 = add64(last_res_235227,
                                                     last_res_235228);
                            int64_t x_235248 = add64(x_235247, write_iv_235246);
                            int64_t case_res_235249 = sub64(x_235248,
                                                            (int64_t) 1);
                            
                            x_235245 = case_res_235249;
                        } else {
                            int64_t write_iv_235250;
                            
                            write_iv_235250 =
                                ((int64_t *) mem_220866)[write_iter_235232];
                            
                            int64_t x_235251 = add64(last_res_235227,
                                                     last_res_235228);
                            int64_t x_235252 = add64(last_res_235229, x_235251);
                            int64_t x_235253 = add64(x_235252, write_iv_235250);
                            int64_t defunc_1_f_res_res_235254 = sub64(x_235253,
                                                                      (int64_t) 1);
                            
                            x_235245 = defunc_1_f_res_res_235254;
                        }
                        x_235240 = x_235245;
                    }
                    defunc_1_f_res_235236 = x_235240;
                }
                if (sle64((int64_t) 0, defunc_1_f_res_235236) &&
                    slt64(defunc_1_f_res_235236, n_203572)) {
                    if ((int64_t) 8 > 0)
                        memmove(mem_param_out_235150.mem +
                                defunc_1_f_res_235236 * (int64_t) 8,
                                mem_param_235149.mem + write_iter_235232 *
                                (int64_t) 8, (int64_t) 8);
                }
            }
            
            struct memblock mem_param_tmp_235259;
            
            mem_param_tmp_235259.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_235259, &mem_param_out_235150,
                             "mem_param_out_235150") != 0)
                return 1;
            
            struct memblock mem_param_out_tmp_235260;
            
            mem_param_out_tmp_235260.references = NULL;
            if (memblock_set(ctx, &mem_param_out_tmp_235260, &mem_param_235149,
                             "mem_param_235149") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_235149, &mem_param_tmp_235259,
                             "mem_param_tmp_235259") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_out_235150,
                             &mem_param_out_tmp_235260,
                             "mem_param_out_tmp_235260") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_out_tmp_235260,
                               "mem_param_out_tmp_235260") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_235259,
                               "mem_param_tmp_235259") != 0)
                return 1;
        }
        if (memblock_set(ctx, &ext_mem_220945, &mem_param_235149,
                         "mem_param_235149") != 0)
            return 1;
        if (memblock_set(ctx, &ext_mem_unused_221145, &mem_param_out_235150,
                         "mem_param_out_235150") != 0)
            return 1;
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220953.mem + gtid_215775 * n_203572 * (int64_t) 8,
                    ext_mem_220945.mem + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220857);
    free(mem_220860);
    free(mem_220863);
    free(mem_220866);
    free(mem_220869);
    if (memblock_unref(ctx, &mem_param_out_235150, "mem_param_out_235150") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_235149, "mem_param_235149") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_unused_221145, "ext_mem_unused_221145") !=
        0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220945, "ext_mem_220945") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_220932, "mem_220932") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_in_221144, "mem_in_221144") != 0)
        return 1;
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236786_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236786_end -
                 futhark_mc_segmap_parloop_236786_start;
        
        ctx->futhark_mc_segmap_parloop_236786_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236786_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236786_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236784(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215774 = tid;
    int num_tasks_235146 = info.nsubtasks;
    struct futhark_mc_task_236783 *futhark_mc_task_236783 =
                                  (struct futhark_mc_task_236783 *) args;
    struct futhark_context *ctx = futhark_mc_task_236783->ctx;
    uint64_t futhark_mc_segmap_task_236784_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236784_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236783->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236783->free_partition_sizze_203667;
    int64_t i_203760 = futhark_mc_task_236783->free_i_203760;
    int32_t iters_206755 = futhark_mc_task_236783->free_iters_206755;
    int64_t bytes_217420 = futhark_mc_task_236783->free_bytes_217420;
    struct memblock mem_220803 = {.desc ="mem_220803", .mem =
                                  futhark_mc_task_236783->free_mem_220803,
                                  .size =0, .references =NULL};
    int64_t bytes_220832 = futhark_mc_task_236783->free_bytes_220832;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_task_236783->free_mem_220953,
                                  .size =0, .references =NULL};
    int64_t num_bytes_221138 = futhark_mc_task_236783->free_num_bytes_221138;
    int64_t num_bytes_221143 = futhark_mc_task_236783->free_num_bytes_221143;
    int64_t iter_235147;
    struct futhark_mc_segmap_parloop_struct_236785
    futhark_mc_segmap_parloop_struct_236785;
    
    futhark_mc_segmap_parloop_struct_236785.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236785.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236785.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236785.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236785.free_iters_206755 = iters_206755;
    futhark_mc_segmap_parloop_struct_236785.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236785.free_mem_220803 = mem_220803.mem;
    futhark_mc_segmap_parloop_struct_236785.free_bytes_220832 = bytes_220832;
    futhark_mc_segmap_parloop_struct_236785.free_mem_220953 = mem_220953.mem;
    futhark_mc_segmap_parloop_struct_236785.free_num_bytes_221143 =
        num_bytes_221143;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236786_task;
    
    futhark_mc_segmap_parloop_236786_task.name =
        "futhark_mc_segmap_parloop_236786";
    futhark_mc_segmap_parloop_236786_task.fn = futhark_mc_segmap_parloop_236786;
    futhark_mc_segmap_parloop_236786_task.args =
        &futhark_mc_segmap_parloop_struct_236785;
    futhark_mc_segmap_parloop_236786_task.iterations = iterations;
    futhark_mc_segmap_parloop_236786_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236786_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236786_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236786_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236786_task);
    
    if (futhark_mc_segmap_parloop_236786_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236786_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236786_total_end -
                 futhark_mc_segmap_parloop_236786_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236786_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236786_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236786_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236784_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236784_end -
                 futhark_mc_segmap_task_236784_start;
        
        ctx->futhark_mc_segmap_task_236784_runs[tid]++;
        ctx->futhark_mc_segmap_task_236784_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236784_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236793 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_i_203760;
    int32_t free_iters_206755;
    int64_t free_bytes_217420;
    unsigned char *free_mem_220803;
    int64_t free_bytes_220832;
    unsigned char *free_mem_220953;
    int64_t free_num_bytes_221138;
};
struct futhark_mc_task_236800 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    unsigned char *free_mem_220821;
    unsigned char *free_mem_220824;
    unsigned char *free_mem_220827;
    unsigned char *free_mem_220830;
    unsigned char *free_mem_220833;
    unsigned char *free_mem_param_235274;
    bool free_cond_f_res_235279;
    bool free_cond_f_res_235280;
    int64_t free_unsign_arg_235281;
    int64_t free_unsign_arg_235282;
};
struct futhark_mc_scan_stage_1_parloop_struct_236806 {
    struct futhark_context *ctx;
    unsigned char *free_mem_220821;
    unsigned char *free_mem_220824;
    unsigned char *free_mem_220827;
    unsigned char *free_mem_220830;
    unsigned char *free_mem_220833;
    unsigned char *free_mem_param_235274;
    bool free_cond_f_res_235279;
    bool free_cond_f_res_235280;
    int64_t free_unsign_arg_235281;
    int64_t free_unsign_arg_235282;
};
static int futhark_mc_scan_stage_1_parloop_236807(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_235288, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_236806
    *futhark_mc_scan_stage_1_parloop_struct_236806 =
    (struct futhark_mc_scan_stage_1_parloop_struct_236806 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_236806->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_236807_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236807_start = get_wall_time();
    
    struct memblock mem_220821 = {.desc ="mem_220821", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236806->free_mem_220821,
                                  .size =0, .references =NULL};
    struct memblock mem_220824 = {.desc ="mem_220824", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236806->free_mem_220824,
                                  .size =0, .references =NULL};
    struct memblock mem_220827 = {.desc ="mem_220827", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236806->free_mem_220827,
                                  .size =0, .references =NULL};
    struct memblock mem_220830 = {.desc ="mem_220830", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236806->free_mem_220830,
                                  .size =0, .references =NULL};
    struct memblock mem_220833 = {.desc ="mem_220833", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_236806->free_mem_220833,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235274 = {.desc ="mem_param_235274", .mem =
                                        futhark_mc_scan_stage_1_parloop_struct_236806->free_mem_param_235274,
                                        .size =0, .references =NULL};
    bool cond_f_res_235279 =
         futhark_mc_scan_stage_1_parloop_struct_236806->free_cond_f_res_235279;
    bool cond_f_res_235280 =
         futhark_mc_scan_stage_1_parloop_struct_236806->free_cond_f_res_235280;
    int64_t unsign_arg_235281 =
            futhark_mc_scan_stage_1_parloop_struct_236806->free_unsign_arg_235281;
    int64_t unsign_arg_235282 =
            futhark_mc_scan_stage_1_parloop_struct_236806->free_unsign_arg_235282;
    int64_t iterations = end - start;
    int64_t iter_235373 = start;
    int64_t x_235290;
    int64_t x_235291;
    int64_t x_235292;
    int64_t x_235293;
    int64_t x_235294;
    int64_t x_235295;
    int64_t x_235296;
    int64_t x_235297;
    
    x_235290 = (int64_t) 0;
    x_235291 = (int64_t) 0;
    x_235292 = (int64_t) 0;
    x_235293 = (int64_t) 0;
    for (; iter_235373 < end; iter_235373++) {
        int64_t gtid_235289 = iter_235373;
        
        // stage 1 scan body
        {
            double x_235302;
            
            x_235302 = ((double *) mem_param_235274.mem)[gtid_235289];
            
            int64_t i64_arg_235303;
            
            i64_arg_235303 = futrts_to_bits64(x_235302);
            
            int64_t unsign_arg_235304 = ashr64(i64_arg_235303,
                                               unsign_arg_235281);
            int64_t unsign_arg_235305 = (int64_t) 1 & unsign_arg_235304;
            int32_t to_i32_res_235306 = zext_i64_i32(unsign_arg_235305);
            int64_t unsign_arg_235307 = ashr64(i64_arg_235303, (int64_t) 63);
            int64_t unsign_arg_235308 = (int64_t) 1 & unsign_arg_235307;
            int32_t to_i32_res_235309 = zext_i64_i32(unsign_arg_235308);
            bool cond_235310 = to_i32_res_235309 == 1;
            bool x_235311 = !cond_235310;
            bool y_235312 = cond_f_res_235279 && x_235311;
            bool cond_235313 = cond_235310 || y_235312;
            int32_t defunc_1_get_bit_res_235314;
            
            if (cond_235313) {
                int32_t defunc_1_get_bit_res_t_res_235315 = 1 ^
                        to_i32_res_235306;
                
                defunc_1_get_bit_res_235314 = defunc_1_get_bit_res_t_res_235315;
            } else {
                defunc_1_get_bit_res_235314 = to_i32_res_235306;
            }
            
            int32_t x_235316 = mul32(2, defunc_1_get_bit_res_235314);
            int64_t unsign_arg_235317 = ashr64(i64_arg_235303,
                                               unsign_arg_235282);
            int64_t unsign_arg_235318 = (int64_t) 1 & unsign_arg_235317;
            int32_t to_i32_res_235319 = zext_i64_i32(unsign_arg_235318);
            bool y_235320 = cond_f_res_235280 && x_235311;
            bool cond_235321 = cond_235310 || y_235320;
            int32_t defunc_1_get_bit_res_235322;
            
            if (cond_235321) {
                int32_t defunc_1_get_bit_res_t_res_235323 = 1 ^
                        to_i32_res_235319;
                
                defunc_1_get_bit_res_235322 = defunc_1_get_bit_res_t_res_235323;
            } else {
                defunc_1_get_bit_res_235322 = to_i32_res_235319;
            }
            
            int32_t defunc_0_f_res_235324 = add32(x_235316,
                                                  defunc_1_get_bit_res_235322);
            bool cond_235325 = defunc_0_f_res_235324 == 0;
            int64_t defunc_0_f_res_235326 = btoi_bool_i64(cond_235325);
            int64_t defunc_0_f_res_235327;
            int64_t defunc_0_f_res_235328;
            int64_t defunc_0_f_res_235329;
            
            if (cond_235325) {
                defunc_0_f_res_235327 = (int64_t) 0;
                defunc_0_f_res_235328 = (int64_t) 0;
                defunc_0_f_res_235329 = (int64_t) 0;
            } else {
                bool cond_235330 = defunc_0_f_res_235324 == 1;
                int64_t defunc_0_f_res_f_res_235331 =
                        btoi_bool_i64(cond_235330);
                int64_t defunc_0_f_res_f_res_235332;
                int64_t defunc_0_f_res_f_res_235333;
                
                if (cond_235330) {
                    defunc_0_f_res_f_res_235332 = (int64_t) 0;
                    defunc_0_f_res_f_res_235333 = (int64_t) 0;
                } else {
                    bool cond_235334 = defunc_0_f_res_235324 == 2;
                    int64_t defunc_0_f_res_f_res_f_res_235335 =
                            btoi_bool_i64(cond_235334);
                    bool cond_neg_235336 = !cond_235334;
                    int64_t defunc_0_f_res_f_res_f_res_235337 =
                            btoi_bool_i64(cond_neg_235336);
                    
                    defunc_0_f_res_f_res_235332 =
                        defunc_0_f_res_f_res_f_res_235335;
                    defunc_0_f_res_f_res_235333 =
                        defunc_0_f_res_f_res_f_res_235337;
                }
                defunc_0_f_res_235327 = defunc_0_f_res_f_res_235331;
                defunc_0_f_res_235328 = defunc_0_f_res_f_res_235332;
                defunc_0_f_res_235329 = defunc_0_f_res_f_res_235333;
            }
            // write mapped values results to memory
            {
                ((int32_t *) mem_220833.mem)[gtid_235289] =
                    defunc_0_f_res_235324;
            }
            x_235290 = x_235290;
            x_235291 = x_235291;
            x_235292 = x_235292;
            x_235293 = x_235293;
            // Read next values
            {
                x_235294 = defunc_0_f_res_235326;
                x_235295 = defunc_0_f_res_235327;
                x_235296 = defunc_0_f_res_235328;
                x_235297 = defunc_0_f_res_235329;
            }
            
            int64_t defunc_1_op_res_235298 = add64(x_235290, x_235294);
            int64_t defunc_1_op_res_235299 = add64(x_235291, x_235295);
            int64_t defunc_1_op_res_235300 = add64(x_235292, x_235296);
            int64_t defunc_1_op_res_235301 = add64(x_235293, x_235297);
            
            ((int64_t *) mem_220821.mem)[gtid_235289] = defunc_1_op_res_235298;
            x_235290 = defunc_1_op_res_235298;
            ((int64_t *) mem_220824.mem)[gtid_235289] = defunc_1_op_res_235299;
            x_235291 = defunc_1_op_res_235299;
            ((int64_t *) mem_220827.mem)[gtid_235289] = defunc_1_op_res_235300;
            x_235292 = defunc_1_op_res_235300;
            ((int64_t *) mem_220830.mem)[gtid_235289] = defunc_1_op_res_235301;
            x_235293 = defunc_1_op_res_235301;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236807_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236807_end -
                 futhark_mc_scan_stage_1_parloop_236807_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_236807_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_236807_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_236807_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_236808 {
    struct futhark_context *ctx;
    unsigned char *free_mem_220821;
    unsigned char *free_mem_220824;
    unsigned char *free_mem_220827;
    unsigned char *free_mem_220830;
    unsigned char *free_mem_param_235274;
    bool free_cond_f_res_235279;
    bool free_cond_f_res_235280;
    int64_t free_unsign_arg_235281;
    int64_t free_unsign_arg_235282;
};
static int futhark_mc_scan_stage_3_parloop_236809(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_235288, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_236808
    *futhark_mc_scan_stage_3_parloop_struct_236808 =
    (struct futhark_mc_scan_stage_3_parloop_struct_236808 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_236808->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_236809_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_236809_start = get_wall_time();
    
    struct memblock mem_220821 = {.desc ="mem_220821", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236808->free_mem_220821,
                                  .size =0, .references =NULL};
    struct memblock mem_220824 = {.desc ="mem_220824", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236808->free_mem_220824,
                                  .size =0, .references =NULL};
    struct memblock mem_220827 = {.desc ="mem_220827", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236808->free_mem_220827,
                                  .size =0, .references =NULL};
    struct memblock mem_220830 = {.desc ="mem_220830", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_236808->free_mem_220830,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235274 = {.desc ="mem_param_235274", .mem =
                                        futhark_mc_scan_stage_3_parloop_struct_236808->free_mem_param_235274,
                                        .size =0, .references =NULL};
    bool cond_f_res_235279 =
         futhark_mc_scan_stage_3_parloop_struct_236808->free_cond_f_res_235279;
    bool cond_f_res_235280 =
         futhark_mc_scan_stage_3_parloop_struct_236808->free_cond_f_res_235280;
    int64_t unsign_arg_235281 =
            futhark_mc_scan_stage_3_parloop_struct_236808->free_unsign_arg_235281;
    int64_t unsign_arg_235282 =
            futhark_mc_scan_stage_3_parloop_struct_236808->free_unsign_arg_235282;
    int64_t iterations = end - start;
    int64_t iter_235409 = start;
    int64_t x_235397;
    int64_t x_235398;
    int64_t x_235399;
    int64_t x_235400;
    int64_t x_235401;
    int64_t x_235402;
    int64_t x_235403;
    int64_t x_235404;
    
    if (iter_235409 == (int64_t) 0) {
        x_235397 = (int64_t) 0;
    } else {
        x_235397 = ((int64_t *) mem_220821.mem)[iter_235409 - (int64_t) 1];
    }
    if (iter_235409 == (int64_t) 0) {
        x_235398 = (int64_t) 0;
    } else {
        x_235398 = ((int64_t *) mem_220824.mem)[iter_235409 - (int64_t) 1];
    }
    if (iter_235409 == (int64_t) 0) {
        x_235399 = (int64_t) 0;
    } else {
        x_235399 = ((int64_t *) mem_220827.mem)[iter_235409 - (int64_t) 1];
    }
    if (iter_235409 == (int64_t) 0) {
        x_235400 = (int64_t) 0;
    } else {
        x_235400 = ((int64_t *) mem_220830.mem)[iter_235409 - (int64_t) 1];
    }
    for (; iter_235409 < end; iter_235409++) {
        int64_t gtid_235289 = iter_235409;
        
        // stage 3 scan body
        {
            double x_235302;
            
            x_235302 = ((double *) mem_param_235274.mem)[gtid_235289];
            
            int64_t i64_arg_235303;
            
            i64_arg_235303 = futrts_to_bits64(x_235302);
            
            int64_t unsign_arg_235304 = ashr64(i64_arg_235303,
                                               unsign_arg_235281);
            int64_t unsign_arg_235305 = (int64_t) 1 & unsign_arg_235304;
            int32_t to_i32_res_235306 = zext_i64_i32(unsign_arg_235305);
            int64_t unsign_arg_235307 = ashr64(i64_arg_235303, (int64_t) 63);
            int64_t unsign_arg_235308 = (int64_t) 1 & unsign_arg_235307;
            int32_t to_i32_res_235309 = zext_i64_i32(unsign_arg_235308);
            bool cond_235310 = to_i32_res_235309 == 1;
            bool x_235311 = !cond_235310;
            bool y_235312 = cond_f_res_235279 && x_235311;
            bool cond_235313 = cond_235310 || y_235312;
            int32_t defunc_1_get_bit_res_235314;
            
            if (cond_235313) {
                int32_t defunc_1_get_bit_res_t_res_235315 = 1 ^
                        to_i32_res_235306;
                
                defunc_1_get_bit_res_235314 = defunc_1_get_bit_res_t_res_235315;
            } else {
                defunc_1_get_bit_res_235314 = to_i32_res_235306;
            }
            
            int32_t x_235316 = mul32(2, defunc_1_get_bit_res_235314);
            int64_t unsign_arg_235317 = ashr64(i64_arg_235303,
                                               unsign_arg_235282);
            int64_t unsign_arg_235318 = (int64_t) 1 & unsign_arg_235317;
            int32_t to_i32_res_235319 = zext_i64_i32(unsign_arg_235318);
            bool y_235320 = cond_f_res_235280 && x_235311;
            bool cond_235321 = cond_235310 || y_235320;
            int32_t defunc_1_get_bit_res_235322;
            
            if (cond_235321) {
                int32_t defunc_1_get_bit_res_t_res_235323 = 1 ^
                        to_i32_res_235319;
                
                defunc_1_get_bit_res_235322 = defunc_1_get_bit_res_t_res_235323;
            } else {
                defunc_1_get_bit_res_235322 = to_i32_res_235319;
            }
            
            int32_t defunc_0_f_res_235324 = add32(x_235316,
                                                  defunc_1_get_bit_res_235322);
            bool cond_235325 = defunc_0_f_res_235324 == 0;
            int64_t defunc_0_f_res_235326 = btoi_bool_i64(cond_235325);
            int64_t defunc_0_f_res_235327;
            int64_t defunc_0_f_res_235328;
            int64_t defunc_0_f_res_235329;
            
            if (cond_235325) {
                defunc_0_f_res_235327 = (int64_t) 0;
                defunc_0_f_res_235328 = (int64_t) 0;
                defunc_0_f_res_235329 = (int64_t) 0;
            } else {
                bool cond_235330 = defunc_0_f_res_235324 == 1;
                int64_t defunc_0_f_res_f_res_235331 =
                        btoi_bool_i64(cond_235330);
                int64_t defunc_0_f_res_f_res_235332;
                int64_t defunc_0_f_res_f_res_235333;
                
                if (cond_235330) {
                    defunc_0_f_res_f_res_235332 = (int64_t) 0;
                    defunc_0_f_res_f_res_235333 = (int64_t) 0;
                } else {
                    bool cond_235334 = defunc_0_f_res_235324 == 2;
                    int64_t defunc_0_f_res_f_res_f_res_235335 =
                            btoi_bool_i64(cond_235334);
                    bool cond_neg_235336 = !cond_235334;
                    int64_t defunc_0_f_res_f_res_f_res_235337 =
                            btoi_bool_i64(cond_neg_235336);
                    
                    defunc_0_f_res_f_res_235332 =
                        defunc_0_f_res_f_res_f_res_235335;
                    defunc_0_f_res_f_res_235333 =
                        defunc_0_f_res_f_res_f_res_235337;
                }
                defunc_0_f_res_235327 = defunc_0_f_res_f_res_235331;
                defunc_0_f_res_235328 = defunc_0_f_res_f_res_235332;
                defunc_0_f_res_235329 = defunc_0_f_res_f_res_235333;
            }
            x_235397 = x_235397;
            x_235398 = x_235398;
            x_235399 = x_235399;
            x_235400 = x_235400;
            x_235401 = defunc_0_f_res_235326;
            x_235402 = defunc_0_f_res_235327;
            x_235403 = defunc_0_f_res_235328;
            x_235404 = defunc_0_f_res_235329;
            
            int64_t defunc_1_op_res_235405 = add64(x_235397, x_235401);
            int64_t defunc_1_op_res_235406 = add64(x_235398, x_235402);
            int64_t defunc_1_op_res_235407 = add64(x_235399, x_235403);
            int64_t defunc_1_op_res_235408 = add64(x_235400, x_235404);
            
            ((int64_t *) mem_220821.mem)[gtid_235289] = defunc_1_op_res_235405;
            x_235397 = defunc_1_op_res_235405;
            ((int64_t *) mem_220824.mem)[gtid_235289] = defunc_1_op_res_235406;
            x_235398 = defunc_1_op_res_235406;
            ((int64_t *) mem_220827.mem)[gtid_235289] = defunc_1_op_res_235407;
            x_235399 = defunc_1_op_res_235407;
            ((int64_t *) mem_220830.mem)[gtid_235289] = defunc_1_op_res_235408;
            x_235400 = defunc_1_op_res_235408;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_236809_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_236809_end -
                 futhark_mc_scan_stage_3_parloop_236809_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_236809_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_236809_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_236809_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_236801(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235288 = tid;
    int num_tasks_235372 = info.nsubtasks;
    struct futhark_mc_task_236800 *futhark_mc_task_236800 =
                                  (struct futhark_mc_task_236800 *) args;
    struct futhark_context *ctx = futhark_mc_task_236800->ctx;
    uint64_t futhark_mc_segscan_task_236801_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_236801_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236800->free_n_203572;
    struct memblock mem_220821 = {.desc ="mem_220821", .mem =
                                  futhark_mc_task_236800->free_mem_220821,
                                  .size =0, .references =NULL};
    struct memblock mem_220824 = {.desc ="mem_220824", .mem =
                                  futhark_mc_task_236800->free_mem_220824,
                                  .size =0, .references =NULL};
    struct memblock mem_220827 = {.desc ="mem_220827", .mem =
                                  futhark_mc_task_236800->free_mem_220827,
                                  .size =0, .references =NULL};
    struct memblock mem_220830 = {.desc ="mem_220830", .mem =
                                  futhark_mc_task_236800->free_mem_220830,
                                  .size =0, .references =NULL};
    struct memblock mem_220833 = {.desc ="mem_220833", .mem =
                                  futhark_mc_task_236800->free_mem_220833,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235274 = {.desc ="mem_param_235274", .mem =
                                        futhark_mc_task_236800->free_mem_param_235274,
                                        .size =0, .references =NULL};
    bool cond_f_res_235279 = futhark_mc_task_236800->free_cond_f_res_235279;
    bool cond_f_res_235280 = futhark_mc_task_236800->free_cond_f_res_235280;
    int64_t unsign_arg_235281 = futhark_mc_task_236800->free_unsign_arg_235281;
    int64_t unsign_arg_235282 = futhark_mc_task_236800->free_unsign_arg_235282;
    size_t scan_stage_2_accum_mem_235388_cached_sizze_236802 = 0;
    unsigned char *scan_stage_2_accum_mem_235388 = NULL;
    size_t scan_stage_2_accum_mem_235390_cached_sizze_236803 = 0;
    unsigned char *scan_stage_2_accum_mem_235390 = NULL;
    size_t scan_stage_2_accum_mem_235392_cached_sizze_236804 = 0;
    unsigned char *scan_stage_2_accum_mem_235392 = NULL;
    size_t scan_stage_2_accum_mem_235394_cached_sizze_236805 = 0;
    unsigned char *scan_stage_2_accum_mem_235394 = NULL;
    int64_t iter_235373;
    struct futhark_mc_scan_stage_1_parloop_struct_236806
    futhark_mc_scan_stage_1_parloop_struct_236806;
    
    futhark_mc_scan_stage_1_parloop_struct_236806.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_mem_220821 =
        mem_220821.mem;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_mem_220824 =
        mem_220824.mem;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_mem_220827 =
        mem_220827.mem;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_mem_220830 =
        mem_220830.mem;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_mem_220833 =
        mem_220833.mem;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_mem_param_235274 =
        mem_param_235274.mem;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_cond_f_res_235279 =
        cond_f_res_235279;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_cond_f_res_235280 =
        cond_f_res_235280;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_unsign_arg_235281 =
        unsign_arg_235281;
    futhark_mc_scan_stage_1_parloop_struct_236806.free_unsign_arg_235282 =
        unsign_arg_235282;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_236807_task;
    
    futhark_mc_scan_stage_1_parloop_236807_task.name =
        "futhark_mc_scan_stage_1_parloop_236807";
    futhark_mc_scan_stage_1_parloop_236807_task.fn =
        futhark_mc_scan_stage_1_parloop_236807;
    futhark_mc_scan_stage_1_parloop_236807_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_236806;
    futhark_mc_scan_stage_1_parloop_236807_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_236807_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_236807_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_236807_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_236807_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_236807_task);
    
    if (futhark_mc_scan_stage_1_parloop_236807_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_236807_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_236807_total_end -
                 futhark_mc_scan_stage_1_parloop_236807_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236807_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236807_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_236807_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_235372)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_235374;
        int64_t x_235375;
        int64_t x_235376;
        int64_t x_235377;
        int64_t x_235378;
        int64_t x_235379;
        int64_t x_235380;
        int64_t x_235381;
        int64_t offset_235386 = (int64_t) 0;
        int64_t offset_index_235387 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_235388_cached_sizze_236802 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_235388 =
                realloc(scan_stage_2_accum_mem_235388, (int64_t) 8);
            scan_stage_2_accum_mem_235388_cached_sizze_236802 = (int64_t) 8;
        }
        if (scan_stage_2_accum_mem_235390_cached_sizze_236803 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_235390 =
                realloc(scan_stage_2_accum_mem_235390, (int64_t) 8);
            scan_stage_2_accum_mem_235390_cached_sizze_236803 = (int64_t) 8;
        }
        if (scan_stage_2_accum_mem_235392_cached_sizze_236804 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_235392 =
                realloc(scan_stage_2_accum_mem_235392, (int64_t) 8);
            scan_stage_2_accum_mem_235392_cached_sizze_236804 = (int64_t) 8;
        }
        if (scan_stage_2_accum_mem_235394_cached_sizze_236805 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_235394 =
                realloc(scan_stage_2_accum_mem_235394, (int64_t) 8);
            scan_stage_2_accum_mem_235394_cached_sizze_236805 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_235388)[(int64_t) 0] = (int64_t) 0;
        ((int64_t *) scan_stage_2_accum_mem_235390)[(int64_t) 0] = (int64_t) 0;
        ((int64_t *) scan_stage_2_accum_mem_235392)[(int64_t) 0] = (int64_t) 0;
        ((int64_t *) scan_stage_2_accum_mem_235394)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_235396 = 0; i_235396 < num_tasks_235372 - 1;
             i_235396++) {
            offset_235386 = squot64(n_203572, sext_i32_i64(num_tasks_235372));
            if (slt64(sext_i32_i64(i_235396), srem64(n_203572,
                                                     sext_i32_i64(num_tasks_235372)))) {
                offset_235386 += (int64_t) 1;
            }
            offset_index_235387 += offset_235386;
            
            int64_t gtid_235289 = offset_index_235387;
            double x_235302;
            
            x_235302 = ((double *) mem_param_235274.mem)[gtid_235289];
            
            int64_t i64_arg_235303;
            
            i64_arg_235303 = futrts_to_bits64(x_235302);
            
            int64_t unsign_arg_235304 = ashr64(i64_arg_235303,
                                               unsign_arg_235281);
            int64_t unsign_arg_235305 = (int64_t) 1 & unsign_arg_235304;
            int32_t to_i32_res_235306 = zext_i64_i32(unsign_arg_235305);
            int64_t unsign_arg_235307 = ashr64(i64_arg_235303, (int64_t) 63);
            int64_t unsign_arg_235308 = (int64_t) 1 & unsign_arg_235307;
            int32_t to_i32_res_235309 = zext_i64_i32(unsign_arg_235308);
            bool cond_235310 = to_i32_res_235309 == 1;
            bool x_235311 = !cond_235310;
            bool y_235312 = cond_f_res_235279 && x_235311;
            bool cond_235313 = cond_235310 || y_235312;
            int32_t defunc_1_get_bit_res_235314;
            
            if (cond_235313) {
                int32_t defunc_1_get_bit_res_t_res_235315 = 1 ^
                        to_i32_res_235306;
                
                defunc_1_get_bit_res_235314 = defunc_1_get_bit_res_t_res_235315;
            } else {
                defunc_1_get_bit_res_235314 = to_i32_res_235306;
            }
            
            int32_t x_235316 = mul32(2, defunc_1_get_bit_res_235314);
            int64_t unsign_arg_235317 = ashr64(i64_arg_235303,
                                               unsign_arg_235282);
            int64_t unsign_arg_235318 = (int64_t) 1 & unsign_arg_235317;
            int32_t to_i32_res_235319 = zext_i64_i32(unsign_arg_235318);
            bool y_235320 = cond_f_res_235280 && x_235311;
            bool cond_235321 = cond_235310 || y_235320;
            int32_t defunc_1_get_bit_res_235322;
            
            if (cond_235321) {
                int32_t defunc_1_get_bit_res_t_res_235323 = 1 ^
                        to_i32_res_235319;
                
                defunc_1_get_bit_res_235322 = defunc_1_get_bit_res_t_res_235323;
            } else {
                defunc_1_get_bit_res_235322 = to_i32_res_235319;
            }
            
            int32_t defunc_0_f_res_235324 = add32(x_235316,
                                                  defunc_1_get_bit_res_235322);
            bool cond_235325 = defunc_0_f_res_235324 == 0;
            int64_t defunc_0_f_res_235326 = btoi_bool_i64(cond_235325);
            int64_t defunc_0_f_res_235327;
            int64_t defunc_0_f_res_235328;
            int64_t defunc_0_f_res_235329;
            
            if (cond_235325) {
                defunc_0_f_res_235327 = (int64_t) 0;
                defunc_0_f_res_235328 = (int64_t) 0;
                defunc_0_f_res_235329 = (int64_t) 0;
            } else {
                bool cond_235330 = defunc_0_f_res_235324 == 1;
                int64_t defunc_0_f_res_f_res_235331 =
                        btoi_bool_i64(cond_235330);
                int64_t defunc_0_f_res_f_res_235332;
                int64_t defunc_0_f_res_f_res_235333;
                
                if (cond_235330) {
                    defunc_0_f_res_f_res_235332 = (int64_t) 0;
                    defunc_0_f_res_f_res_235333 = (int64_t) 0;
                } else {
                    bool cond_235334 = defunc_0_f_res_235324 == 2;
                    int64_t defunc_0_f_res_f_res_f_res_235335 =
                            btoi_bool_i64(cond_235334);
                    bool cond_neg_235336 = !cond_235334;
                    int64_t defunc_0_f_res_f_res_f_res_235337 =
                            btoi_bool_i64(cond_neg_235336);
                    
                    defunc_0_f_res_f_res_235332 =
                        defunc_0_f_res_f_res_f_res_235335;
                    defunc_0_f_res_f_res_235333 =
                        defunc_0_f_res_f_res_f_res_235337;
                }
                defunc_0_f_res_235327 = defunc_0_f_res_f_res_235331;
                defunc_0_f_res_235328 = defunc_0_f_res_f_res_235332;
                defunc_0_f_res_235329 = defunc_0_f_res_f_res_235333;
            }
            // Read carry in
            {
                x_235374 =
                    ((int64_t *) scan_stage_2_accum_mem_235388)[(int64_t) 0];
                x_235375 =
                    ((int64_t *) scan_stage_2_accum_mem_235390)[(int64_t) 0];
                x_235376 =
                    ((int64_t *) scan_stage_2_accum_mem_235392)[(int64_t) 0];
                x_235377 =
                    ((int64_t *) scan_stage_2_accum_mem_235394)[(int64_t) 0];
            }
            // Read next values
            {
                x_235378 = ((int64_t *) mem_220821.mem)[offset_index_235387 -
                                                        (int64_t) 1];
                x_235379 = ((int64_t *) mem_220824.mem)[offset_index_235387 -
                                                        (int64_t) 1];
                x_235380 = ((int64_t *) mem_220827.mem)[offset_index_235387 -
                                                        (int64_t) 1];
                x_235381 = ((int64_t *) mem_220830.mem)[offset_index_235387 -
                                                        (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_235382 = add64(x_235374, x_235378);
            int64_t defunc_1_op_res_235383 = add64(x_235375, x_235379);
            int64_t defunc_1_op_res_235384 = add64(x_235376, x_235380);
            int64_t defunc_1_op_res_235385 = add64(x_235377, x_235381);
            
            ((int64_t *) mem_220821.mem)[offset_index_235387 - (int64_t) 1] =
                defunc_1_op_res_235382;
            ((int64_t *) scan_stage_2_accum_mem_235388)[(int64_t) 0] =
                defunc_1_op_res_235382;
            ((int64_t *) mem_220824.mem)[offset_index_235387 - (int64_t) 1] =
                defunc_1_op_res_235383;
            ((int64_t *) scan_stage_2_accum_mem_235390)[(int64_t) 0] =
                defunc_1_op_res_235383;
            ((int64_t *) mem_220827.mem)[offset_index_235387 - (int64_t) 1] =
                defunc_1_op_res_235384;
            ((int64_t *) scan_stage_2_accum_mem_235392)[(int64_t) 0] =
                defunc_1_op_res_235384;
            ((int64_t *) mem_220830.mem)[offset_index_235387 - (int64_t) 1] =
                defunc_1_op_res_235385;
            ((int64_t *) scan_stage_2_accum_mem_235394)[(int64_t) 0] =
                defunc_1_op_res_235385;
        }
        
        int64_t iter_235409 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_236808
        futhark_mc_scan_stage_3_parloop_struct_236808;
        
        futhark_mc_scan_stage_3_parloop_struct_236808.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_236808.free_mem_220821 =
            mem_220821.mem;
        futhark_mc_scan_stage_3_parloop_struct_236808.free_mem_220824 =
            mem_220824.mem;
        futhark_mc_scan_stage_3_parloop_struct_236808.free_mem_220827 =
            mem_220827.mem;
        futhark_mc_scan_stage_3_parloop_struct_236808.free_mem_220830 =
            mem_220830.mem;
        futhark_mc_scan_stage_3_parloop_struct_236808.free_mem_param_235274 =
            mem_param_235274.mem;
        futhark_mc_scan_stage_3_parloop_struct_236808.free_cond_f_res_235279 =
            cond_f_res_235279;
        futhark_mc_scan_stage_3_parloop_struct_236808.free_cond_f_res_235280 =
            cond_f_res_235280;
        futhark_mc_scan_stage_3_parloop_struct_236808.free_unsign_arg_235281 =
            unsign_arg_235281;
        futhark_mc_scan_stage_3_parloop_struct_236808.free_unsign_arg_235282 =
            unsign_arg_235282;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_236809_task;
        
        futhark_mc_scan_stage_3_parloop_236809_task.name =
            "futhark_mc_scan_stage_3_parloop_236809";
        futhark_mc_scan_stage_3_parloop_236809_task.fn =
            futhark_mc_scan_stage_3_parloop_236809;
        futhark_mc_scan_stage_3_parloop_236809_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_236808;
        futhark_mc_scan_stage_3_parloop_236809_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_236809_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_236809_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_236809_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_236809_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_236809_task);
        
        if (futhark_mc_scan_stage_3_parloop_236809_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_236809_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_236809_total_end -
                     futhark_mc_scan_stage_3_parloop_236809_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236809_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236809_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_236809_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_235388);
        free(scan_stage_2_accum_mem_235390);
        free(scan_stage_2_accum_mem_235392);
        free(scan_stage_2_accum_mem_235394);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_236801_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_236801_end -
                 futhark_mc_segscan_task_236801_start;
        
        ctx->futhark_mc_segscan_task_236801_runs[tid]++;
        ctx->futhark_mc_segscan_task_236801_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_236801_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236810 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    unsigned char *free_mem_220821;
    unsigned char *free_mem_220824;
    unsigned char *free_mem_220827;
    unsigned char *free_mem_220830;
    unsigned char *free_mem_220833;
    unsigned char *free_mem_param_235274;
    unsigned char *free_mem_param_out_235275;
    int64_t free_last_res_235338;
    int64_t free_last_res_235339;
    int64_t free_last_res_235340;
};
struct futhark_mc_segmap_parloop_struct_236812 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    unsigned char *free_mem_220821;
    unsigned char *free_mem_220824;
    unsigned char *free_mem_220827;
    unsigned char *free_mem_220830;
    unsigned char *free_mem_220833;
    unsigned char *free_mem_param_235274;
    unsigned char *free_mem_param_out_235275;
    int64_t free_last_res_235338;
    int64_t free_last_res_235339;
    int64_t free_last_res_235340;
};
static int futhark_mc_segmap_parloop_236813(void *args, int64_t start,
                                            int64_t end, int flat_tid_235343,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236812
    *futhark_mc_segmap_parloop_struct_236812 =
    (struct futhark_mc_segmap_parloop_struct_236812 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236812->ctx;
    uint64_t futhark_mc_segmap_parloop_236813_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236813_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236812->free_n_203572;
    struct memblock mem_220821 = {.desc ="mem_220821", .mem =
                                  futhark_mc_segmap_parloop_struct_236812->free_mem_220821,
                                  .size =0, .references =NULL};
    struct memblock mem_220824 = {.desc ="mem_220824", .mem =
                                  futhark_mc_segmap_parloop_struct_236812->free_mem_220824,
                                  .size =0, .references =NULL};
    struct memblock mem_220827 = {.desc ="mem_220827", .mem =
                                  futhark_mc_segmap_parloop_struct_236812->free_mem_220827,
                                  .size =0, .references =NULL};
    struct memblock mem_220830 = {.desc ="mem_220830", .mem =
                                  futhark_mc_segmap_parloop_struct_236812->free_mem_220830,
                                  .size =0, .references =NULL};
    struct memblock mem_220833 = {.desc ="mem_220833", .mem =
                                  futhark_mc_segmap_parloop_struct_236812->free_mem_220833,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235274 = {.desc ="mem_param_235274", .mem =
                                        futhark_mc_segmap_parloop_struct_236812->free_mem_param_235274,
                                        .size =0, .references =NULL};
    struct memblock mem_param_out_235275 = {.desc ="mem_param_out_235275",
                                            .mem =
                                            futhark_mc_segmap_parloop_struct_236812->free_mem_param_out_235275,
                                            .size =0, .references =NULL};
    int64_t last_res_235338 =
            futhark_mc_segmap_parloop_struct_236812->free_last_res_235338;
    int64_t last_res_235339 =
            futhark_mc_segmap_parloop_struct_236812->free_last_res_235339;
    int64_t last_res_235340 =
            futhark_mc_segmap_parloop_struct_236812->free_last_res_235340;
    int64_t iterations = end - start;
    int64_t iter_235411 = start;
    
    for (; iter_235411 < end; iter_235411++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235430 = n_203572;
        int64_t gtid_235344 = iter_235411;
        int64_t remnant_235431 = iter_235411 - gtid_235344;
        int32_t x_235345;
        
        x_235345 = ((int32_t *) mem_220833.mem)[gtid_235344];
        
        double write_value_235346;
        
        write_value_235346 = ((double *) mem_param_235274.mem)[gtid_235344];
        
        bool match_lit_235347 = 0 == x_235345;
        int64_t defunc_1_f_res_235348;
        
        if (match_lit_235347) {
            int64_t x_235412;
            
            x_235412 = ((int64_t *) mem_220821.mem)[gtid_235344];
            
            int64_t case_res_235413 = sub64(x_235412, (int64_t) 1);
            
            defunc_1_f_res_235348 = case_res_235413;
        } else {
            bool match_lit_235414 = 1 == x_235345;
            int64_t x_235415;
            
            if (match_lit_235414) {
                int64_t x_235416;
                
                x_235416 = ((int64_t *) mem_220824.mem)[gtid_235344];
                
                int64_t x_235417 = add64(last_res_235338, x_235416);
                int64_t case_res_235418 = sub64(x_235417, (int64_t) 1);
                
                x_235415 = case_res_235418;
            } else {
                bool match_lit_235419 = 2 == x_235345;
                int64_t x_235420;
                
                if (match_lit_235419) {
                    int64_t x_235421;
                    
                    x_235421 = ((int64_t *) mem_220827.mem)[gtid_235344];
                    
                    int64_t x_235422 = add64(last_res_235338, last_res_235339);
                    int64_t x_235423 = add64(x_235421, x_235422);
                    int64_t case_res_235424 = sub64(x_235423, (int64_t) 1);
                    
                    x_235420 = case_res_235424;
                } else {
                    int64_t x_235425;
                    
                    x_235425 = ((int64_t *) mem_220830.mem)[gtid_235344];
                    
                    int64_t x_235426 = add64(last_res_235338, last_res_235339);
                    int64_t x_235427 = add64(last_res_235340, x_235426);
                    int64_t x_235428 = add64(x_235425, x_235427);
                    int64_t defunc_1_f_res_res_235429 = sub64(x_235428,
                                                              (int64_t) 1);
                    
                    x_235420 = defunc_1_f_res_res_235429;
                }
                x_235415 = x_235420;
            }
            defunc_1_f_res_235348 = x_235415;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_235348) &&
            slt64(defunc_1_f_res_235348, n_203572)) {
            ((double *) mem_param_out_235275.mem)[defunc_1_f_res_235348] =
                write_value_235346;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236813_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236813_end -
                 futhark_mc_segmap_parloop_236813_start;
        
        ctx->futhark_mc_segmap_parloop_236813_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236813_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236813_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236811(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235343 = tid;
    int num_tasks_235410 = info.nsubtasks;
    struct futhark_mc_task_236810 *futhark_mc_task_236810 =
                                  (struct futhark_mc_task_236810 *) args;
    struct futhark_context *ctx = futhark_mc_task_236810->ctx;
    uint64_t futhark_mc_segmap_task_236811_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236811_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236810->free_n_203572;
    struct memblock mem_220821 = {.desc ="mem_220821", .mem =
                                  futhark_mc_task_236810->free_mem_220821,
                                  .size =0, .references =NULL};
    struct memblock mem_220824 = {.desc ="mem_220824", .mem =
                                  futhark_mc_task_236810->free_mem_220824,
                                  .size =0, .references =NULL};
    struct memblock mem_220827 = {.desc ="mem_220827", .mem =
                                  futhark_mc_task_236810->free_mem_220827,
                                  .size =0, .references =NULL};
    struct memblock mem_220830 = {.desc ="mem_220830", .mem =
                                  futhark_mc_task_236810->free_mem_220830,
                                  .size =0, .references =NULL};
    struct memblock mem_220833 = {.desc ="mem_220833", .mem =
                                  futhark_mc_task_236810->free_mem_220833,
                                  .size =0, .references =NULL};
    struct memblock mem_param_235274 = {.desc ="mem_param_235274", .mem =
                                        futhark_mc_task_236810->free_mem_param_235274,
                                        .size =0, .references =NULL};
    struct memblock mem_param_out_235275 = {.desc ="mem_param_out_235275",
                                            .mem =
                                            futhark_mc_task_236810->free_mem_param_out_235275,
                                            .size =0, .references =NULL};
    int64_t last_res_235338 = futhark_mc_task_236810->free_last_res_235338;
    int64_t last_res_235339 = futhark_mc_task_236810->free_last_res_235339;
    int64_t last_res_235340 = futhark_mc_task_236810->free_last_res_235340;
    int64_t iter_235411;
    struct futhark_mc_segmap_parloop_struct_236812
    futhark_mc_segmap_parloop_struct_236812;
    
    futhark_mc_segmap_parloop_struct_236812.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236812.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236812.free_mem_220821 = mem_220821.mem;
    futhark_mc_segmap_parloop_struct_236812.free_mem_220824 = mem_220824.mem;
    futhark_mc_segmap_parloop_struct_236812.free_mem_220827 = mem_220827.mem;
    futhark_mc_segmap_parloop_struct_236812.free_mem_220830 = mem_220830.mem;
    futhark_mc_segmap_parloop_struct_236812.free_mem_220833 = mem_220833.mem;
    futhark_mc_segmap_parloop_struct_236812.free_mem_param_235274 =
        mem_param_235274.mem;
    futhark_mc_segmap_parloop_struct_236812.free_mem_param_out_235275 =
        mem_param_out_235275.mem;
    futhark_mc_segmap_parloop_struct_236812.free_last_res_235338 =
        last_res_235338;
    futhark_mc_segmap_parloop_struct_236812.free_last_res_235339 =
        last_res_235339;
    futhark_mc_segmap_parloop_struct_236812.free_last_res_235340 =
        last_res_235340;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236813_task;
    
    futhark_mc_segmap_parloop_236813_task.name =
        "futhark_mc_segmap_parloop_236813";
    futhark_mc_segmap_parloop_236813_task.fn = futhark_mc_segmap_parloop_236813;
    futhark_mc_segmap_parloop_236813_task.args =
        &futhark_mc_segmap_parloop_struct_236812;
    futhark_mc_segmap_parloop_236813_task.iterations = iterations;
    futhark_mc_segmap_parloop_236813_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236813_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236813_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236813_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236813_task);
    
    if (futhark_mc_segmap_parloop_236813_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236813_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236813_total_end -
                 futhark_mc_segmap_parloop_236813_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236813_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236813_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236813_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236811_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236811_end -
                 futhark_mc_segmap_task_236811_start;
        
        ctx->futhark_mc_segmap_task_236811_runs[tid]++;
        ctx->futhark_mc_segmap_task_236811_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236811_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236794(void *args, int64_t start,
                                            int64_t end, int flat_tid_215782,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236793
    *futhark_mc_segmap_parloop_struct_236793 =
    (struct futhark_mc_segmap_parloop_struct_236793 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236793->ctx;
    uint64_t futhark_mc_segmap_parloop_236794_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236794_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236793->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236793->free_partition_sizze_203667;
    int64_t i_203760 = futhark_mc_segmap_parloop_struct_236793->free_i_203760;
    int32_t iters_206755 =
            futhark_mc_segmap_parloop_struct_236793->free_iters_206755;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236793->free_bytes_217420;
    struct memblock mem_220803 = {.desc ="mem_220803", .mem =
                                  futhark_mc_segmap_parloop_struct_236793->free_mem_220803,
                                  .size =0, .references =NULL};
    int64_t bytes_220832 =
            futhark_mc_segmap_parloop_struct_236793->free_bytes_220832;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_segmap_parloop_struct_236793->free_mem_220953,
                                  .size =0, .references =NULL};
    int64_t num_bytes_221138 =
            futhark_mc_segmap_parloop_struct_236793->free_num_bytes_221138;
    size_t mem_220821_cached_sizze_236795 = 0;
    unsigned char *mem_220821 = NULL;
    size_t mem_220824_cached_sizze_236796 = 0;
    unsigned char *mem_220824 = NULL;
    size_t mem_220827_cached_sizze_236797 = 0;
    unsigned char *mem_220827 = NULL;
    size_t mem_220830_cached_sizze_236798 = 0;
    unsigned char *mem_220830 = NULL;
    size_t mem_220833_cached_sizze_236799 = 0;
    unsigned char *mem_220833 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235272 = start;
    
    if (mem_220821_cached_sizze_236795 < (size_t) bytes_217420) {
        mem_220821 = realloc(mem_220821, bytes_217420);
        mem_220821_cached_sizze_236795 = bytes_217420;
    }
    if (mem_220824_cached_sizze_236796 < (size_t) bytes_217420) {
        mem_220824 = realloc(mem_220824, bytes_217420);
        mem_220824_cached_sizze_236796 = bytes_217420;
    }
    if (mem_220827_cached_sizze_236797 < (size_t) bytes_217420) {
        mem_220827 = realloc(mem_220827, bytes_217420);
        mem_220827_cached_sizze_236797 = bytes_217420;
    }
    if (mem_220830_cached_sizze_236798 < (size_t) bytes_217420) {
        mem_220830 = realloc(mem_220830, bytes_217420);
        mem_220830_cached_sizze_236798 = bytes_217420;
    }
    if (mem_220833_cached_sizze_236799 < (size_t) bytes_220832) {
        mem_220833 = realloc(mem_220833, bytes_220832);
        mem_220833_cached_sizze_236799 = bytes_220832;
    }
    
    struct memblock mem_in_221139;
    
    mem_in_221139.references = NULL;
    if (memblock_alloc(ctx, &mem_in_221139, num_bytes_221138,
                       "mem_in_221139")) {
        err = 1;
        goto cleanup;
    }
    
    struct memblock mem_220836;
    
    mem_220836.references = NULL;
    if (memblock_alloc(ctx, &mem_220836, bytes_217420, "mem_220836")) {
        err = 1;
        goto cleanup;
    }
    
    struct memblock ext_mem_220839;
    
    ext_mem_220839.references = NULL;
    
    struct memblock ext_mem_unused_221140;
    
    ext_mem_unused_221140.references = NULL;
    
    struct memblock mem_param_235274;
    
    mem_param_235274.references = NULL;
    
    struct memblock mem_param_out_235275;
    
    mem_param_out_235275.references = NULL;
    for (; iter_235272 < end; iter_235272++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235367 = partition_sizze_203667;
        int64_t gtid_215783 = iter_235272;
        int64_t remnant_235368 = iter_235272 - gtid_215783;
        
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_in_221139.mem + (int64_t) 0, mem_220803.mem +
                    gtid_215783 * n_203572 * (int64_t) 8, n_203572 *
                    (int64_t) 8);
        if (memblock_set(ctx, &mem_param_235274, &mem_in_221139,
                         "mem_in_221139") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_out_235275, &mem_220836,
                         "mem_220836") != 0)
            return 1;
        for (int32_t i_235273 = 0; i_235273 < iters_206755; i_235273++) {
            int32_t defunc_2_radix_sort_step_arg_235277 = mul32(2, i_235273);
            int32_t defunc_0_get_bit_arg_235278 = add32(1,
                                                        defunc_2_radix_sort_step_arg_235277);
            bool cond_f_res_235279 = defunc_0_get_bit_arg_235278 == 63;
            bool cond_f_res_235280 = defunc_2_radix_sort_step_arg_235277 == 63;
            int64_t unsign_arg_235281 =
                    zext_i32_i64(defunc_0_get_bit_arg_235278);
            int64_t unsign_arg_235282 =
                    zext_i32_i64(defunc_2_radix_sort_step_arg_235277);
            int64_t flat_tid_235288 = (int64_t) 0;
            int32_t num_tasks_235372;
            
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "nonsegmented segScan");
            
            struct futhark_mc_task_236800 futhark_mc_task_236800;
            
            futhark_mc_task_236800.ctx = ctx;
            futhark_mc_task_236800.free_n_203572 = n_203572;
            futhark_mc_task_236800.free_mem_220821 = mem_220821;
            futhark_mc_task_236800.free_mem_220824 = mem_220824;
            futhark_mc_task_236800.free_mem_220827 = mem_220827;
            futhark_mc_task_236800.free_mem_220830 = mem_220830;
            futhark_mc_task_236800.free_mem_220833 = mem_220833;
            futhark_mc_task_236800.free_mem_param_235274 = mem_param_235274.mem;
            futhark_mc_task_236800.free_cond_f_res_235279 = cond_f_res_235279;
            futhark_mc_task_236800.free_cond_f_res_235280 = cond_f_res_235280;
            futhark_mc_task_236800.free_unsign_arg_235281 = unsign_arg_235281;
            futhark_mc_task_236800.free_unsign_arg_235282 = unsign_arg_235282;
            
            struct scheduler_segop futhark_mc_task_236800_task;
            
            futhark_mc_task_236800_task.args = &futhark_mc_task_236800;
            futhark_mc_task_236800_task.top_level_fn =
                futhark_mc_segscan_task_236801;
            futhark_mc_task_236800_task.name = "futhark_mc_segscan_task_236801";
            futhark_mc_task_236800_task.iterations = n_203572;
            futhark_mc_task_236800_task.task_time =
                &ctx->futhark_mc_segscan_task_236801_total_time;
            futhark_mc_task_236800_task.task_iter =
                &ctx->futhark_mc_segscan_task_236801_total_iter;
            futhark_mc_task_236800_task.sched = STATIC;
            futhark_mc_task_236800_task.nested_fn = NULL;
            
            int futhark_mc_segscan_task_236801_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236800_task);
            
            if (futhark_mc_segscan_task_236801_err != 0) {
                if (memblock_unref(ctx, &mem_param_out_235275,
                                   "mem_param_out_235275") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_235274,
                                   "mem_param_235274") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_unused_221140,
                                   "ext_mem_unused_221140") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220839, "ext_mem_220839") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_220836, "mem_220836") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_in_221139, "mem_in_221139") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t last_res_235338;
            
            last_res_235338 = ((int64_t *) mem_220821)[i_203760];
            
            int64_t last_res_235339;
            
            last_res_235339 = ((int64_t *) mem_220824)[i_203760];
            
            int64_t last_res_235340;
            
            last_res_235340 = ((int64_t *) mem_220827)[i_203760];
            if (n_203572 * (int64_t) 8 > 0)
                memmove(mem_param_out_235275.mem + (int64_t) 0,
                        mem_param_235274.mem + (int64_t) 0, n_203572 *
                        (int64_t) 8);
            
            int64_t flat_tid_235343 = (int64_t) 0;
            int32_t num_tasks_235410;
            struct futhark_mc_task_236810 futhark_mc_task_236810;
            
            futhark_mc_task_236810.ctx = ctx;
            futhark_mc_task_236810.free_n_203572 = n_203572;
            futhark_mc_task_236810.free_mem_220821 = mem_220821;
            futhark_mc_task_236810.free_mem_220824 = mem_220824;
            futhark_mc_task_236810.free_mem_220827 = mem_220827;
            futhark_mc_task_236810.free_mem_220830 = mem_220830;
            futhark_mc_task_236810.free_mem_220833 = mem_220833;
            futhark_mc_task_236810.free_mem_param_235274 = mem_param_235274.mem;
            futhark_mc_task_236810.free_mem_param_out_235275 =
                mem_param_out_235275.mem;
            futhark_mc_task_236810.free_last_res_235338 = last_res_235338;
            futhark_mc_task_236810.free_last_res_235339 = last_res_235339;
            futhark_mc_task_236810.free_last_res_235340 = last_res_235340;
            
            struct scheduler_segop futhark_mc_task_236810_task;
            
            futhark_mc_task_236810_task.args = &futhark_mc_task_236810;
            futhark_mc_task_236810_task.top_level_fn =
                futhark_mc_segmap_task_236811;
            futhark_mc_task_236810_task.name = "futhark_mc_segmap_task_236811";
            futhark_mc_task_236810_task.iterations = n_203572;
            futhark_mc_task_236810_task.task_time =
                &ctx->futhark_mc_segmap_task_236811_total_time;
            futhark_mc_task_236810_task.task_iter =
                &ctx->futhark_mc_segmap_task_236811_total_iter;
            futhark_mc_task_236810_task.sched = STATIC;
            futhark_mc_task_236810_task.nested_fn = NULL;
            
            int futhark_mc_segmap_task_236811_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236810_task);
            
            if (futhark_mc_segmap_task_236811_err != 0) {
                if (memblock_unref(ctx, &mem_param_out_235275,
                                   "mem_param_out_235275") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_235274,
                                   "mem_param_235274") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_unused_221140,
                                   "ext_mem_unused_221140") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220839, "ext_mem_220839") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_220836, "mem_220836") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_in_221139, "mem_in_221139") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            struct memblock mem_param_tmp_235369;
            
            mem_param_tmp_235369.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_235369, &mem_param_out_235275,
                             "mem_param_out_235275") != 0)
                return 1;
            
            struct memblock mem_param_out_tmp_235370;
            
            mem_param_out_tmp_235370.references = NULL;
            if (memblock_set(ctx, &mem_param_out_tmp_235370, &mem_param_235274,
                             "mem_param_235274") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_235274, &mem_param_tmp_235369,
                             "mem_param_tmp_235369") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_out_235275,
                             &mem_param_out_tmp_235370,
                             "mem_param_out_tmp_235370") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_out_tmp_235370,
                               "mem_param_out_tmp_235370") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_235369,
                               "mem_param_tmp_235369") != 0)
                return 1;
        }
        if (memblock_set(ctx, &ext_mem_220839, &mem_param_235274,
                         "mem_param_235274") != 0)
            return 1;
        if (memblock_set(ctx, &ext_mem_unused_221140, &mem_param_out_235275,
                         "mem_param_out_235275") != 0)
            return 1;
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220953.mem + gtid_215783 * n_203572 * (int64_t) 8,
                    ext_mem_220839.mem + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220821);
    free(mem_220824);
    free(mem_220827);
    free(mem_220830);
    free(mem_220833);
    if (memblock_unref(ctx, &mem_param_out_235275, "mem_param_out_235275") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_235274, "mem_param_235274") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_unused_221140, "ext_mem_unused_221140") !=
        0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220839, "ext_mem_220839") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_220836, "mem_220836") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_in_221139, "mem_in_221139") != 0)
        return 1;
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236794_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236794_end -
                 futhark_mc_segmap_parloop_236794_start;
        
        ctx->futhark_mc_segmap_parloop_236794_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236794_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236794_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236792(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215782 = tid;
    int num_tasks_235146 = info.nsubtasks;
    struct futhark_mc_task_236783 *futhark_mc_task_236783 =
                                  (struct futhark_mc_task_236783 *) args;
    struct futhark_context *ctx = futhark_mc_task_236783->ctx;
    uint64_t futhark_mc_segmap_nested_task_236792_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236792_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236783->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236783->free_partition_sizze_203667;
    int64_t i_203760 = futhark_mc_task_236783->free_i_203760;
    int32_t iters_206755 = futhark_mc_task_236783->free_iters_206755;
    int64_t bytes_217420 = futhark_mc_task_236783->free_bytes_217420;
    struct memblock mem_220803 = {.desc ="mem_220803", .mem =
                                  futhark_mc_task_236783->free_mem_220803,
                                  .size =0, .references =NULL};
    int64_t bytes_220832 = futhark_mc_task_236783->free_bytes_220832;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_task_236783->free_mem_220953,
                                  .size =0, .references =NULL};
    int64_t num_bytes_221138 = futhark_mc_task_236783->free_num_bytes_221138;
    int64_t num_bytes_221143 = futhark_mc_task_236783->free_num_bytes_221143;
    int64_t iter_235272;
    struct futhark_mc_segmap_parloop_struct_236793
    futhark_mc_segmap_parloop_struct_236793;
    
    futhark_mc_segmap_parloop_struct_236793.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236793.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236793.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236793.free_i_203760 = i_203760;
    futhark_mc_segmap_parloop_struct_236793.free_iters_206755 = iters_206755;
    futhark_mc_segmap_parloop_struct_236793.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236793.free_mem_220803 = mem_220803.mem;
    futhark_mc_segmap_parloop_struct_236793.free_bytes_220832 = bytes_220832;
    futhark_mc_segmap_parloop_struct_236793.free_mem_220953 = mem_220953.mem;
    futhark_mc_segmap_parloop_struct_236793.free_num_bytes_221138 =
        num_bytes_221138;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236794_task;
    
    futhark_mc_segmap_parloop_236794_task.name =
        "futhark_mc_segmap_parloop_236794";
    futhark_mc_segmap_parloop_236794_task.fn = futhark_mc_segmap_parloop_236794;
    futhark_mc_segmap_parloop_236794_task.args =
        &futhark_mc_segmap_parloop_struct_236793;
    futhark_mc_segmap_parloop_236794_task.iterations = iterations;
    futhark_mc_segmap_parloop_236794_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236794_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236794_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236794_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236794_task);
    
    if (futhark_mc_segmap_parloop_236794_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236794_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236794_total_end -
                 futhark_mc_segmap_parloop_236794_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236794_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236794_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236794_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236792_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236792_end -
                 futhark_mc_segmap_nested_task_236792_start;
        
        ctx->futhark_mc_segmap_nested_task_236792_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236792_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236792_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236814 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_stl_res_203754;
    int64_t free_j_m_i_204223;
    unsigned char *free_mem_220953;
    unsigned char *free_mem_220956;
    unsigned char *free_mem_220959;
    unsigned char *free_mem_220962;
};
struct futhark_mc_segmap_parloop_struct_236816 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_stl_res_203754;
    int64_t free_j_m_i_204223;
    unsigned char *free_mem_220953;
    unsigned char *free_mem_220956;
    unsigned char *free_mem_220959;
    unsigned char *free_mem_220962;
};
static int futhark_mc_segmap_parloop_236817(void *args, int64_t start,
                                            int64_t end, int flat_tid_215878,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236816
    *futhark_mc_segmap_parloop_struct_236816 =
    (struct futhark_mc_segmap_parloop_struct_236816 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236816->ctx;
    uint64_t futhark_mc_segmap_parloop_236817_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236817_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236816->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236816->free_partition_sizze_203667;
    int64_t stl_res_203754 =
            futhark_mc_segmap_parloop_struct_236816->free_stl_res_203754;
    int64_t j_m_i_204223 =
            futhark_mc_segmap_parloop_struct_236816->free_j_m_i_204223;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_segmap_parloop_struct_236816->free_mem_220953,
                                  .size =0, .references =NULL};
    struct memblock mem_220956 = {.desc ="mem_220956", .mem =
                                  futhark_mc_segmap_parloop_struct_236816->free_mem_220956,
                                  .size =0, .references =NULL};
    struct memblock mem_220959 = {.desc ="mem_220959", .mem =
                                  futhark_mc_segmap_parloop_struct_236816->free_mem_220959,
                                  .size =0, .references =NULL};
    struct memblock mem_220962 = {.desc ="mem_220962", .mem =
                                  futhark_mc_segmap_parloop_struct_236816->free_mem_220962,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235433 = start;
    
    for (; iter_235433 < end; iter_235433++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235439 = partition_sizze_203667;
        int64_t gtid_215879 = iter_235433;
        int64_t remnant_235440 = iter_235433 - gtid_215879;
        double defunc_2_reduce_res_206899;
        double redout_235435 = 0.0;
        
        for (int64_t i_235434 = 0; i_235434 < j_m_i_204223; i_235434++) {
            int64_t slice_235436 = stl_res_203754 + i_235434;
            double x_235437;
            
            x_235437 = ((double *) mem_220953.mem)[gtid_215879 * n_203572 +
                                                   slice_235436];
            
            double defunc_1_op_res_235438 = x_235437 + redout_235435;
            double redout_tmp_235441 = defunc_1_op_res_235438;
            
            redout_235435 = redout_tmp_235441;
        }
        defunc_2_reduce_res_206899 = redout_235435;
        
        double h_206904 = 3.0 * defunc_2_reduce_res_206899;
        double h9_206905 = 0.999 * h_206904;
        double h1_206906 = 1.0e-3 * h_206904;
        
        ((double *) mem_220956.mem)[gtid_215879] = h_206904;
        ((double *) mem_220959.mem)[gtid_215879] = h9_206905;
        ((double *) mem_220962.mem)[gtid_215879] = h1_206906;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236817_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236817_end -
                 futhark_mc_segmap_parloop_236817_start;
        
        ctx->futhark_mc_segmap_parloop_236817_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236817_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236817_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236815(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215878 = tid;
    int num_tasks_235432 = info.nsubtasks;
    struct futhark_mc_task_236814 *futhark_mc_task_236814 =
                                  (struct futhark_mc_task_236814 *) args;
    struct futhark_context *ctx = futhark_mc_task_236814->ctx;
    uint64_t futhark_mc_segmap_task_236815_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236815_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236814->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236814->free_partition_sizze_203667;
    int64_t stl_res_203754 = futhark_mc_task_236814->free_stl_res_203754;
    int64_t j_m_i_204223 = futhark_mc_task_236814->free_j_m_i_204223;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_task_236814->free_mem_220953,
                                  .size =0, .references =NULL};
    struct memblock mem_220956 = {.desc ="mem_220956", .mem =
                                  futhark_mc_task_236814->free_mem_220956,
                                  .size =0, .references =NULL};
    struct memblock mem_220959 = {.desc ="mem_220959", .mem =
                                  futhark_mc_task_236814->free_mem_220959,
                                  .size =0, .references =NULL};
    struct memblock mem_220962 = {.desc ="mem_220962", .mem =
                                  futhark_mc_task_236814->free_mem_220962,
                                  .size =0, .references =NULL};
    int64_t iter_235433;
    struct futhark_mc_segmap_parloop_struct_236816
    futhark_mc_segmap_parloop_struct_236816;
    
    futhark_mc_segmap_parloop_struct_236816.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236816.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236816.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236816.free_stl_res_203754 =
        stl_res_203754;
    futhark_mc_segmap_parloop_struct_236816.free_j_m_i_204223 = j_m_i_204223;
    futhark_mc_segmap_parloop_struct_236816.free_mem_220953 = mem_220953.mem;
    futhark_mc_segmap_parloop_struct_236816.free_mem_220956 = mem_220956.mem;
    futhark_mc_segmap_parloop_struct_236816.free_mem_220959 = mem_220959.mem;
    futhark_mc_segmap_parloop_struct_236816.free_mem_220962 = mem_220962.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236817_task;
    
    futhark_mc_segmap_parloop_236817_task.name =
        "futhark_mc_segmap_parloop_236817";
    futhark_mc_segmap_parloop_236817_task.fn = futhark_mc_segmap_parloop_236817;
    futhark_mc_segmap_parloop_236817_task.args =
        &futhark_mc_segmap_parloop_struct_236816;
    futhark_mc_segmap_parloop_236817_task.iterations = iterations;
    futhark_mc_segmap_parloop_236817_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236817_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236817_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236817_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236817_task);
    
    if (futhark_mc_segmap_parloop_236817_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236817_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236817_total_end -
                 futhark_mc_segmap_parloop_236817_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236817_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236817_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236817_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236815_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236815_end -
                 futhark_mc_segmap_task_236815_start;
        
        ctx->futhark_mc_segmap_task_236815_runs[tid]++;
        ctx->futhark_mc_segmap_task_236815_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236815_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236819 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_stl_res_203754;
    int64_t free_j_m_i_204223;
    unsigned char *free_mem_220953;
    unsigned char *free_mem_220956;
    unsigned char *free_mem_220959;
    unsigned char *free_mem_220962;
};
struct futhark_mc_task_236821 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_stl_res_203754;
    int64_t free_gtid_215885;
    unsigned char *free_mem_220953;
    double *retval_defunc_2_reduce_res_215887;
};
struct futhark_mc_segred_stage_1_parloop_struct_236824 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_stl_res_203754;
    int64_t free_gtid_215885;
    unsigned char *free_mem_220953;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_235453;
};
static int futhark_mc_segred_stage_1_parloop_236825(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_235443,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_236824
    *futhark_mc_segred_stage_1_parloop_struct_236824 =
    (struct futhark_mc_segred_stage_1_parloop_struct_236824 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_236824->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_236825_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236825_start = get_wall_time();
    
    int64_t n_203572 =
            futhark_mc_segred_stage_1_parloop_struct_236824->free_n_203572;
    int64_t stl_res_203754 =
            futhark_mc_segred_stage_1_parloop_struct_236824->free_stl_res_203754;
    int64_t gtid_215885 =
            futhark_mc_segred_stage_1_parloop_struct_236824->free_gtid_215885;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_236824->free_mem_220953,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_235453 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_235453",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_236824->free_reduce_stage_1_tid_res_arr_mem_235453,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235455 = start;
    double x_235445;
    double x_235446;
    double local_acc_235456 = 0.0;
    
    for (; iter_235455 < end; iter_235455++) {
        int64_t gtid_235444 = iter_235455;
        int64_t slice_235448 = stl_res_203754 + gtid_235444;
        double x_235449;
        
        x_235449 = ((double *) mem_220953.mem)[gtid_215885 * n_203572 +
                                               slice_235448];
        // save map-out results
        { }
        // Load accum params
        {
            x_235445 = local_acc_235456;
        }
        // Load next params
        {
            x_235446 = x_235449;
        }
        // Red body
        {
            double defunc_1_op_res_235447 = x_235445 + x_235446;
            
            local_acc_235456 = defunc_1_op_res_235447;
        }
    }
    ((double *) reduce_stage_1_tid_res_arr_mem_235453.mem)[flat_tid_235443] =
        local_acc_235456;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236825_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236825_end -
                 futhark_mc_segred_stage_1_parloop_236825_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_236825_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_236825_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_236825_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_236822(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235443 = tid;
    int num_tasks_235452 = info.nsubtasks;
    struct futhark_mc_task_236821 *futhark_mc_task_236821 =
                                  (struct futhark_mc_task_236821 *) args;
    struct futhark_context *ctx = futhark_mc_task_236821->ctx;
    uint64_t futhark_mc_segred_task_236822_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_236822_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236821->free_n_203572;
    int64_t stl_res_203754 = futhark_mc_task_236821->free_stl_res_203754;
    int64_t gtid_215885 = futhark_mc_task_236821->free_gtid_215885;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_task_236821->free_mem_220953,
                                  .size =0, .references =NULL};
    double defunc_2_reduce_res_215887 =
           *futhark_mc_task_236821->retval_defunc_2_reduce_res_215887;
    size_t reduce_stage_1_tid_res_arr_mem_235453_cached_sizze_236823 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_235453 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_235453_cached_sizze_236823 <
        (size_t) ((int64_t) 8 * num_tasks_235452)) {
        reduce_stage_1_tid_res_arr_mem_235453 =
            realloc(reduce_stage_1_tid_res_arr_mem_235453, (int64_t) 8 *
                    num_tasks_235452);
        reduce_stage_1_tid_res_arr_mem_235453_cached_sizze_236823 =
            (int64_t) 8 * num_tasks_235452;
    }
    
    int64_t iter_235455;
    struct futhark_mc_segred_stage_1_parloop_struct_236824
    futhark_mc_segred_stage_1_parloop_struct_236824;
    
    futhark_mc_segred_stage_1_parloop_struct_236824.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_236824.free_n_203572 = n_203572;
    futhark_mc_segred_stage_1_parloop_struct_236824.free_stl_res_203754 =
        stl_res_203754;
    futhark_mc_segred_stage_1_parloop_struct_236824.free_gtid_215885 =
        gtid_215885;
    futhark_mc_segred_stage_1_parloop_struct_236824.free_mem_220953 =
        mem_220953.mem;
    futhark_mc_segred_stage_1_parloop_struct_236824.free_reduce_stage_1_tid_res_arr_mem_235453 =
        reduce_stage_1_tid_res_arr_mem_235453;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_236825_task;
    
    futhark_mc_segred_stage_1_parloop_236825_task.name =
        "futhark_mc_segred_stage_1_parloop_236825";
    futhark_mc_segred_stage_1_parloop_236825_task.fn =
        futhark_mc_segred_stage_1_parloop_236825;
    futhark_mc_segred_stage_1_parloop_236825_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_236824;
    futhark_mc_segred_stage_1_parloop_236825_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_236825_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_236825_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_236825_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_236825_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_236825_task);
    
    if (futhark_mc_segred_stage_1_parloop_236825_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_236825_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_236825_total_end -
                 futhark_mc_segred_stage_1_parloop_236825_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236825_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236825_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_236825_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_215887 = 0.0;
    }
    
    double x_235457;
    double x_235458;
    
    for (int32_t i_235460 = 0; i_235460 < num_tasks_235452; i_235460++) {
        flat_tid_235443 = i_235460;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_235457 = defunc_2_reduce_res_215887;
            }
            // load next params
            {
                x_235458 =
                    ((double *) reduce_stage_1_tid_res_arr_mem_235453)[flat_tid_235443];
            }
            // red body
            {
                double defunc_1_op_res_235459 = x_235457 + x_235458;
                
                defunc_2_reduce_res_215887 = defunc_1_op_res_235459;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_235453);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_236822_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_236822_end -
                 futhark_mc_segred_task_236822_start;
        
        ctx->futhark_mc_segred_task_236822_runs[tid]++;
        ctx->futhark_mc_segred_task_236822_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_236822_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_236821->retval_defunc_2_reduce_res_215887 =
            defunc_2_reduce_res_215887;
    }
    return err;
}
static int futhark_mc_segmap_parloop_236820(void *args, int64_t start,
                                            int64_t end, int flat_tid_215884,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236819
    *futhark_mc_segmap_parloop_struct_236819 =
    (struct futhark_mc_segmap_parloop_struct_236819 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236819->ctx;
    uint64_t futhark_mc_segmap_parloop_236820_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236820_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236819->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236819->free_partition_sizze_203667;
    int64_t stl_res_203754 =
            futhark_mc_segmap_parloop_struct_236819->free_stl_res_203754;
    int64_t j_m_i_204223 =
            futhark_mc_segmap_parloop_struct_236819->free_j_m_i_204223;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_segmap_parloop_struct_236819->free_mem_220953,
                                  .size =0, .references =NULL};
    struct memblock mem_220956 = {.desc ="mem_220956", .mem =
                                  futhark_mc_segmap_parloop_struct_236819->free_mem_220956,
                                  .size =0, .references =NULL};
    struct memblock mem_220959 = {.desc ="mem_220959", .mem =
                                  futhark_mc_segmap_parloop_struct_236819->free_mem_220959,
                                  .size =0, .references =NULL};
    struct memblock mem_220962 = {.desc ="mem_220962", .mem =
                                  futhark_mc_segmap_parloop_struct_236819->free_mem_220962,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235442 = start;
    
    for (; iter_235442 < end; iter_235442++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235450 = partition_sizze_203667;
        int64_t gtid_215885 = iter_235442;
        int64_t remnant_235451 = iter_235442 - gtid_215885;
        double defunc_2_reduce_res_215887;
        int64_t flat_tid_235443 = (int64_t) 0;
        int32_t num_tasks_235452;
        
        defunc_2_reduce_res_215887 = 0.0;
        
        struct futhark_mc_task_236821 futhark_mc_task_236821;
        
        futhark_mc_task_236821.ctx = ctx;
        futhark_mc_task_236821.free_n_203572 = n_203572;
        futhark_mc_task_236821.free_stl_res_203754 = stl_res_203754;
        futhark_mc_task_236821.free_gtid_215885 = gtid_215885;
        futhark_mc_task_236821.free_mem_220953 = mem_220953.mem;
        futhark_mc_task_236821.retval_defunc_2_reduce_res_215887 =
            &defunc_2_reduce_res_215887;
        
        struct scheduler_segop futhark_mc_task_236821_task;
        
        futhark_mc_task_236821_task.args = &futhark_mc_task_236821;
        futhark_mc_task_236821_task.top_level_fn =
            futhark_mc_segred_task_236822;
        futhark_mc_task_236821_task.name = "futhark_mc_segred_task_236822";
        futhark_mc_task_236821_task.iterations = j_m_i_204223;
        futhark_mc_task_236821_task.task_time =
            &ctx->futhark_mc_segred_task_236822_total_time;
        futhark_mc_task_236821_task.task_iter =
            &ctx->futhark_mc_segred_task_236822_total_iter;
        futhark_mc_task_236821_task.sched = STATIC;
        futhark_mc_task_236821_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_236822_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236821_task);
        
        if (futhark_mc_segred_task_236822_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        double h_215894 = 3.0 * defunc_2_reduce_res_215887;
        double h9_215895 = 0.999 * h_215894;
        double h1_215896 = 1.0e-3 * h_215894;
        
        ((double *) mem_220956.mem)[gtid_215885] = h_215894;
        ((double *) mem_220959.mem)[gtid_215885] = h9_215895;
        ((double *) mem_220962.mem)[gtid_215885] = h1_215896;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236820_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236820_end -
                 futhark_mc_segmap_parloop_236820_start;
        
        ctx->futhark_mc_segmap_parloop_236820_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236820_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236820_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236818(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215884 = tid;
    int num_tasks_235432 = info.nsubtasks;
    struct futhark_mc_task_236814 *futhark_mc_task_236814 =
                                  (struct futhark_mc_task_236814 *) args;
    struct futhark_context *ctx = futhark_mc_task_236814->ctx;
    uint64_t futhark_mc_segmap_nested_task_236818_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236818_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236814->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236814->free_partition_sizze_203667;
    int64_t stl_res_203754 = futhark_mc_task_236814->free_stl_res_203754;
    int64_t j_m_i_204223 = futhark_mc_task_236814->free_j_m_i_204223;
    struct memblock mem_220953 = {.desc ="mem_220953", .mem =
                                  futhark_mc_task_236814->free_mem_220953,
                                  .size =0, .references =NULL};
    struct memblock mem_220956 = {.desc ="mem_220956", .mem =
                                  futhark_mc_task_236814->free_mem_220956,
                                  .size =0, .references =NULL};
    struct memblock mem_220959 = {.desc ="mem_220959", .mem =
                                  futhark_mc_task_236814->free_mem_220959,
                                  .size =0, .references =NULL};
    struct memblock mem_220962 = {.desc ="mem_220962", .mem =
                                  futhark_mc_task_236814->free_mem_220962,
                                  .size =0, .references =NULL};
    int64_t iter_235442;
    struct futhark_mc_segmap_parloop_struct_236819
    futhark_mc_segmap_parloop_struct_236819;
    
    futhark_mc_segmap_parloop_struct_236819.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236819.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236819.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236819.free_stl_res_203754 =
        stl_res_203754;
    futhark_mc_segmap_parloop_struct_236819.free_j_m_i_204223 = j_m_i_204223;
    futhark_mc_segmap_parloop_struct_236819.free_mem_220953 = mem_220953.mem;
    futhark_mc_segmap_parloop_struct_236819.free_mem_220956 = mem_220956.mem;
    futhark_mc_segmap_parloop_struct_236819.free_mem_220959 = mem_220959.mem;
    futhark_mc_segmap_parloop_struct_236819.free_mem_220962 = mem_220962.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236820_task;
    
    futhark_mc_segmap_parloop_236820_task.name =
        "futhark_mc_segmap_parloop_236820";
    futhark_mc_segmap_parloop_236820_task.fn = futhark_mc_segmap_parloop_236820;
    futhark_mc_segmap_parloop_236820_task.args =
        &futhark_mc_segmap_parloop_struct_236819;
    futhark_mc_segmap_parloop_236820_task.iterations = iterations;
    futhark_mc_segmap_parloop_236820_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236820_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236820_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236820_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236820_task);
    
    if (futhark_mc_segmap_parloop_236820_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236820_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236820_total_end -
                 futhark_mc_segmap_parloop_236820_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236820_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236820_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236820_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236818_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236818_end -
                 futhark_mc_segmap_nested_task_236818_start;
        
        ctx->futhark_mc_segmap_nested_task_236818_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236818_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236818_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236826 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_bytes_217420;
    unsigned char *free_mem_220807;
    unsigned char *free_mem_220956;
    unsigned char *free_mem_220959;
    unsigned char *free_mem_220962;
    unsigned char *free_mem_220984;
};
struct futhark_mc_segmap_parloop_struct_236828 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_bytes_217420;
    unsigned char *free_mem_220807;
    unsigned char *free_mem_220956;
    unsigned char *free_mem_220959;
    unsigned char *free_mem_220962;
    unsigned char *free_mem_220984;
};
static int futhark_mc_segmap_parloop_236829(void *args, int64_t start,
                                            int64_t end, int flat_tid_215897,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236828
    *futhark_mc_segmap_parloop_struct_236828 =
    (struct futhark_mc_segmap_parloop_struct_236828 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236828->ctx;
    uint64_t futhark_mc_segmap_parloop_236829_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236829_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236828->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236828->free_partition_sizze_203667;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236828->free_bytes_217420;
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_segmap_parloop_struct_236828->free_mem_220807,
                                  .size =0, .references =NULL};
    struct memblock mem_220956 = {.desc ="mem_220956", .mem =
                                  futhark_mc_segmap_parloop_struct_236828->free_mem_220956,
                                  .size =0, .references =NULL};
    struct memblock mem_220959 = {.desc ="mem_220959", .mem =
                                  futhark_mc_segmap_parloop_struct_236828->free_mem_220959,
                                  .size =0, .references =NULL};
    struct memblock mem_220962 = {.desc ="mem_220962", .mem =
                                  futhark_mc_segmap_parloop_struct_236828->free_mem_220962,
                                  .size =0, .references =NULL};
    struct memblock mem_220984 = {.desc ="mem_220984", .mem =
                                  futhark_mc_segmap_parloop_struct_236828->free_mem_220984,
                                  .size =0, .references =NULL};
    size_t mem_220968_cached_sizze_236830 = 0;
    unsigned char *mem_220968 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235462 = start;
    
    if (mem_220968_cached_sizze_236830 < (size_t) bytes_217420) {
        mem_220968 = realloc(mem_220968, bytes_217420);
        mem_220968_cached_sizze_236830 = bytes_217420;
    }
    for (; iter_235462 < end; iter_235462++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235483 = partition_sizze_203667;
        int64_t gtid_215898 = iter_235462;
        int64_t remnant_235484 = iter_235462 - gtid_215898;
        double x_206912;
        
        x_206912 = ((double *) mem_220956.mem)[gtid_215898];
        
        double x_206913;
        
        x_206913 = ((double *) mem_220959.mem)[gtid_215898];
        
        double x_206914;
        
        x_206914 = ((double *) mem_220962.mem)[gtid_215898];
        for (int64_t i_235463 = 0; i_235463 < n_203572; i_235463++) {
            double x_235465;
            
            x_235465 = ((double *) mem_220807.mem)[gtid_215898 * n_203572 +
                                                   i_235463];
            
            double x_235466 = x_235465 / x_206912;
            double y_235467 = fpow64(x_235466, 2.0);
            double x_235468 = 1.0 - y_235467;
            double bicube_235469 = fpow64(x_235468, 2.0);
            bool isnan_res_235470;
            
            isnan_res_235470 = futrts_isnan64(x_235465);
            
            bool cond_f_res_235471 = x_235465 <= x_206914;
            bool x_235472 = !isnan_res_235470;
            bool y_235473 = cond_f_res_235471 && x_235472;
            bool cond_235474 = isnan_res_235470 || y_235473;
            double defunc_0_f_res_235475;
            
            if (cond_235474) {
                defunc_0_f_res_235475 = 1.0;
            } else {
                bool cond_235476 = x_206913 <= x_235465;
                bool cond_f_res_235477 = x_235465 <= 1.0e-6;
                bool x_235478 = !cond_235476;
                bool y_235479 = cond_f_res_235477 && x_235478;
                bool cond_235480 = cond_235476 || y_235479;
                double defunc_0_f_res_f_res_235481;
                
                if (cond_235480) {
                    defunc_0_f_res_f_res_235481 = 1.0e-6;
                } else {
                    defunc_0_f_res_f_res_235481 = bicube_235469;
                }
                defunc_0_f_res_235475 = defunc_0_f_res_f_res_235481;
            }
            ((double *) mem_220968)[i_235463] = defunc_0_f_res_235475;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220984.mem + gtid_215898 * n_203572 * (int64_t) 8,
                    mem_220968 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220968);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236829_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236829_end -
                 futhark_mc_segmap_parloop_236829_start;
        
        ctx->futhark_mc_segmap_parloop_236829_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236829_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236829_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236827(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215897 = tid;
    int num_tasks_235461 = info.nsubtasks;
    struct futhark_mc_task_236826 *futhark_mc_task_236826 =
                                  (struct futhark_mc_task_236826 *) args;
    struct futhark_context *ctx = futhark_mc_task_236826->ctx;
    uint64_t futhark_mc_segmap_task_236827_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236827_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236826->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236826->free_partition_sizze_203667;
    int64_t bytes_217420 = futhark_mc_task_236826->free_bytes_217420;
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_task_236826->free_mem_220807,
                                  .size =0, .references =NULL};
    struct memblock mem_220956 = {.desc ="mem_220956", .mem =
                                  futhark_mc_task_236826->free_mem_220956,
                                  .size =0, .references =NULL};
    struct memblock mem_220959 = {.desc ="mem_220959", .mem =
                                  futhark_mc_task_236826->free_mem_220959,
                                  .size =0, .references =NULL};
    struct memblock mem_220962 = {.desc ="mem_220962", .mem =
                                  futhark_mc_task_236826->free_mem_220962,
                                  .size =0, .references =NULL};
    struct memblock mem_220984 = {.desc ="mem_220984", .mem =
                                  futhark_mc_task_236826->free_mem_220984,
                                  .size =0, .references =NULL};
    int64_t iter_235462;
    struct futhark_mc_segmap_parloop_struct_236828
    futhark_mc_segmap_parloop_struct_236828;
    
    futhark_mc_segmap_parloop_struct_236828.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236828.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236828.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236828.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236828.free_mem_220807 = mem_220807.mem;
    futhark_mc_segmap_parloop_struct_236828.free_mem_220956 = mem_220956.mem;
    futhark_mc_segmap_parloop_struct_236828.free_mem_220959 = mem_220959.mem;
    futhark_mc_segmap_parloop_struct_236828.free_mem_220962 = mem_220962.mem;
    futhark_mc_segmap_parloop_struct_236828.free_mem_220984 = mem_220984.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236829_task;
    
    futhark_mc_segmap_parloop_236829_task.name =
        "futhark_mc_segmap_parloop_236829";
    futhark_mc_segmap_parloop_236829_task.fn = futhark_mc_segmap_parloop_236829;
    futhark_mc_segmap_parloop_236829_task.args =
        &futhark_mc_segmap_parloop_struct_236828;
    futhark_mc_segmap_parloop_236829_task.iterations = iterations;
    futhark_mc_segmap_parloop_236829_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236829_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236829_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236829_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236829_task);
    
    if (futhark_mc_segmap_parloop_236829_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236829_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236829_total_end -
                 futhark_mc_segmap_parloop_236829_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236829_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236829_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236829_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236827_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236827_end -
                 futhark_mc_segmap_task_236827_start;
        
        ctx->futhark_mc_segmap_task_236827_runs[tid]++;
        ctx->futhark_mc_segmap_task_236827_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236827_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_236832 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    int64_t free_bytes_217420;
    unsigned char *free_mem_220807;
    unsigned char *free_mem_220956;
    unsigned char *free_mem_220959;
    unsigned char *free_mem_220962;
    unsigned char *free_mem_220984;
};
struct futhark_mc_task_236835 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215904;
    double free_x_215906;
    double free_x_215907;
    double free_x_215908;
    unsigned char *free_mem_220807;
    unsigned char *free_mem_220965;
};
struct futhark_mc_segmap_parloop_struct_236837 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215904;
    double free_x_215906;
    double free_x_215907;
    double free_x_215908;
    unsigned char *free_mem_220807;
    unsigned char *free_mem_220965;
};
static int futhark_mc_segmap_parloop_236838(void *args, int64_t start,
                                            int64_t end, int flat_tid_235487,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236837
    *futhark_mc_segmap_parloop_struct_236837 =
    (struct futhark_mc_segmap_parloop_struct_236837 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236837->ctx;
    uint64_t futhark_mc_segmap_parloop_236838_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236838_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236837->free_n_203572;
    int64_t gtid_215904 =
            futhark_mc_segmap_parloop_struct_236837->free_gtid_215904;
    double x_215906 = futhark_mc_segmap_parloop_struct_236837->free_x_215906;
    double x_215907 = futhark_mc_segmap_parloop_struct_236837->free_x_215907;
    double x_215908 = futhark_mc_segmap_parloop_struct_236837->free_x_215908;
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_segmap_parloop_struct_236837->free_mem_220807,
                                  .size =0, .references =NULL};
    struct memblock mem_220965 = {.desc ="mem_220965", .mem =
                                  futhark_mc_segmap_parloop_struct_236837->free_mem_220965,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235509 = start;
    
    for (; iter_235509 < end; iter_235509++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235516 = n_203572;
        int64_t gtid_235488 = iter_235509;
        int64_t remnant_235517 = iter_235509 - gtid_235488;
        double x_235489;
        
        x_235489 = ((double *) mem_220807.mem)[gtid_215904 * n_203572 +
                                               gtid_235488];
        
        double x_235490 = x_235489 / x_215906;
        double y_235491 = fpow64(x_235490, 2.0);
        double x_235492 = 1.0 - y_235491;
        double bicube_235493 = fpow64(x_235492, 2.0);
        bool isnan_res_235494;
        
        isnan_res_235494 = futrts_isnan64(x_235489);
        
        bool cond_f_res_235495 = x_235489 <= x_215908;
        bool x_235496 = !isnan_res_235494;
        bool y_235497 = cond_f_res_235495 && x_235496;
        bool cond_235498 = isnan_res_235494 || y_235497;
        double defunc_0_f_res_235499;
        
        if (cond_235498) {
            defunc_0_f_res_235499 = 1.0;
        } else {
            bool cond_235510 = x_215907 <= x_235489;
            bool cond_f_res_235511 = x_235489 <= 1.0e-6;
            bool x_235512 = !cond_235510;
            bool y_235513 = cond_f_res_235511 && x_235512;
            bool cond_235514 = cond_235510 || y_235513;
            double defunc_0_f_res_f_res_235515;
            
            if (cond_235514) {
                defunc_0_f_res_f_res_235515 = 1.0e-6;
            } else {
                defunc_0_f_res_f_res_235515 = bicube_235493;
            }
            defunc_0_f_res_235499 = defunc_0_f_res_f_res_235515;
        }
        ((double *) mem_220965.mem)[gtid_235488] = defunc_0_f_res_235499;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236838_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236838_end -
                 futhark_mc_segmap_parloop_236838_start;
        
        ctx->futhark_mc_segmap_parloop_236838_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236838_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236838_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236836(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235487 = tid;
    int num_tasks_235508 = info.nsubtasks;
    struct futhark_mc_task_236835 *futhark_mc_task_236835 =
                                  (struct futhark_mc_task_236835 *) args;
    struct futhark_context *ctx = futhark_mc_task_236835->ctx;
    uint64_t futhark_mc_segmap_task_236836_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236836_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236835->free_n_203572;
    int64_t gtid_215904 = futhark_mc_task_236835->free_gtid_215904;
    double x_215906 = futhark_mc_task_236835->free_x_215906;
    double x_215907 = futhark_mc_task_236835->free_x_215907;
    double x_215908 = futhark_mc_task_236835->free_x_215908;
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_task_236835->free_mem_220807,
                                  .size =0, .references =NULL};
    struct memblock mem_220965 = {.desc ="mem_220965", .mem =
                                  futhark_mc_task_236835->free_mem_220965,
                                  .size =0, .references =NULL};
    int64_t iter_235509;
    struct futhark_mc_segmap_parloop_struct_236837
    futhark_mc_segmap_parloop_struct_236837;
    
    futhark_mc_segmap_parloop_struct_236837.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236837.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236837.free_gtid_215904 = gtid_215904;
    futhark_mc_segmap_parloop_struct_236837.free_x_215906 = x_215906;
    futhark_mc_segmap_parloop_struct_236837.free_x_215907 = x_215907;
    futhark_mc_segmap_parloop_struct_236837.free_x_215908 = x_215908;
    futhark_mc_segmap_parloop_struct_236837.free_mem_220807 = mem_220807.mem;
    futhark_mc_segmap_parloop_struct_236837.free_mem_220965 = mem_220965.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236838_task;
    
    futhark_mc_segmap_parloop_236838_task.name =
        "futhark_mc_segmap_parloop_236838";
    futhark_mc_segmap_parloop_236838_task.fn = futhark_mc_segmap_parloop_236838;
    futhark_mc_segmap_parloop_236838_task.args =
        &futhark_mc_segmap_parloop_struct_236837;
    futhark_mc_segmap_parloop_236838_task.iterations = iterations;
    futhark_mc_segmap_parloop_236838_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236838_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236838_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236838_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236838_task);
    
    if (futhark_mc_segmap_parloop_236838_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236838_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236838_total_end -
                 futhark_mc_segmap_parloop_236838_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236838_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236838_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236838_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236836_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236836_end -
                 futhark_mc_segmap_task_236836_start;
        
        ctx->futhark_mc_segmap_task_236836_runs[tid]++;
        ctx->futhark_mc_segmap_task_236836_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236836_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236833(void *args, int64_t start,
                                            int64_t end, int flat_tid_215903,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236832
    *futhark_mc_segmap_parloop_struct_236832 =
    (struct futhark_mc_segmap_parloop_struct_236832 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236832->ctx;
    uint64_t futhark_mc_segmap_parloop_236833_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236833_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236832->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236832->free_partition_sizze_203667;
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236832->free_bytes_217420;
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_segmap_parloop_struct_236832->free_mem_220807,
                                  .size =0, .references =NULL};
    struct memblock mem_220956 = {.desc ="mem_220956", .mem =
                                  futhark_mc_segmap_parloop_struct_236832->free_mem_220956,
                                  .size =0, .references =NULL};
    struct memblock mem_220959 = {.desc ="mem_220959", .mem =
                                  futhark_mc_segmap_parloop_struct_236832->free_mem_220959,
                                  .size =0, .references =NULL};
    struct memblock mem_220962 = {.desc ="mem_220962", .mem =
                                  futhark_mc_segmap_parloop_struct_236832->free_mem_220962,
                                  .size =0, .references =NULL};
    struct memblock mem_220984 = {.desc ="mem_220984", .mem =
                                  futhark_mc_segmap_parloop_struct_236832->free_mem_220984,
                                  .size =0, .references =NULL};
    size_t mem_220965_cached_sizze_236834 = 0;
    unsigned char *mem_220965 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235486 = start;
    
    if (mem_220965_cached_sizze_236834 < (size_t) bytes_217420) {
        mem_220965 = realloc(mem_220965, bytes_217420);
        mem_220965_cached_sizze_236834 = bytes_217420;
    }
    for (; iter_235486 < end; iter_235486++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235506 = partition_sizze_203667;
        int64_t gtid_215904 = iter_235486;
        int64_t remnant_235507 = iter_235486 - gtid_215904;
        double x_215906;
        
        x_215906 = ((double *) mem_220956.mem)[gtid_215904];
        
        double x_215907;
        
        x_215907 = ((double *) mem_220959.mem)[gtid_215904];
        
        double x_215908;
        
        x_215908 = ((double *) mem_220962.mem)[gtid_215904];
        
        int64_t flat_tid_235487 = (int64_t) 0;
        int32_t num_tasks_235508;
        struct futhark_mc_task_236835 futhark_mc_task_236835;
        
        futhark_mc_task_236835.ctx = ctx;
        futhark_mc_task_236835.free_n_203572 = n_203572;
        futhark_mc_task_236835.free_gtid_215904 = gtid_215904;
        futhark_mc_task_236835.free_x_215906 = x_215906;
        futhark_mc_task_236835.free_x_215907 = x_215907;
        futhark_mc_task_236835.free_x_215908 = x_215908;
        futhark_mc_task_236835.free_mem_220807 = mem_220807.mem;
        futhark_mc_task_236835.free_mem_220965 = mem_220965;
        
        struct scheduler_segop futhark_mc_task_236835_task;
        
        futhark_mc_task_236835_task.args = &futhark_mc_task_236835;
        futhark_mc_task_236835_task.top_level_fn =
            futhark_mc_segmap_task_236836;
        futhark_mc_task_236835_task.name = "futhark_mc_segmap_task_236836";
        futhark_mc_task_236835_task.iterations = n_203572;
        futhark_mc_task_236835_task.task_time =
            &ctx->futhark_mc_segmap_task_236836_total_time;
        futhark_mc_task_236835_task.task_iter =
            &ctx->futhark_mc_segmap_task_236836_total_iter;
        futhark_mc_task_236835_task.sched = STATIC;
        futhark_mc_task_236835_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236836_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236835_task);
        
        if (futhark_mc_segmap_task_236836_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_203572 * (int64_t) 8 > 0)
            memmove(mem_220984.mem + gtid_215904 * n_203572 * (int64_t) 8,
                    mem_220965 + (int64_t) 0, n_203572 * (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_220965);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236833_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236833_end -
                 futhark_mc_segmap_parloop_236833_start;
        
        ctx->futhark_mc_segmap_parloop_236833_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236833_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236833_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_236831(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215903 = tid;
    int num_tasks_235461 = info.nsubtasks;
    struct futhark_mc_task_236826 *futhark_mc_task_236826 =
                                  (struct futhark_mc_task_236826 *) args;
    struct futhark_context *ctx = futhark_mc_task_236826->ctx;
    uint64_t futhark_mc_segmap_nested_task_236831_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_236831_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236826->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236826->free_partition_sizze_203667;
    int64_t bytes_217420 = futhark_mc_task_236826->free_bytes_217420;
    struct memblock mem_220807 = {.desc ="mem_220807", .mem =
                                  futhark_mc_task_236826->free_mem_220807,
                                  .size =0, .references =NULL};
    struct memblock mem_220956 = {.desc ="mem_220956", .mem =
                                  futhark_mc_task_236826->free_mem_220956,
                                  .size =0, .references =NULL};
    struct memblock mem_220959 = {.desc ="mem_220959", .mem =
                                  futhark_mc_task_236826->free_mem_220959,
                                  .size =0, .references =NULL};
    struct memblock mem_220962 = {.desc ="mem_220962", .mem =
                                  futhark_mc_task_236826->free_mem_220962,
                                  .size =0, .references =NULL};
    struct memblock mem_220984 = {.desc ="mem_220984", .mem =
                                  futhark_mc_task_236826->free_mem_220984,
                                  .size =0, .references =NULL};
    int64_t iter_235486;
    struct futhark_mc_segmap_parloop_struct_236832
    futhark_mc_segmap_parloop_struct_236832;
    
    futhark_mc_segmap_parloop_struct_236832.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236832.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236832.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236832.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236832.free_mem_220807 = mem_220807.mem;
    futhark_mc_segmap_parloop_struct_236832.free_mem_220956 = mem_220956.mem;
    futhark_mc_segmap_parloop_struct_236832.free_mem_220959 = mem_220959.mem;
    futhark_mc_segmap_parloop_struct_236832.free_mem_220962 = mem_220962.mem;
    futhark_mc_segmap_parloop_struct_236832.free_mem_220984 = mem_220984.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236833_task;
    
    futhark_mc_segmap_parloop_236833_task.name =
        "futhark_mc_segmap_parloop_236833";
    futhark_mc_segmap_parloop_236833_task.fn = futhark_mc_segmap_parloop_236833;
    futhark_mc_segmap_parloop_236833_task.args =
        &futhark_mc_segmap_parloop_struct_236832;
    futhark_mc_segmap_parloop_236833_task.iterations = iterations;
    futhark_mc_segmap_parloop_236833_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236833_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236833_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236833_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236833_task);
    
    if (futhark_mc_segmap_parloop_236833_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236833_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236833_total_end -
                 futhark_mc_segmap_parloop_236833_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236833_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236833_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236833_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_236831_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_236831_end -
                 futhark_mc_segmap_nested_task_236831_start;
        
        ctx->futhark_mc_segmap_nested_task_236831_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_236831_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_236831_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_236839 {
    struct futhark_context *ctx;
    int64_t free_m_203571;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_217418;
    int64_t free_bytes_217420;
    unsigned char *free_ext_mem_220994;
    unsigned char *free_ext_mem_220995;
    int64_t free_ext_221006;
    unsigned char *free_mem_221020;
    unsigned char *free_mem_221024;
    unsigned char *free_mem_221028;
};
struct futhark_mc_segmap_parloop_struct_236841 {
    struct futhark_context *ctx;
    int64_t free_m_203571;
    int64_t free_n_203572;
    int64_t free_partition_sizze_203667;
    unsigned char *free_mem_217415;
    unsigned char *free_mem_217418;
    int64_t free_bytes_217420;
    unsigned char *free_ext_mem_220994;
    unsigned char *free_ext_mem_220995;
    int64_t free_ext_221006;
    unsigned char *free_mem_221020;
    unsigned char *free_mem_221024;
    unsigned char *free_mem_221028;
};
struct futhark_mc_task_236844 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215930;
    unsigned char *free_mem_217415;
    unsigned char *free_ext_mem_220994;
    unsigned char *free_ext_mem_220995;
    int64_t free_ext_221006;
    unsigned char *free_mem_221031;
};
struct futhark_mc_segmap_parloop_struct_236846 {
    struct futhark_context *ctx;
    int64_t free_n_203572;
    int64_t free_gtid_215930;
    unsigned char *free_mem_217415;
    unsigned char *free_ext_mem_220994;
    unsigned char *free_ext_mem_220995;
    int64_t free_ext_221006;
    unsigned char *free_mem_221031;
};
static int futhark_mc_segmap_parloop_236847(void *args, int64_t start,
                                            int64_t end, int flat_tid_235526,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236846
    *futhark_mc_segmap_parloop_struct_236846 =
    (struct futhark_mc_segmap_parloop_struct_236846 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236846->ctx;
    uint64_t futhark_mc_segmap_parloop_236847_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236847_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236846->free_n_203572;
    int64_t gtid_215930 =
            futhark_mc_segmap_parloop_struct_236846->free_gtid_215930;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236846->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220994 = {.desc ="ext_mem_220994", .mem =
                                      futhark_mc_segmap_parloop_struct_236846->free_ext_mem_220994,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220995 = {.desc ="ext_mem_220995", .mem =
                                      futhark_mc_segmap_parloop_struct_236846->free_ext_mem_220995,
                                      .size =0, .references =NULL};
    int64_t ext_221006 =
            futhark_mc_segmap_parloop_struct_236846->free_ext_221006;
    struct memblock mem_221031 = {.desc ="mem_221031", .mem =
                                  futhark_mc_segmap_parloop_struct_236846->free_mem_221031,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_235536 = start;
    
    for (; iter_235536 < end; iter_235536++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235537 = n_203572;
        int64_t gtid_235527 = iter_235536;
        int64_t remnant_235538 = iter_235536 - gtid_235527;
        double x_235528;
        
        x_235528 = ((double *) mem_217415.mem)[gtid_215930 * n_203572 +
                                               gtid_235527];
        
        double x_235529;
        
        x_235529 = ((double *) ext_mem_220995.mem)[gtid_215930 * n_203572 +
                                                   gtid_235527];
        
        double x_235530;
        
        x_235530 = ((double *) ext_mem_220994.mem)[gtid_215930 * ext_221006 +
                                                   gtid_235527];
        
        double x_235531 = x_235528 - x_235529;
        double defunc_2_f_res_235532 = x_235531 - x_235530;
        
        ((double *) mem_221031.mem)[gtid_235527] = defunc_2_f_res_235532;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236847_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236847_end -
                 futhark_mc_segmap_parloop_236847_start;
        
        ctx->futhark_mc_segmap_parloop_236847_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236847_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236847_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236845(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_235526 = tid;
    int num_tasks_235535 = info.nsubtasks;
    struct futhark_mc_task_236844 *futhark_mc_task_236844 =
                                  (struct futhark_mc_task_236844 *) args;
    struct futhark_context *ctx = futhark_mc_task_236844->ctx;
    uint64_t futhark_mc_segmap_task_236845_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236845_start = get_wall_time();
    
    int64_t n_203572 = futhark_mc_task_236844->free_n_203572;
    int64_t gtid_215930 = futhark_mc_task_236844->free_gtid_215930;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236844->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock ext_mem_220994 = {.desc ="ext_mem_220994", .mem =
                                      futhark_mc_task_236844->free_ext_mem_220994,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220995 = {.desc ="ext_mem_220995", .mem =
                                      futhark_mc_task_236844->free_ext_mem_220995,
                                      .size =0, .references =NULL};
    int64_t ext_221006 = futhark_mc_task_236844->free_ext_221006;
    struct memblock mem_221031 = {.desc ="mem_221031", .mem =
                                  futhark_mc_task_236844->free_mem_221031,
                                  .size =0, .references =NULL};
    int64_t iter_235536;
    struct futhark_mc_segmap_parloop_struct_236846
    futhark_mc_segmap_parloop_struct_236846;
    
    futhark_mc_segmap_parloop_struct_236846.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236846.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236846.free_gtid_215930 = gtid_215930;
    futhark_mc_segmap_parloop_struct_236846.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236846.free_ext_mem_220994 =
        ext_mem_220994.mem;
    futhark_mc_segmap_parloop_struct_236846.free_ext_mem_220995 =
        ext_mem_220995.mem;
    futhark_mc_segmap_parloop_struct_236846.free_ext_221006 = ext_221006;
    futhark_mc_segmap_parloop_struct_236846.free_mem_221031 = mem_221031.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236847_task;
    
    futhark_mc_segmap_parloop_236847_task.name =
        "futhark_mc_segmap_parloop_236847";
    futhark_mc_segmap_parloop_236847_task.fn = futhark_mc_segmap_parloop_236847;
    futhark_mc_segmap_parloop_236847_task.args =
        &futhark_mc_segmap_parloop_struct_236846;
    futhark_mc_segmap_parloop_236847_task.iterations = iterations;
    futhark_mc_segmap_parloop_236847_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236847_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236847_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236847_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236847_task);
    
    if (futhark_mc_segmap_parloop_236847_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236847_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236847_total_end -
                 futhark_mc_segmap_parloop_236847_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236847_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236847_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236847_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236845_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236845_end -
                 futhark_mc_segmap_task_236845_start;
        
        ctx->futhark_mc_segmap_task_236845_runs[tid]++;
        ctx->futhark_mc_segmap_task_236845_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236845_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_236842(void *args, int64_t start,
                                            int64_t end, int flat_tid_215929,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_236841
    *futhark_mc_segmap_parloop_struct_236841 =
    (struct futhark_mc_segmap_parloop_struct_236841 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_236841->ctx;
    uint64_t futhark_mc_segmap_parloop_236842_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236842_start = get_wall_time();
    
    int64_t m_203571 = futhark_mc_segmap_parloop_struct_236841->free_m_203571;
    int64_t n_203572 = futhark_mc_segmap_parloop_struct_236841->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_segmap_parloop_struct_236841->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_segmap_parloop_struct_236841->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_217418 = {.desc ="mem_217418", .mem =
                                  futhark_mc_segmap_parloop_struct_236841->free_mem_217418,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 =
            futhark_mc_segmap_parloop_struct_236841->free_bytes_217420;
    struct memblock ext_mem_220994 = {.desc ="ext_mem_220994", .mem =
                                      futhark_mc_segmap_parloop_struct_236841->free_ext_mem_220994,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220995 = {.desc ="ext_mem_220995", .mem =
                                      futhark_mc_segmap_parloop_struct_236841->free_ext_mem_220995,
                                      .size =0, .references =NULL};
    int64_t ext_221006 =
            futhark_mc_segmap_parloop_struct_236841->free_ext_221006;
    struct memblock mem_221020 = {.desc ="mem_221020", .mem =
                                  futhark_mc_segmap_parloop_struct_236841->free_mem_221020,
                                  .size =0, .references =NULL};
    struct memblock mem_221024 = {.desc ="mem_221024", .mem =
                                  futhark_mc_segmap_parloop_struct_236841->free_mem_221024,
                                  .size =0, .references =NULL};
    struct memblock mem_221028 = {.desc ="mem_221028", .mem =
                                  futhark_mc_segmap_parloop_struct_236841->free_mem_221028,
                                  .size =0, .references =NULL};
    size_t mem_221031_cached_sizze_236843 = 0;
    unsigned char *mem_221031 = NULL;
    int64_t iterations = end - start;
    int64_t iter_235525 = start;
    
    if (mem_221031_cached_sizze_236843 < (size_t) bytes_217420) {
        mem_221031 = realloc(mem_221031, bytes_217420);
        mem_221031_cached_sizze_236843 = bytes_217420;
    }
    for (; iter_235525 < end; iter_235525++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_235533 = partition_sizze_203667;
        int64_t gtid_215930 = iter_235525;
        int64_t remnant_235534 = iter_235525 - gtid_215930;
        int64_t write_index_206943;
        
        write_index_206943 = ((int64_t *) mem_217418.mem)[gtid_215930];
        
        int64_t flat_tid_235526 = (int64_t) 0;
        int32_t num_tasks_235535;
        struct futhark_mc_task_236844 futhark_mc_task_236844;
        
        futhark_mc_task_236844.ctx = ctx;
        futhark_mc_task_236844.free_n_203572 = n_203572;
        futhark_mc_task_236844.free_gtid_215930 = gtid_215930;
        futhark_mc_task_236844.free_mem_217415 = mem_217415.mem;
        futhark_mc_task_236844.free_ext_mem_220994 = ext_mem_220994.mem;
        futhark_mc_task_236844.free_ext_mem_220995 = ext_mem_220995.mem;
        futhark_mc_task_236844.free_ext_221006 = ext_221006;
        futhark_mc_task_236844.free_mem_221031 = mem_221031;
        
        struct scheduler_segop futhark_mc_task_236844_task;
        
        futhark_mc_task_236844_task.args = &futhark_mc_task_236844;
        futhark_mc_task_236844_task.top_level_fn =
            futhark_mc_segmap_task_236845;
        futhark_mc_task_236844_task.name = "futhark_mc_segmap_task_236845";
        futhark_mc_task_236844_task.iterations = n_203572;
        futhark_mc_task_236844_task.task_time =
            &ctx->futhark_mc_segmap_task_236845_total_time;
        futhark_mc_task_236844_task.task_iter =
            &ctx->futhark_mc_segmap_task_236845_total_iter;
        futhark_mc_task_236844_task.sched = STATIC;
        futhark_mc_task_236844_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_236845_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_236844_task);
        
        if (futhark_mc_segmap_task_236845_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (sle64((int64_t) 0, write_index_206943) && slt64(write_index_206943,
                                                            m_203571)) {
            if (n_203572 * (int64_t) 8 > 0)
                memmove(mem_221028.mem + write_index_206943 * n_203572 *
                        (int64_t) 8, mem_221031 + (int64_t) 0, n_203572 *
                        (int64_t) 8);
        }
        if (sle64((int64_t) 0, write_index_206943) && slt64(write_index_206943,
                                                            m_203571)) {
            if (n_203572 * (int64_t) 8 > 0)
                memmove(mem_221024.mem + write_index_206943 * n_203572 *
                        (int64_t) 8, ext_mem_220994.mem + gtid_215930 *
                        ext_221006 * (int64_t) 8, n_203572 * (int64_t) 8);
        }
        if (sle64((int64_t) 0, write_index_206943) && slt64(write_index_206943,
                                                            m_203571)) {
            if (n_203572 * (int64_t) 8 > 0)
                memmove(mem_221020.mem + write_index_206943 * n_203572 *
                        (int64_t) 8, ext_mem_220995.mem + gtid_215930 *
                        n_203572 * (int64_t) 8, n_203572 * (int64_t) 8);
        }
    }
    
  cleanup:
    { }
    free(mem_221031);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236842_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236842_end -
                 futhark_mc_segmap_parloop_236842_start;
        
        ctx->futhark_mc_segmap_parloop_236842_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_236842_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_236842_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_236840(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_215929 = tid;
    int num_tasks_235524 = info.nsubtasks;
    struct futhark_mc_task_236839 *futhark_mc_task_236839 =
                                  (struct futhark_mc_task_236839 *) args;
    struct futhark_context *ctx = futhark_mc_task_236839->ctx;
    uint64_t futhark_mc_segmap_task_236840_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_236840_start = get_wall_time();
    
    int64_t m_203571 = futhark_mc_task_236839->free_m_203571;
    int64_t n_203572 = futhark_mc_task_236839->free_n_203572;
    int64_t partition_sizze_203667 =
            futhark_mc_task_236839->free_partition_sizze_203667;
    struct memblock mem_217415 = {.desc ="mem_217415", .mem =
                                  futhark_mc_task_236839->free_mem_217415,
                                  .size =0, .references =NULL};
    struct memblock mem_217418 = {.desc ="mem_217418", .mem =
                                  futhark_mc_task_236839->free_mem_217418,
                                  .size =0, .references =NULL};
    int64_t bytes_217420 = futhark_mc_task_236839->free_bytes_217420;
    struct memblock ext_mem_220994 = {.desc ="ext_mem_220994", .mem =
                                      futhark_mc_task_236839->free_ext_mem_220994,
                                      .size =0, .references =NULL};
    struct memblock ext_mem_220995 = {.desc ="ext_mem_220995", .mem =
                                      futhark_mc_task_236839->free_ext_mem_220995,
                                      .size =0, .references =NULL};
    int64_t ext_221006 = futhark_mc_task_236839->free_ext_221006;
    struct memblock mem_221020 = {.desc ="mem_221020", .mem =
                                  futhark_mc_task_236839->free_mem_221020,
                                  .size =0, .references =NULL};
    struct memblock mem_221024 = {.desc ="mem_221024", .mem =
                                  futhark_mc_task_236839->free_mem_221024,
                                  .size =0, .references =NULL};
    struct memblock mem_221028 = {.desc ="mem_221028", .mem =
                                  futhark_mc_task_236839->free_mem_221028,
                                  .size =0, .references =NULL};
    int64_t iter_235525;
    struct futhark_mc_segmap_parloop_struct_236841
    futhark_mc_segmap_parloop_struct_236841;
    
    futhark_mc_segmap_parloop_struct_236841.ctx = ctx;
    futhark_mc_segmap_parloop_struct_236841.free_m_203571 = m_203571;
    futhark_mc_segmap_parloop_struct_236841.free_n_203572 = n_203572;
    futhark_mc_segmap_parloop_struct_236841.free_partition_sizze_203667 =
        partition_sizze_203667;
    futhark_mc_segmap_parloop_struct_236841.free_mem_217415 = mem_217415.mem;
    futhark_mc_segmap_parloop_struct_236841.free_mem_217418 = mem_217418.mem;
    futhark_mc_segmap_parloop_struct_236841.free_bytes_217420 = bytes_217420;
    futhark_mc_segmap_parloop_struct_236841.free_ext_mem_220994 =
        ext_mem_220994.mem;
    futhark_mc_segmap_parloop_struct_236841.free_ext_mem_220995 =
        ext_mem_220995.mem;
    futhark_mc_segmap_parloop_struct_236841.free_ext_221006 = ext_221006;
    futhark_mc_segmap_parloop_struct_236841.free_mem_221020 = mem_221020.mem;
    futhark_mc_segmap_parloop_struct_236841.free_mem_221024 = mem_221024.mem;
    futhark_mc_segmap_parloop_struct_236841.free_mem_221028 = mem_221028.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_236842_task;
    
    futhark_mc_segmap_parloop_236842_task.name =
        "futhark_mc_segmap_parloop_236842";
    futhark_mc_segmap_parloop_236842_task.fn = futhark_mc_segmap_parloop_236842;
    futhark_mc_segmap_parloop_236842_task.args =
        &futhark_mc_segmap_parloop_struct_236841;
    futhark_mc_segmap_parloop_236842_task.iterations = iterations;
    futhark_mc_segmap_parloop_236842_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_236842_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_236842_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_236842_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_236842_task);
    
    if (futhark_mc_segmap_parloop_236842_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_236842_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_236842_total_end -
                 futhark_mc_segmap_parloop_236842_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236842_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236842_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_236842_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_236840_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_236840_end -
                 futhark_mc_segmap_task_236840_start;
        
        ctx->futhark_mc_segmap_task_236840_runs[tid]++;
        ctx->futhark_mc_segmap_task_236840_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_236840_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_235539,
                             struct memblock *mem_out_p_235540,
                             struct memblock *mem_out_p_235541,
                             struct memblock Y_mem_217387, int64_t m_203571,
                             int64_t n_203572, int64_t n_p_203574,
                             int64_t q_s_203575, int64_t q_t_203576,
                             int64_t q_l_203577, int64_t d_s_203578,
                             int64_t d_t_203579, int64_t d_l_203580,
                             int64_t jump_s_203581, int64_t jump_t_203582,
                             int64_t jump_l_203583, int64_t n_inner_203584,
                             int64_t n_outer_203585,
                             int64_t jump_threshold_203586,
                             int64_t q_threshold_203587)
{
    (void) ctx;
    
    int err = 0;
    size_t mem_217406_cached_sizze_235542 = 0;
    unsigned char *mem_217406 = NULL;
    size_t mem_217409_cached_sizze_235543 = 0;
    unsigned char *mem_217409 = NULL;
    size_t mem_217411_cached_sizze_235544 = 0;
    unsigned char *mem_217411 = NULL;
    size_t mem_217415_cached_sizze_235545 = 0;
    unsigned char *mem_217415 = NULL;
    size_t mem_217418_cached_sizze_235546 = 0;
    unsigned char *mem_217418 = NULL;
    size_t mem_217458_cached_sizze_235547 = 0;
    unsigned char *mem_217458 = NULL;
    size_t mem_217461_cached_sizze_235548 = 0;
    unsigned char *mem_217461 = NULL;
    size_t mem_217532_cached_sizze_235549 = 0;
    unsigned char *mem_217532 = NULL;
    size_t mem_217654_cached_sizze_235550 = 0;
    unsigned char *mem_217654 = NULL;
    size_t mem_217658_cached_sizze_235551 = 0;
    unsigned char *mem_217658 = NULL;
    size_t mem_217828_cached_sizze_235552 = 0;
    unsigned char *mem_217828 = NULL;
    size_t mem_217833_cached_sizze_235553 = 0;
    unsigned char *mem_217833 = NULL;
    size_t mem_217891_cached_sizze_235554 = 0;
    unsigned char *mem_217891 = NULL;
    size_t mem_217895_cached_sizze_235555 = 0;
    unsigned char *mem_217895 = NULL;
    size_t mem_217953_cached_sizze_235556 = 0;
    unsigned char *mem_217953 = NULL;
    size_t mem_217957_cached_sizze_235557 = 0;
    unsigned char *mem_217957 = NULL;
    size_t mem_218033_cached_sizze_235558 = 0;
    unsigned char *mem_218033 = NULL;
    size_t mem_218170_cached_sizze_235559 = 0;
    unsigned char *mem_218170 = NULL;
    size_t mem_218175_cached_sizze_235560 = 0;
    unsigned char *mem_218175 = NULL;
    size_t mem_219336_cached_sizze_235561 = 0;
    unsigned char *mem_219336 = NULL;
    size_t mem_219339_cached_sizze_235562 = 0;
    unsigned char *mem_219339 = NULL;
    size_t mem_219361_cached_sizze_235563 = 0;
    unsigned char *mem_219361 = NULL;
    size_t mem_219364_cached_sizze_235564 = 0;
    unsigned char *mem_219364 = NULL;
    size_t mem_219386_cached_sizze_235565 = 0;
    unsigned char *mem_219386 = NULL;
    size_t mem_219389_cached_sizze_235566 = 0;
    unsigned char *mem_219389 = NULL;
    size_t mem_219411_cached_sizze_235567 = 0;
    unsigned char *mem_219411 = NULL;
    size_t mem_220803_cached_sizze_235568 = 0;
    unsigned char *mem_220803 = NULL;
    size_t mem_220807_cached_sizze_235569 = 0;
    unsigned char *mem_220807 = NULL;
    size_t mem_220953_cached_sizze_235570 = 0;
    unsigned char *mem_220953 = NULL;
    size_t mem_220956_cached_sizze_235571 = 0;
    unsigned char *mem_220956 = NULL;
    size_t mem_220959_cached_sizze_235572 = 0;
    unsigned char *mem_220959 = NULL;
    size_t mem_220962_cached_sizze_235573 = 0;
    unsigned char *mem_220962 = NULL;
    struct memblock mem_out_221148;
    
    mem_out_221148.references = NULL;
    
    struct memblock mem_out_221149;
    
    mem_out_221149.references = NULL;
    
    struct memblock mem_out_221150;
    
    mem_out_221150.references = NULL;
    
    double i64_res_203588 = sitofp_i64_f64(n_203572);
    double i64_res_203589 = sitofp_i64_f64(n_p_203574);
    double ceil_arg_203590 = i64_res_203588 / i64_res_203589;
    double ceil_res_203591;
    
    ceil_res_203591 = futrts_ceil64(ceil_arg_203590);
    
    int64_t defunc_0_f_res_203592 = fptosi_f64_i64(ceil_res_203591);
    bool bounds_invalid_upwards_203593 = slt64(n_p_203574, (int64_t) 0);
    bool valid_203594 = !bounds_invalid_upwards_203593;
    bool range_valid_c_203595;
    
    if (!valid_203594) {
        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_203574, " 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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_203597 = slt64(defunc_0_f_res_203592,
                                               (int64_t) 0);
    bool valid_203598 = !bounds_invalid_upwards_203597;
    bool range_valid_c_203599;
    
    if (!valid_203598) {
        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_203592,
                               " 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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t binop_y_217404 = (int64_t) 8 * m_203571;
    int64_t bytes_217405 = smax64((int64_t) 0, binop_y_217404);
    
    if (mem_217406_cached_sizze_235542 < (size_t) bytes_217405) {
        mem_217406 = realloc(mem_217406, bytes_217405);
        mem_217406_cached_sizze_235542 = bytes_217405;
    }
    if (mem_217409_cached_sizze_235543 < (size_t) bytes_217405) {
        mem_217409 = realloc(mem_217409, bytes_217405);
        mem_217409_cached_sizze_235543 = bytes_217405;
    }
    
    int64_t bytes_217410 = smax64((int64_t) 0, m_203571);
    
    if (mem_217411_cached_sizze_235544 < (size_t) bytes_217410) {
        mem_217411 = realloc(mem_217411, bytes_217410);
        mem_217411_cached_sizze_235544 = bytes_217410;
    }
    
    int64_t bytes_217388 = smax64((int64_t) 0, defunc_0_f_res_203592);
    int64_t flat_tid_206950 = (int64_t) 0;
    int32_t num_tasks_221151;
    
    if (ctx->debugging)
        fprintf(ctx->log, "%s\n", "nonsegmented segScan");
    
    struct futhark_mc_task_235574 futhark_mc_task_235574;
    
    futhark_mc_task_235574.ctx = ctx;
    futhark_mc_task_235574.free_m_203571 = m_203571;
    futhark_mc_task_235574.free_n_203572 = n_203572;
    futhark_mc_task_235574.free_n_p_203574 = n_p_203574;
    futhark_mc_task_235574.free_defunc_0_f_res_203592 = defunc_0_f_res_203592;
    futhark_mc_task_235574.free_Y_mem_217387 = Y_mem_217387.mem;
    futhark_mc_task_235574.free_bytes_217388 = bytes_217388;
    futhark_mc_task_235574.free_mem_217406 = mem_217406;
    futhark_mc_task_235574.free_mem_217409 = mem_217409;
    futhark_mc_task_235574.free_mem_217411 = mem_217411;
    
    struct scheduler_segop futhark_mc_task_235574_task;
    
    futhark_mc_task_235574_task.args = &futhark_mc_task_235574;
    futhark_mc_task_235574_task.top_level_fn = futhark_mc_segscan_task_235575;
    futhark_mc_task_235574_task.name = "futhark_mc_segscan_task_235575";
    futhark_mc_task_235574_task.iterations = m_203571;
    futhark_mc_task_235574_task.task_time =
        &ctx->futhark_mc_segscan_task_235575_total_time;
    futhark_mc_task_235574_task.task_iter =
        &ctx->futhark_mc_segscan_task_235575_total_iter;
    futhark_mc_task_235574_task.sched = STATIC;
    futhark_mc_task_235574_task.nested_fn = NULL;
    
    int futhark_mc_segscan_task_235575_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235574_task);
    
    if (futhark_mc_segscan_task_235575_err != 0) {
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t last_index_203665 = m_203571 - (int64_t) 1;
    bool is_empty_203666 = m_203571 == (int64_t) 0;
    int64_t partition_sizze_203667;
    
    if (is_empty_203666) {
        partition_sizze_203667 = (int64_t) 0;
    } else {
        int64_t last_offset_203668;
        
        last_offset_203668 = ((int64_t *) mem_217406)[last_index_203665];
        partition_sizze_203667 = last_offset_203668;
    }
    
    int64_t binop_x_217412 = m_203571 * n_203572;
    int64_t binop_y_217413 = (int64_t) 8 * binop_x_217412;
    int64_t bytes_217414 = smax64((int64_t) 0, binop_y_217413);
    
    if (mem_217415_cached_sizze_235545 < (size_t) bytes_217414) {
        mem_217415 = realloc(mem_217415, bytes_217414);
        mem_217415_cached_sizze_235545 = bytes_217414;
    }
    if (mem_217418_cached_sizze_235546 < (size_t) bytes_217405) {
        mem_217418 = realloc(mem_217418, bytes_217405);
        mem_217418_cached_sizze_235546 = bytes_217405;
    }
    
    int64_t flat_tid_206988 = (int64_t) 0;
    int32_t num_tasks_221291;
    struct futhark_mc_task_235641 futhark_mc_task_235641;
    
    futhark_mc_task_235641.ctx = ctx;
    futhark_mc_task_235641.free_m_203571 = m_203571;
    futhark_mc_task_235641.free_n_203572 = n_203572;
    futhark_mc_task_235641.free_Y_mem_217387 = Y_mem_217387.mem;
    futhark_mc_task_235641.free_mem_217406 = mem_217406;
    futhark_mc_task_235641.free_mem_217409 = mem_217409;
    futhark_mc_task_235641.free_mem_217415 = mem_217415;
    futhark_mc_task_235641.free_mem_217418 = mem_217418;
    
    struct scheduler_segop futhark_mc_task_235641_task;
    
    futhark_mc_task_235641_task.args = &futhark_mc_task_235641;
    futhark_mc_task_235641_task.top_level_fn = futhark_mc_segmap_task_235642;
    futhark_mc_task_235641_task.name = "futhark_mc_segmap_task_235642";
    futhark_mc_task_235641_task.iterations = m_203571;
    futhark_mc_task_235641_task.task_time =
        &ctx->futhark_mc_segmap_task_235642_total_time;
    futhark_mc_task_235641_task.task_iter =
        &ctx->futhark_mc_segmap_task_235642_total_iter;
    futhark_mc_task_235641_task.sched = STATIC;
    futhark_mc_task_235641_task.nested_fn = NULL;
    
    int futhark_mc_segmap_task_235642_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235641_task);
    
    if (futhark_mc_segmap_task_235642_err != 0) {
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    bool empty_slice_203681 = partition_sizze_203667 == (int64_t) 0;
    int64_t m_203682 = sub64(partition_sizze_203667, (int64_t) 1);
    bool zzero_leq_i_p_m_t_s_203683 = sle64((int64_t) 0, m_203682);
    bool i_p_m_t_s_leq_w_203684 = slt64(m_203682, m_203571);
    bool i_lte_j_203685 = sle64((int64_t) 0, partition_sizze_203667);
    bool y_203686 = zzero_leq_i_p_m_t_s_203683 && i_p_m_t_s_leq_w_203684;
    bool y_203687 = i_lte_j_203685 && y_203686;
    bool ok_or_empty_203688 = empty_slice_203681 || y_203687;
    bool index_certs_203689;
    
    if (!ok_or_empty_203688) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", (long long) partition_sizze_203667,
                               "] out of bounds for array of shape [",
                               (long long) m_203571, "].",
                               "-> #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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203692 = sle64((int64_t) 4, n_p_203574);
    bool assert_c_203693;
    
    if (!assert_cond_203692) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t x_203694 = smod64(q_t_203576, (int64_t) 2);
    bool assert_cond_203695 = x_203694 == (int64_t) 1;
    bool assert_c_203696;
    
    if (!assert_cond_203695) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203697 = slt64((int64_t) 0, q_t_203576);
    bool assert_c_203698;
    
    if (!assert_cond_203697) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t x_203699 = smod64(q_l_203577, (int64_t) 2);
    bool assert_cond_203700 = x_203699 == (int64_t) 1;
    bool assert_c_203701;
    
    if (!assert_cond_203700) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203702 = slt64((int64_t) 0, q_l_203577);
    bool assert_c_203703;
    
    if (!assert_cond_203702) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool cond_203704 = sle64((int64_t) 0, d_t_203579);
    bool assert_cond_t_res_203705 = sle64(d_t_203579, (int64_t) 2);
    bool x_203706 = cond_203704 && assert_cond_t_res_203705;
    bool assert_c_203707;
    
    if (!x_203706) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool cond_203708 = sle64((int64_t) 0, d_l_203580);
    bool assert_cond_t_res_203709 = sle64(d_l_203580, (int64_t) 2);
    bool x_203710 = cond_203708 && assert_cond_t_res_203709;
    bool assert_c_203711;
    
    if (!x_203710) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203712 = slt64((int64_t) 0, jump_t_203582);
    bool assert_c_203713;
    
    if (!assert_cond_203712) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203714 = slt64((int64_t) 0, jump_l_203583);
    bool assert_c_203715;
    
    if (!assert_cond_203714) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203716 = slt64((int64_t) 0, n_inner_203584);
    bool assert_c_203717;
    
    if (!assert_cond_203716) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool assert_cond_203718 = slt64((int64_t) 0, n_outer_203585);
    bool assert_c_203719;
    
    if (!assert_cond_203718) {
        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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    double ceil_res_203720;
    
    ceil_res_203720 = futrts_ceil64(ceil_arg_203590);
    
    int64_t defunc_0_f_res_203721 = fptosi_f64_i64(ceil_res_203720);
    int64_t pad_css_len_203722 = add64((int64_t) 2, defunc_0_f_res_203721);
    int64_t y_203723 = mul64((int64_t) 2, n_p_203574);
    int64_t C_len_203724 = add64(n_203572, y_203723);
    bool cond_203725 = jump_s_203581 == (int64_t) 1;
    int64_t s_n_m_203726;
    
    if (cond_203725) {
        s_n_m_203726 = pad_css_len_203722;
    } else {
        bool zzero_203727 = jump_s_203581 == (int64_t) 0;
        bool nonzzero_203728 = !zzero_203727;
        bool nonzzero_cert_203729;
        
        if (!nonzzero_203728) {
            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_221150, "mem_out_221150") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t x_203730 = sdiv64(defunc_0_f_res_203721, jump_s_203581);
        int64_t s_n_m_f_res_203731 = add64((int64_t) 3, x_203730);
        
        s_n_m_203726 = s_n_m_f_res_203731;
    }
    
    bool cond_203732 = jump_l_203583 == (int64_t) 1;
    int64_t l_n_m_203733;
    
    if (cond_203732) {
        l_n_m_203733 = n_203572;
    } else {
        bool zzero_203734 = jump_l_203583 == (int64_t) 0;
        bool nonzzero_203735 = !zzero_203734;
        bool nonzzero_cert_203736;
        
        if (!nonzzero_203735) {
            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_221150, "mem_out_221150") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t x_203737 = sdiv64(n_203572, jump_l_203583);
        int64_t l_n_m_f_res_203738 = add64((int64_t) 1, x_203737);
        
        l_n_m_203733 = l_n_m_f_res_203738;
    }
    
    bool cond_203739 = jump_t_203582 == (int64_t) 1;
    int64_t t_n_m_203740;
    
    if (cond_203739) {
        t_n_m_203740 = n_203572;
    } else {
        bool zzero_203741 = jump_t_203582 == (int64_t) 0;
        bool nonzzero_203742 = !zzero_203741;
        bool nonzzero_cert_203743;
        
        if (!nonzzero_203742) {
            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_221150, "mem_out_221150") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t x_203744 = sdiv64(n_203572, jump_t_203582);
        int64_t t_n_m_f_res_203745 = add64((int64_t) 1, x_203744);
        
        t_n_m_203740 = t_n_m_f_res_203745;
    }
    
    double x_203746 = i64_res_203588 / 2.0;
    double floor_arg_203747 = 1.0 + x_203746;
    double floor_res_203748;
    
    floor_res_203748 = futrts_floor64(floor_arg_203747);
    
    int64_t defunc_0_f_res_203749 = fptosi_f64_i64(floor_res_203748);
    int64_t x_203750 = sub64(n_203572, defunc_0_f_res_203749);
    int64_t mid2_203751 = add64((int64_t) 1, x_203750);
    bool cond_203752 = defunc_0_f_res_203749 == mid2_203751;
    int64_t stl_res_t_res_203753 = sub64(defunc_0_f_res_203749, (int64_t) 1);
    int64_t stl_res_203754;
    int64_t stl_res_203755;
    
    if (cond_203752) {
        stl_res_203754 = stl_res_t_res_203753;
        stl_res_203755 = defunc_0_f_res_203749;
    } else {
        int64_t min_res_203756 = smin64(defunc_0_f_res_203749, mid2_203751);
        int64_t stl_res_f_res_203757 = sub64(min_res_203756, (int64_t) 1);
        int64_t max_res_203758 = smax64(defunc_0_f_res_203749, mid2_203751);
        
        stl_res_203754 = stl_res_f_res_203757;
        stl_res_203755 = max_res_203758;
    }
    
    int64_t i_203760 = sub64(n_203572, (int64_t) 1);
    bool x_203761 = sle64((int64_t) 0, i_203760);
    bool y_203762 = slt64(i_203760, n_203572);
    bool bounds_check_203763 = x_203761 && y_203762;
    bool index_certs_203764;
    
    if (!bounds_check_203763) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", (long long) i_203760,
                               "] out of bounds for array of shape [",
                               (long long) n_203572, "].",
                               "-> #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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t binop_x_217455 = n_203572 * partition_sizze_203667;
    int64_t binop_y_217456 = (int64_t) 8 * binop_x_217455;
    int64_t bytes_217457 = smax64((int64_t) 0, binop_y_217456);
    
    if (mem_217458_cached_sizze_235547 < (size_t) bytes_217457) {
        mem_217458 = realloc(mem_217458, bytes_217457);
        mem_217458_cached_sizze_235547 = bytes_217457;
    }
    
    int64_t binop_y_217459 = (int64_t) 8 * partition_sizze_203667;
    int64_t bytes_217460 = smax64((int64_t) 0, binop_y_217459);
    
    if (mem_217461_cached_sizze_235548 < (size_t) bytes_217460) {
        mem_217461 = realloc(mem_217461, bytes_217460);
        mem_217461_cached_sizze_235548 = bytes_217460;
    }
    
    int64_t binop_y_217419 = (int64_t) 8 * n_203572;
    int64_t bytes_217420 = smax64((int64_t) 0, binop_y_217419);
    int64_t flat_tid_206990 = (int64_t) 0;
    int32_t num_tasks_221295;
    int64_t flat_tid_206998 = (int64_t) 0;
    struct futhark_mc_task_235645 futhark_mc_task_235645;
    
    futhark_mc_task_235645.ctx = ctx;
    futhark_mc_task_235645.free_n_203572 = n_203572;
    futhark_mc_task_235645.free_partition_sizze_203667 = partition_sizze_203667;
    futhark_mc_task_235645.free_i_203760 = i_203760;
    futhark_mc_task_235645.free_mem_217415 = mem_217415;
    futhark_mc_task_235645.free_bytes_217420 = bytes_217420;
    futhark_mc_task_235645.free_mem_217458 = mem_217458;
    futhark_mc_task_235645.free_mem_217461 = mem_217461;
    
    struct scheduler_segop futhark_mc_task_235645_task;
    
    futhark_mc_task_235645_task.args = &futhark_mc_task_235645;
    futhark_mc_task_235645_task.top_level_fn = futhark_mc_segmap_task_235646;
    futhark_mc_task_235645_task.name = "futhark_mc_segmap_task_235646";
    futhark_mc_task_235645_task.iterations = partition_sizze_203667;
    futhark_mc_task_235645_task.task_time =
        &ctx->futhark_mc_segmap_task_235646_total_time;
    futhark_mc_task_235645_task.task_iter =
        &ctx->futhark_mc_segmap_task_235646_total_iter;
    futhark_mc_task_235645_task.sched = STATIC;
    futhark_mc_task_235645_task.nested_fn =
        futhark_mc_segmap_nested_task_235651;
    
    int futhark_mc_segmap_task_235646_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235645_task);
    
    if (futhark_mc_segmap_task_235646_err != 0) {
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_203788 = slt64(defunc_0_f_res_203721,
                                               (int64_t) 0);
    bool valid_203789 = !bounds_invalid_upwards_203788;
    bool range_valid_c_203790;
    
    if (!valid_203789) {
        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_203721,
                               " 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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t binop_x_217528 = n_p_203574 * partition_sizze_203667;
    int64_t binop_x_217529 = defunc_0_f_res_203721 * binop_x_217528;
    int64_t binop_y_217530 = (int64_t) 8 * binop_x_217529;
    int64_t bytes_217531 = smax64((int64_t) 0, binop_y_217530);
    
    if (mem_217532_cached_sizze_235549 < (size_t) bytes_217531) {
        mem_217532 = realloc(mem_217532, bytes_217531);
        mem_217532_cached_sizze_235549 = bytes_217531;
    }
    
    int64_t binop_x_217480 = n_p_203574 * defunc_0_f_res_203721;
    int64_t binop_y_217481 = (int64_t) 8 * binop_x_217480;
    int64_t bytes_217482 = smax64((int64_t) 0, binop_y_217481);
    int64_t binop_y_217462 = (int64_t) 8 * defunc_0_f_res_203721;
    int64_t bytes_217463 = smax64((int64_t) 0, binop_y_217462);
    int64_t flat_tid_207023 = (int64_t) 0;
    int32_t num_tasks_221362;
    int64_t flat_tid_207049 = (int64_t) 0;
    struct futhark_mc_task_235667 futhark_mc_task_235667;
    
    futhark_mc_task_235667.ctx = ctx;
    futhark_mc_task_235667.free_n_203572 = n_203572;
    futhark_mc_task_235667.free_n_p_203574 = n_p_203574;
    futhark_mc_task_235667.free_partition_sizze_203667 = partition_sizze_203667;
    futhark_mc_task_235667.free_defunc_0_f_res_203721 = defunc_0_f_res_203721;
    futhark_mc_task_235667.free_i_203760 = i_203760;
    futhark_mc_task_235667.free_mem_217415 = mem_217415;
    futhark_mc_task_235667.free_bytes_217463 = bytes_217463;
    futhark_mc_task_235667.free_bytes_217482 = bytes_217482;
    futhark_mc_task_235667.free_mem_217532 = mem_217532;
    
    struct scheduler_segop futhark_mc_task_235667_task;
    
    futhark_mc_task_235667_task.args = &futhark_mc_task_235667;
    futhark_mc_task_235667_task.top_level_fn = futhark_mc_segmap_task_235668;
    futhark_mc_task_235667_task.name = "futhark_mc_segmap_task_235668";
    futhark_mc_task_235667_task.iterations = partition_sizze_203667;
    futhark_mc_task_235667_task.task_time =
        &ctx->futhark_mc_segmap_task_235668_total_time;
    futhark_mc_task_235667_task.task_iter =
        &ctx->futhark_mc_segmap_task_235668_total_iter;
    futhark_mc_task_235667_task.sched = STATIC;
    futhark_mc_task_235667_task.nested_fn =
        futhark_mc_segmap_nested_task_235672;
    
    int futhark_mc_segmap_task_235668_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235667_task);
    
    if (futhark_mc_segmap_task_235668_err != 0) {
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t i_203808 = sub64(defunc_0_f_res_203721, (int64_t) 1);
    bool x_203809 = sle64((int64_t) 0, i_203808);
    bool y_203810 = slt64(i_203808, defunc_0_f_res_203721);
    bool bounds_check_203811 = x_203809 && y_203810;
    bool index_certs_203812;
    
    if (!bounds_check_203811) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", (long long) i_203808,
                               "] out of bounds for array of shape [",
                               (long long) defunc_0_f_res_203721, "].",
                               "-> #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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    if (mem_217654_cached_sizze_235550 < (size_t) bytes_217531) {
        mem_217654 = realloc(mem_217654, bytes_217531);
        mem_217654_cached_sizze_235550 = bytes_217531;
    }
    
    int64_t binop_y_217656 = (int64_t) 8 * binop_x_217528;
    int64_t bytes_217657 = smax64((int64_t) 0, binop_y_217656);
    
    if (mem_217658_cached_sizze_235551 < (size_t) bytes_217657) {
        mem_217658 = realloc(mem_217658, bytes_217657);
        mem_217658_cached_sizze_235551 = bytes_217657;
    }
    
    int64_t binop_y_217573 = (int64_t) 8 * n_p_203574;
    int64_t bytes_217574 = smax64((int64_t) 0, binop_y_217573);
    int64_t flat_tid_207083 = (int64_t) 0;
    int32_t num_tasks_221458;
    int64_t flat_tid_207120 = (int64_t) 0;
    struct futhark_mc_task_235689 futhark_mc_task_235689;
    
    futhark_mc_task_235689.ctx = ctx;
    futhark_mc_task_235689.free_n_p_203574 = n_p_203574;
    futhark_mc_task_235689.free_partition_sizze_203667 = partition_sizze_203667;
    futhark_mc_task_235689.free_defunc_0_f_res_203721 = defunc_0_f_res_203721;
    futhark_mc_task_235689.free_i_203808 = i_203808;
    futhark_mc_task_235689.free_bytes_217463 = bytes_217463;
    futhark_mc_task_235689.free_bytes_217482 = bytes_217482;
    futhark_mc_task_235689.free_mem_217532 = mem_217532;
    futhark_mc_task_235689.free_bytes_217574 = bytes_217574;
    futhark_mc_task_235689.free_mem_217654 = mem_217654;
    futhark_mc_task_235689.free_mem_217658 = mem_217658;
    
    struct scheduler_segop futhark_mc_task_235689_task;
    
    futhark_mc_task_235689_task.args = &futhark_mc_task_235689;
    futhark_mc_task_235689_task.top_level_fn = futhark_mc_segmap_task_235690;
    futhark_mc_task_235689_task.name = "futhark_mc_segmap_task_235690";
    futhark_mc_task_235689_task.iterations = partition_sizze_203667;
    futhark_mc_task_235689_task.task_time =
        &ctx->futhark_mc_segmap_task_235690_total_time;
    futhark_mc_task_235689_task.task_iter =
        &ctx->futhark_mc_segmap_task_235690_total_iter;
    futhark_mc_task_235689_task.sched = STATIC;
    futhark_mc_task_235689_task.nested_fn =
        futhark_mc_segmap_nested_task_235697;
    
    int futhark_mc_segmap_task_235690_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235689_task);
    
    if (futhark_mc_segmap_task_235690_err != 0) {
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_203839 = smin64(q_s_203575, defunc_0_f_res_203721);
    bool bounds_invalid_upwards_203840 = slt64(s_n_m_203726, (int64_t) 0);
    bool valid_203841 = !bounds_invalid_upwards_203840;
    bool range_valid_c_203842;
    
    if (!valid_203841) {
        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_203726, " 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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool loop_cond_203844 = slt64((int64_t) 1, min_res_203839);
    double i64_res_203845 = sitofp_i64_f64(q_s_203575);
    int64_t binop_x_217825 = s_n_m_203726 * binop_x_217528;
    int64_t binop_y_217826 = (int64_t) 8 * binop_x_217825;
    int64_t bytes_217827 = smax64((int64_t) 0, binop_y_217826);
    
    if (mem_217828_cached_sizze_235552 < (size_t) bytes_217827) {
        mem_217828 = realloc(mem_217828, bytes_217827);
        mem_217828_cached_sizze_235552 = bytes_217827;
    }
    if (mem_217833_cached_sizze_235553 < (size_t) bytes_217827) {
        mem_217833 = realloc(mem_217833, bytes_217827);
        mem_217833_cached_sizze_235553 = bytes_217827;
    }
    
    int64_t binop_x_217713 = n_p_203574 * s_n_m_203726;
    int64_t binop_y_217714 = (int64_t) 8 * binop_x_217713;
    int64_t bytes_217715 = smax64((int64_t) 0, binop_y_217714);
    int64_t binop_y_217662 = (int64_t) 8 * s_n_m_203726;
    int64_t bytes_217663 = smax64((int64_t) 0, binop_y_217662);
    int64_t flat_tid_207171 = (int64_t) 0;
    int32_t num_tasks_221619;
    int64_t flat_tid_207306 = (int64_t) 0;
    struct futhark_mc_task_235724 futhark_mc_task_235724;
    
    futhark_mc_task_235724.ctx = ctx;
    futhark_mc_task_235724.free_n_p_203574 = n_p_203574;
    futhark_mc_task_235724.free_q_s_203575 = q_s_203575;
    futhark_mc_task_235724.free_jump_s_203581 = jump_s_203581;
    futhark_mc_task_235724.free_partition_sizze_203667 = partition_sizze_203667;
    futhark_mc_task_235724.free_defunc_0_f_res_203721 = defunc_0_f_res_203721;
    futhark_mc_task_235724.free_pad_css_len_203722 = pad_css_len_203722;
    futhark_mc_task_235724.free_s_n_m_203726 = s_n_m_203726;
    futhark_mc_task_235724.free_i_203808 = i_203808;
    futhark_mc_task_235724.free_x_203809 = x_203809;
    futhark_mc_task_235724.free_min_res_203839 = min_res_203839;
    futhark_mc_task_235724.free_loop_cond_203844 = loop_cond_203844;
    futhark_mc_task_235724.free_i64_res_203845 = i64_res_203845;
    futhark_mc_task_235724.free_bytes_217463 = bytes_217463;
    futhark_mc_task_235724.free_mem_217654 = mem_217654;
    futhark_mc_task_235724.free_mem_217658 = mem_217658;
    futhark_mc_task_235724.free_bytes_217663 = bytes_217663;
    futhark_mc_task_235724.free_bytes_217715 = bytes_217715;
    futhark_mc_task_235724.free_mem_217828 = mem_217828;
    futhark_mc_task_235724.free_mem_217833 = mem_217833;
    
    struct scheduler_segop futhark_mc_task_235724_task;
    
    futhark_mc_task_235724_task.args = &futhark_mc_task_235724;
    futhark_mc_task_235724_task.top_level_fn = futhark_mc_segmap_task_235725;
    futhark_mc_task_235724_task.name = "futhark_mc_segmap_task_235725";
    futhark_mc_task_235724_task.iterations = partition_sizze_203667;
    futhark_mc_task_235724_task.task_time =
        &ctx->futhark_mc_segmap_task_235725_total_time;
    futhark_mc_task_235724_task.task_iter =
        &ctx->futhark_mc_segmap_task_235725_total_iter;
    futhark_mc_task_235724_task.sched = DYNAMIC;
    futhark_mc_task_235724_task.nested_fn =
        futhark_mc_segmap_nested_task_235731;
    
    int futhark_mc_segmap_task_235725_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235724_task);
    
    if (futhark_mc_segmap_task_235725_err != 0) {
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_203971 = smin64(n_203572, q_l_203577);
    bool bounds_invalid_upwards_203972 = slt64(l_n_m_203733, (int64_t) 0);
    bool valid_203973 = !bounds_invalid_upwards_203972;
    bool range_valid_c_203974;
    
    if (!valid_203973) {
        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_203733, " 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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool loop_cond_203976 = slt64((int64_t) 1, min_res_203971);
    double i64_res_203977 = sitofp_i64_f64(q_l_203577);
    int64_t binop_x_217888 = partition_sizze_203667 * l_n_m_203733;
    int64_t binop_y_217889 = (int64_t) 8 * binop_x_217888;
    int64_t bytes_217890 = smax64((int64_t) 0, binop_y_217889);
    
    if (mem_217891_cached_sizze_235554 < (size_t) bytes_217890) {
        mem_217891 = realloc(mem_217891, bytes_217890);
        mem_217891_cached_sizze_235554 = bytes_217890;
    }
    if (mem_217895_cached_sizze_235555 < (size_t) bytes_217890) {
        mem_217895 = realloc(mem_217895, bytes_217890);
        mem_217895_cached_sizze_235555 = bytes_217890;
    }
    
    int64_t binop_y_217837 = (int64_t) 8 * l_n_m_203733;
    int64_t bytes_217838 = smax64((int64_t) 0, binop_y_217837);
    int64_t flat_tid_207554 = (int64_t) 0;
    int32_t num_tasks_222343;
    int64_t flat_tid_207562 = (int64_t) 0;
    struct futhark_mc_task_235757 futhark_mc_task_235757;
    
    futhark_mc_task_235757.ctx = ctx;
    futhark_mc_task_235757.free_n_203572 = n_203572;
    futhark_mc_task_235757.free_q_l_203577 = q_l_203577;
    futhark_mc_task_235757.free_jump_l_203583 = jump_l_203583;
    futhark_mc_task_235757.free_partition_sizze_203667 = partition_sizze_203667;
    futhark_mc_task_235757.free_l_n_m_203733 = l_n_m_203733;
    futhark_mc_task_235757.free_i_203760 = i_203760;
    futhark_mc_task_235757.free_x_203761 = x_203761;
    futhark_mc_task_235757.free_min_res_203971 = min_res_203971;
    futhark_mc_task_235757.free_loop_cond_203976 = loop_cond_203976;
    futhark_mc_task_235757.free_i64_res_203977 = i64_res_203977;
    futhark_mc_task_235757.free_bytes_217420 = bytes_217420;
    futhark_mc_task_235757.free_mem_217458 = mem_217458;
    futhark_mc_task_235757.free_mem_217461 = mem_217461;
    futhark_mc_task_235757.free_bytes_217838 = bytes_217838;
    futhark_mc_task_235757.free_mem_217891 = mem_217891;
    futhark_mc_task_235757.free_mem_217895 = mem_217895;
    
    struct scheduler_segop futhark_mc_task_235757_task;
    
    futhark_mc_task_235757_task.args = &futhark_mc_task_235757;
    futhark_mc_task_235757_task.top_level_fn = futhark_mc_segmap_task_235758;
    futhark_mc_task_235757_task.name = "futhark_mc_segmap_task_235758";
    futhark_mc_task_235757_task.iterations = partition_sizze_203667;
    futhark_mc_task_235757_task.task_time =
        &ctx->futhark_mc_segmap_task_235758_total_time;
    futhark_mc_task_235757_task.task_iter =
        &ctx->futhark_mc_segmap_task_235758_total_iter;
    futhark_mc_task_235757_task.sched = DYNAMIC;
    futhark_mc_task_235757_task.nested_fn =
        futhark_mc_segmap_nested_task_235764;
    
    int futhark_mc_segmap_task_235758_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_235757_task);
    
    if (futhark_mc_segmap_task_235758_err != 0) {
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_204083 = smin64(n_203572, q_t_203576);
    bool bounds_invalid_upwards_204084 = slt64(t_n_m_203740, (int64_t) 0);
    bool valid_204085 = !bounds_invalid_upwards_204084;
    bool range_valid_c_204086;
    
    if (!valid_204085) {
        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_203740, " 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_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool loop_cond_204088 = slt64((int64_t) 1, min_res_204083);
    double i64_res_204089 = sitofp_i64_f64(q_t_203576);
    int64_t binop_x_217950 = partition_sizze_203667 * t_n_m_203740;
    int64_t binop_y_217951 = (int64_t) 8 * binop_x_217950;
    int64_t bytes_217952 = smax64((int64_t) 0, binop_y_217951);
    
    if (mem_217953_cached_sizze_235556 < (size_t) bytes_217952) {
        mem_217953 = realloc(mem_217953, bytes_217952);
        mem_217953_cached_sizze_235556 = bytes_217952;
    }
    if (mem_217957_cached_sizze_235557 < (size_t) bytes_217952) {
        mem_217957 = realloc(mem_217957, bytes_217952);
        mem_217957_cached_sizze_235557 = bytes_217952;
    }
    
    int64_t binop_y_217899 = (int64_t) 8 * t_n_m_203740;
    int64_t bytes_217900 = smax64((int64_t) 0, binop_y_217899);
    int64_t flat_tid_207669 = (int64_t) 0;
    int32_t num_tasks_222618;
    int64_t flat_tid_207677 = (int64_t) 0;
    struct futhark_mc_task_235778 futhark_mc_task_235778;
    
    futhark_mc_task_235778.ctx = ctx;
    futhark_mc_task_235778.free_n_203572 = n_203572;
    futhark_mc_task_235778.free_q_t_203576 = q_t_203576;
    futhark_mc_task_235778.free_jump_t_203582 = jump_t_203582;
    futhark_mc_task_235778.free_partition_sizze_203667 = partition_sizze_203667;
    futhark_mc_task_235778.free_t_n_m_203740 = t_n_m_203740;
    futhark_mc_task_235778.free_i_203760 = i_203760;
    futhark_mc_task_235778.free_x_203761 = x_203761;
    futhark_mc_task_235778.free_min_res_204083 = min_res_204083;
    futhark_mc_task_235778.free_loop_cond_204088 = loop_cond_204088;
    futhark_mc_task_235778.free_i64_res_204089 = i64_res_204089;
    futhark_mc_task_235778.free_bytes_217420 = bytes_217420;
    futhark_mc_task_235778.free_mem_217458 = mem_217458;
    futhark_mc_task_235778.free_mem_217461 = mem_217461;
    futhark_mc_task_235778.free_bytes_217900 = bytes_217900;
    futhark_mc_task_235778.free_mem_217953 = mem_217953;
    futhark_mc_task_235778.free_mem_217957 = mem_217957;
    
    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_203667;
    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 = DYNAMIC;
    futhark_mc_task_235778_task.nested_fn =
        futhark_mc_segmap_nested_task_235785;
    
    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_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    
    struct memblock mem_217961;
    
    mem_217961.references = NULL;
    if (memblock_alloc(ctx, &mem_217961, bytes_217457, "mem_217961")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_222893 = 0; i_222893 < partition_sizze_203667; i_222893++) {
        for (int64_t i_222894 = 0; i_222894 < n_203572; i_222894++) {
            ((double *) mem_217961.mem)[i_222893 * n_203572 + i_222894] = 0.0;
        }
    }
    
    struct memblock mem_217965;
    
    mem_217965.references = NULL;
    if (memblock_alloc(ctx, &mem_217965, bytes_217457, "mem_217965")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_222895 = 0; i_222895 < partition_sizze_203667; i_222895++) {
        for (int64_t i_222896 = 0; i_222896 < n_203572; i_222896++) {
            ((double *) mem_217965.mem)[i_222895 * n_203572 + i_222896] = 1.0;
        }
    }
    
    bool cond_204197 = slt64((int64_t) 1, jump_l_203583);
    bool cond_204198 = slt64((int64_t) 1, jump_t_203582);
    int64_t y_204199 = sub64(n_outer_203585, (int64_t) 1);
    int64_t css_results_l_204200;
    
    if (cond_203725) {
        css_results_l_204200 = s_n_m_203726;
    } else {
        css_results_l_204200 = pad_css_len_203722;
    }
    
    bool zzero_204201 = n_p_203574 == (int64_t) 0;
    bool nonzzero_204202 = !zzero_204201;
    bool loop_not_taken_204203 = !assert_cond_203716;
    bool protect_assert_disj_204204 = nonzzero_204202 || loop_not_taken_204203;
    bool loop_not_taken_204205 = !assert_cond_203718;
    bool protect_assert_disj_204206 = protect_assert_disj_204204 ||
         loop_not_taken_204205;
    bool nonzzero_cert_204207;
    
    if (!protect_assert_disj_204206) {
        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_217965, "mem_217965") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t j_204208 = add64(n_203572, n_p_203574);
    bool empty_slice_204209 = n_203572 == (int64_t) 0;
    int64_t i_p_m_t_s_204210 = add64(n_p_203574, i_203760);
    bool zzero_leq_i_p_m_t_s_204211 = sle64((int64_t) 0, i_p_m_t_s_204210);
    bool i_p_m_t_s_leq_w_204212 = slt64(i_p_m_t_s_204210, C_len_203724);
    bool zzero_lte_i_204213 = sle64((int64_t) 0, n_p_203574);
    bool i_lte_j_204214 = sle64(n_p_203574, j_204208);
    bool y_204215 = i_p_m_t_s_leq_w_204212 && zzero_lte_i_204213;
    bool y_204216 = zzero_leq_i_p_m_t_s_204211 && y_204215;
    bool y_204217 = i_lte_j_204214 && y_204216;
    bool forwards_ok_204218 = zzero_lte_i_204213 && y_204217;
    bool ok_or_empty_204219 = empty_slice_204209 || forwards_ok_204218;
    bool protect_assert_disj_204220 = loop_not_taken_204203 ||
         ok_or_empty_204219;
    bool protect_assert_disj_204221 = loop_not_taken_204205 ||
         protect_assert_disj_204220;
    bool index_certs_204222;
    
    if (!protect_assert_disj_204221) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", (long long) n_p_203574, ":",
                               (long long) j_204208,
                               "] out of bounds for array of shape [",
                               (long long) C_len_203724, "].",
                               "-> #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_217965, "mem_217965") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t j_m_i_204223 = sub64(stl_res_203755, stl_res_203754);
    int64_t lifted_single_ma_l_arg_204224 = add64((int64_t) 1, j_204208);
    int64_t m_204225 = sub64(n_p_203574, (int64_t) 1);
    bool zzero_leq_i_p_m_t_s_204226 = sle64((int64_t) 0, m_204225);
    bool i_p_m_t_s_leq_w_204227 = slt64(m_204225, C_len_203724);
    bool y_204228 = zzero_leq_i_p_m_t_s_204226 && i_p_m_t_s_leq_w_204227;
    bool y_204229 = zzero_lte_i_204213 && y_204228;
    bool ok_or_empty_204230 = zzero_204201 || y_204229;
    bool protect_assert_disj_204231 = loop_not_taken_204203 ||
         ok_or_empty_204230;
    bool protect_assert_disj_204232 = loop_not_taken_204205 ||
         protect_assert_disj_204231;
    bool index_certs_204233;
    
    if (!protect_assert_disj_204232) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", (long long) n_p_203574,
                               "] out of bounds for array of shape [",
                               (long long) C_len_203724, "].",
                               "-> #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_217965, "mem_217965") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t dyn_lifted_single_ma_l_arg_204234 = add64((int64_t) 2, n_203572);
    bool i_p_m_t_s_leq_w_204235 = slt64(m_204225,
                                        lifted_single_ma_l_arg_204224);
    bool y_204236 = zzero_leq_i_p_m_t_s_204226 && i_p_m_t_s_leq_w_204235;
    bool y_204237 = zzero_lte_i_204213 && y_204236;
    bool ok_or_empty_204238 = zzero_204201 || y_204237;
    bool protect_assert_disj_204239 = loop_not_taken_204203 ||
         ok_or_empty_204238;
    bool protect_assert_disj_204240 = loop_not_taken_204205 ||
         protect_assert_disj_204239;
    bool index_certs_204241;
    
    if (!protect_assert_disj_204240) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", (long long) n_p_203574,
                               "] out of bounds for array of shape [",
                               (long long) lifted_single_ma_l_arg_204224, "].",
                               "-> #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_217965, "mem_217965") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool i_p_m_t_s_leq_w_204242 = slt64((int64_t) 2,
                                        dyn_lifted_single_ma_l_arg_204234);
    bool protect_assert_disj_204243 = loop_not_taken_204203 ||
         i_p_m_t_s_leq_w_204242;
    bool protect_assert_disj_204244 = loop_not_taken_204205 ||
         protect_assert_disj_204243;
    bool index_certs_204245;
    
    if (!protect_assert_disj_204244) {
        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_204234,
                               "].",
                               "-> #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_217965, "mem_217965") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool cond_204246 = slt64(jump_l_203583, jump_threshold_203586);
    bool cond_f_res_204247 = slt64(q_threshold_203587, q_l_203577);
    bool x_204248 = !cond_204246;
    bool y_204249 = cond_f_res_204247 && x_204248;
    bool cond_204250 = cond_204246 || y_204249;
    bool cond_204251 = slt64(jump_t_203582, jump_threshold_203586);
    bool cond_f_res_204252 = slt64(q_threshold_203587, q_t_203576);
    bool x_204253 = !cond_204251;
    bool y_204254 = cond_f_res_204252 && x_204253;
    bool cond_204255 = cond_204251 || y_204254;
    bool cond_204256 = slt64(jump_s_203581, jump_threshold_203586);
    bool cond_f_res_204257 = slt64(q_threshold_203587, q_s_203575);
    bool x_204258 = !cond_204256;
    bool y_204259 = cond_f_res_204257 && x_204258;
    bool cond_204260 = cond_204256 || y_204259;
    bool bounds_invalid_upwards_204261 = slt64(C_len_203724, (int64_t) 0);
    bool valid_204262 = !bounds_invalid_upwards_204261;
    bool protect_assert_disj_204263 = loop_not_taken_204203 || valid_204262;
    bool protect_assert_disj_204264 = loop_not_taken_204205 ||
         protect_assert_disj_204263;
    bool range_valid_c_204265;
    
    if (!protect_assert_disj_204264) {
        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_203724, " 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_217965, "mem_217965") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_204267 = slt64(lifted_single_ma_l_arg_204224,
                                               (int64_t) 0);
    bool valid_204268 = !bounds_invalid_upwards_204267;
    bool protect_assert_disj_204269 = loop_not_taken_204203 || valid_204268;
    bool protect_assert_disj_204270 = loop_not_taken_204205 ||
         protect_assert_disj_204269;
    bool range_valid_c_204271;
    
    if (!protect_assert_disj_204270) {
        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_204224,
                               " 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_217965, "mem_217965") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_204273 =
         slt64(dyn_lifted_single_ma_l_arg_204234, (int64_t) 0);
    bool valid_204274 = !bounds_invalid_upwards_204273;
    bool protect_assert_disj_204275 = loop_not_taken_204203 || valid_204274;
    bool protect_assert_disj_204276 = loop_not_taken_204205 ||
         protect_assert_disj_204275;
    bool range_valid_c_204277;
    
    if (!protect_assert_disj_204276) {
        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_204234,
                               " 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_217965, "mem_217965") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    if (mem_218033_cached_sizze_235558 < (size_t) bytes_217457) {
        mem_218033 = realloc(mem_218033, bytes_217457);
        mem_218033_cached_sizze_235558 = bytes_217457;
    }
    if (mem_218170_cached_sizze_235559 < (size_t) bytes_217531) {
        mem_218170 = realloc(mem_218170, bytes_217531);
        mem_218170_cached_sizze_235559 = bytes_217531;
    }
    if (mem_218175_cached_sizze_235560 < (size_t) bytes_217531) {
        mem_218175 = realloc(mem_218175, bytes_217531);
        mem_218175_cached_sizze_235560 = bytes_217531;
    }
    
    int64_t binop_x_219309 = pad_css_len_203722 * binop_x_217528;
    int64_t binop_y_219310 = (int64_t) 8 * binop_x_219309;
    int64_t bytes_219311 = smax64((int64_t) 0, binop_y_219310);
    int64_t binop_x_219333 = partition_sizze_203667 * C_len_203724;
    int64_t binop_y_219334 = (int64_t) 8 * binop_x_219333;
    int64_t bytes_219335 = smax64((int64_t) 0, binop_y_219334);
    
    if (mem_219336_cached_sizze_235561 < (size_t) bytes_219335) {
        mem_219336 = realloc(mem_219336, bytes_219335);
        mem_219336_cached_sizze_235561 = bytes_219335;
    }
    
    int64_t binop_y_219315 = (int64_t) 8 * C_len_203724;
    int64_t bytes_219316 = smax64((int64_t) 0, binop_y_219315);
    
    if (mem_219339_cached_sizze_235562 < (size_t) bytes_217460) {
        mem_219339 = realloc(mem_219339, bytes_217460);
        mem_219339_cached_sizze_235562 = bytes_217460;
    }
    
    int64_t binop_x_219358 = partition_sizze_203667 *
            lifted_single_ma_l_arg_204224;
    int64_t binop_y_219359 = (int64_t) 8 * binop_x_219358;
    int64_t bytes_219360 = smax64((int64_t) 0, binop_y_219359);
    
    if (mem_219361_cached_sizze_235563 < (size_t) bytes_219360) {
        mem_219361 = realloc(mem_219361, bytes_219360);
        mem_219361_cached_sizze_235563 = bytes_219360;
    }
    
    int64_t binop_y_219340 = (int64_t) 8 * lifted_single_ma_l_arg_204224;
    int64_t bytes_219341 = smax64((int64_t) 0, binop_y_219340);
    
    if (mem_219364_cached_sizze_235564 < (size_t) bytes_217460) {
        mem_219364 = realloc(mem_219364, bytes_217460);
        mem_219364_cached_sizze_235564 = bytes_217460;
    }
    
    int64_t binop_x_219383 = partition_sizze_203667 *
            dyn_lifted_single_ma_l_arg_204234;
    int64_t binop_y_219384 = (int64_t) 8 * binop_x_219383;
    int64_t bytes_219385 = smax64((int64_t) 0, binop_y_219384);
    
    if (mem_219386_cached_sizze_235565 < (size_t) bytes_219385) {
        mem_219386 = realloc(mem_219386, bytes_219385);
        mem_219386_cached_sizze_235565 = bytes_219385;
    }
    
    int64_t binop_y_219365 = (int64_t) 8 * dyn_lifted_single_ma_l_arg_204234;
    int64_t bytes_219366 = smax64((int64_t) 0, binop_y_219365);
    
    if (mem_219389_cached_sizze_235566 < (size_t) bytes_217460) {
        mem_219389 = realloc(mem_219389, bytes_217460);
        mem_219389_cached_sizze_235566 = bytes_217460;
    }
    if (mem_219411_cached_sizze_235567 < (size_t) bytes_217457) {
        mem_219411 = realloc(mem_219411, bytes_217457);
        mem_219411_cached_sizze_235567 = bytes_217457;
    }
    
    int64_t ext_219904;
    
    if (cond_204197) {
        ext_219904 = n_203572;
    } else {
        ext_219904 = l_n_m_203733;
    }
    
    int64_t ext_220743;
    
    if (cond_204198) {
        ext_220743 = n_203572;
    } else {
        ext_220743 = t_n_m_203740;
    }
    
    int64_t ext_221008;
    int64_t ext_221006;
    int64_t ext_221002;
    int64_t ext_221001;
    int64_t ext_221000;
    int64_t ext_220999;
    int64_t ext_220998;
    int64_t ext_220997;
    int64_t ext_220996;
    struct memblock ext_mem_220995;
    
    ext_mem_220995.references = NULL;
    
    struct memblock ext_mem_220994;
    
    ext_mem_220994.references = NULL;
    
    struct memblock ext_mem_220993;
    
    ext_mem_220993.references = NULL;
    
    struct memblock mem_param_217973;
    
    mem_param_217973.references = NULL;
    
    int64_t ctx_param_ext_217975;
    int64_t ctx_param_ext_217977;
    struct memblock mem_param_217981;
    
    mem_param_217981.references = NULL;
    
    int64_t ctx_param_ext_217982;
    int64_t ctx_param_ext_217983;
    int64_t ctx_param_ext_217984;
    int64_t ctx_param_ext_217985;
    int64_t ctx_param_ext_217986;
    int64_t ctx_param_ext_217987;
    int64_t ctx_param_ext_217988;
    struct memblock mem_param_217989;
    
    mem_param_217989.references = NULL;
    ctx_param_ext_217975 = n_203572;
    ctx_param_ext_217977 = n_203572;
    ctx_param_ext_217982 = partition_sizze_203667;
    ctx_param_ext_217983 = n_203572;
    ctx_param_ext_217984 = (int64_t) 0;
    ctx_param_ext_217985 = n_203572;
    ctx_param_ext_217986 = partition_sizze_203667;
    ctx_param_ext_217987 = (int64_t) 1;
    ctx_param_ext_217988 = n_203572;
    if (memblock_set(ctx, &mem_param_217973, &mem_217961, "mem_217961") != 0)
        return 1;
    if (memblock_set(ctx, &mem_param_217981, &mem_217961, "mem_217961") != 0)
        return 1;
    if (memblock_set(ctx, &mem_param_217989, &mem_217965, "mem_217965") != 0)
        return 1;
    for (int64_t i_outer_204282 = 0; i_outer_204282 < n_outer_203585;
         i_outer_204282++) {
        int64_t ext_220755;
        int64_t ext_220753;
        struct memblock ext_mem_220749;
        
        ext_mem_220749.references = NULL;
        
        struct memblock ext_mem_220748;
        
        ext_mem_220748.references = NULL;
        
        struct memblock mem_param_218003;
        
        mem_param_218003.references = NULL;
        
        int64_t ctx_param_ext_218005;
        int64_t ctx_param_ext_218007;
        struct memblock mem_param_218011;
        
        mem_param_218011.references = NULL;
        ctx_param_ext_218005 = ctx_param_ext_217975;
        ctx_param_ext_218007 = ctx_param_ext_217977;
        if (memblock_set(ctx, &mem_param_218003, &mem_param_217973,
                         "mem_param_217973") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_218011, &mem_param_217981,
                         "mem_param_217981") != 0)
            return 1;
        for (int64_t _i_inner_204288 = 0; _i_inner_204288 < n_inner_203584;
             _i_inner_204288++) {
            int64_t flat_tid_207784 = (int64_t) 0;
            int32_t num_tasks_222918;
            int64_t flat_tid_207790 = (int64_t) 0;
            struct futhark_mc_task_235799 futhark_mc_task_235799;
            
            futhark_mc_task_235799.ctx = ctx;
            futhark_mc_task_235799.free_n_203572 = n_203572;
            futhark_mc_task_235799.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_235799.free_mem_217415 = mem_217415;
            futhark_mc_task_235799.free_bytes_217420 = bytes_217420;
            futhark_mc_task_235799.free_ctx_param_ext_218007 =
                ctx_param_ext_218007;
            futhark_mc_task_235799.free_mem_param_218011 = mem_param_218011.mem;
            futhark_mc_task_235799.free_mem_218033 = mem_218033;
            
            struct scheduler_segop futhark_mc_task_235799_task;
            
            futhark_mc_task_235799_task.args = &futhark_mc_task_235799;
            futhark_mc_task_235799_task.top_level_fn =
                futhark_mc_segmap_task_235800;
            futhark_mc_task_235799_task.name = "futhark_mc_segmap_task_235800";
            futhark_mc_task_235799_task.iterations = partition_sizze_203667;
            futhark_mc_task_235799_task.task_time =
                &ctx->futhark_mc_segmap_task_235800_total_time;
            futhark_mc_task_235799_task.task_iter =
                &ctx->futhark_mc_segmap_task_235800_total_iter;
            futhark_mc_task_235799_task.sched = STATIC;
            futhark_mc_task_235799_task.nested_fn =
                futhark_mc_segmap_nested_task_235804;
            
            int futhark_mc_segmap_task_235800_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235799_task);
            
            if (futhark_mc_segmap_task_235800_err != 0) {
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_207800 = (int64_t) 0;
            int32_t num_tasks_222941;
            int64_t flat_tid_207834 = (int64_t) 0;
            struct futhark_mc_task_235812 futhark_mc_task_235812;
            
            futhark_mc_task_235812.ctx = ctx;
            futhark_mc_task_235812.free_n_203572 = n_203572;
            futhark_mc_task_235812.free_n_p_203574 = n_p_203574;
            futhark_mc_task_235812.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_235812.free_defunc_0_f_res_203721 =
                defunc_0_f_res_203721;
            futhark_mc_task_235812.free_i_203760 = i_203760;
            futhark_mc_task_235812.free_bytes_217463 = bytes_217463;
            futhark_mc_task_235812.free_bytes_217482 = bytes_217482;
            futhark_mc_task_235812.free_mem_217654 = mem_217654;
            futhark_mc_task_235812.free_ctx_param_ext_217984 =
                ctx_param_ext_217984;
            futhark_mc_task_235812.free_ctx_param_ext_217985 =
                ctx_param_ext_217985;
            futhark_mc_task_235812.free_ctx_param_ext_217987 =
                ctx_param_ext_217987;
            futhark_mc_task_235812.free_mem_param_217989 = mem_param_217989.mem;
            futhark_mc_task_235812.free_mem_218033 = mem_218033;
            futhark_mc_task_235812.free_mem_218170 = mem_218170;
            futhark_mc_task_235812.free_mem_218175 = mem_218175;
            
            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_segmap_task_235813;
            futhark_mc_task_235812_task.name = "futhark_mc_segmap_task_235813";
            futhark_mc_task_235812_task.iterations = partition_sizze_203667;
            futhark_mc_task_235812_task.task_time =
                &ctx->futhark_mc_segmap_task_235813_total_time;
            futhark_mc_task_235812_task.task_iter =
                &ctx->futhark_mc_segmap_task_235813_total_iter;
            futhark_mc_task_235812_task.sched = STATIC;
            futhark_mc_task_235812_task.nested_fn =
                futhark_mc_segmap_nested_task_235818;
            
            int futhark_mc_segmap_task_235813_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_235812_task);
            
            if (futhark_mc_segmap_task_235813_err != 0) {
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            struct memblock ext_mem_219241;
            
            ext_mem_219241.references = NULL;
            
            struct memblock ext_mem_219240;
            
            ext_mem_219240.references = NULL;
            if (cond_204260) {
                bool match_lit_204330 = (int64_t) 0 == d_s_203578;
                struct memblock ext_mem_218539;
                
                ext_mem_218539.references = NULL;
                
                struct memblock ext_mem_218538;
                
                ext_mem_218538.references = NULL;
                if (match_lit_204330) {
                    struct memblock mem_218180;
                    
                    mem_218180.references = NULL;
                    if (memblock_alloc(ctx, &mem_218180, bytes_217827,
                                       "mem_218180")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_223089 = 0; i_223089 <
                         partition_sizze_203667; i_223089++) {
                        for (int64_t i_223090 = 0; i_223090 < n_p_203574;
                             i_223090++) {
                            for (int64_t i_223091 = 0; i_223091 < s_n_m_203726;
                                 i_223091++) {
                                ((double *) mem_218180.mem)[i_223089 *
                                                            (s_n_m_203726 *
                                                             n_p_203574) +
                                                            i_223090 *
                                                            s_n_m_203726 +
                                                            i_223091] = 0.0;
                            }
                        }
                    }
                    
                    struct memblock mem_218251;
                    
                    mem_218251.references = NULL;
                    if (memblock_alloc(ctx, &mem_218251, bytes_217827,
                                       "mem_218251")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t flat_tid_207887 = (int64_t) 0;
                    int32_t num_tasks_223092;
                    int64_t flat_tid_208148 = (int64_t) 0;
                    struct futhark_mc_task_235838 futhark_mc_task_235838;
                    
                    futhark_mc_task_235838.ctx = ctx;
                    futhark_mc_task_235838.free_n_p_203574 = n_p_203574;
                    futhark_mc_task_235838.free_q_s_203575 = q_s_203575;
                    futhark_mc_task_235838.free_jump_s_203581 = jump_s_203581;
                    futhark_mc_task_235838.free_partition_sizze_203667 =
                        partition_sizze_203667;
                    futhark_mc_task_235838.free_defunc_0_f_res_203721 =
                        defunc_0_f_res_203721;
                    futhark_mc_task_235838.free_pad_css_len_203722 =
                        pad_css_len_203722;
                    futhark_mc_task_235838.free_s_n_m_203726 = s_n_m_203726;
                    futhark_mc_task_235838.free_mem_217654 = mem_217654;
                    futhark_mc_task_235838.free_mem_217658 = mem_217658;
                    futhark_mc_task_235838.free_bytes_217663 = bytes_217663;
                    futhark_mc_task_235838.free_bytes_217715 = bytes_217715;
                    futhark_mc_task_235838.free_mem_217828 = mem_217828;
                    futhark_mc_task_235838.free_mem_217833 = mem_217833;
                    futhark_mc_task_235838.free_mem_218170 = mem_218170;
                    futhark_mc_task_235838.free_mem_218175 = mem_218175;
                    futhark_mc_task_235838.free_mem_218251 = mem_218251.mem;
                    
                    struct scheduler_segop futhark_mc_task_235838_task;
                    
                    futhark_mc_task_235838_task.args = &futhark_mc_task_235838;
                    futhark_mc_task_235838_task.top_level_fn =
                        futhark_mc_segmap_task_235839;
                    futhark_mc_task_235838_task.name =
                        "futhark_mc_segmap_task_235839";
                    futhark_mc_task_235838_task.iterations =
                        partition_sizze_203667;
                    futhark_mc_task_235838_task.task_time =
                        &ctx->futhark_mc_segmap_task_235839_total_time;
                    futhark_mc_task_235838_task.task_iter =
                        &ctx->futhark_mc_segmap_task_235839_total_iter;
                    futhark_mc_task_235838_task.sched = STATIC;
                    futhark_mc_task_235838_task.nested_fn =
                        futhark_mc_segmap_nested_task_235843;
                    
                    int futhark_mc_segmap_task_235839_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_235838_task);
                    
                    if (futhark_mc_segmap_task_235839_err != 0) {
                        if (memblock_unref(ctx, &mem_218251, "mem_218251") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218180, "mem_218180") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_218538,
                                           "ext_mem_218538") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_218539,
                                           "ext_mem_218539") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219240,
                                           "ext_mem_219240") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219241,
                                           "ext_mem_219241") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218011,
                                           "mem_param_218011") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218003,
                                           "mem_param_218003") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220748,
                                           "ext_mem_220748") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220749,
                                           "ext_mem_220749") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217989,
                                           "mem_param_217989") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217981,
                                           "mem_param_217981") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217973,
                                           "mem_param_217973") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220993,
                                           "ext_mem_220993") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220994,
                                           "ext_mem_220994") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220995,
                                           "ext_mem_220995") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221150,
                                           "mem_out_221150") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221149,
                                           "mem_out_221149") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221148,
                                           "mem_out_221148") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_218539, &mem_218251,
                                     "mem_218251") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_218538, &mem_218180,
                                     "mem_218180") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_218251, "mem_218251") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_218180, "mem_218180") != 0)
                        return 1;
                } else {
                    bool match_lit_204426 = (int64_t) 1 == d_s_203578;
                    struct memblock ext_mem_218537;
                    
                    ext_mem_218537.references = NULL;
                    
                    struct memblock ext_mem_218536;
                    
                    ext_mem_218536.references = NULL;
                    if (match_lit_204426) {
                        struct memblock mem_218388;
                        
                        mem_218388.references = NULL;
                        if (memblock_alloc(ctx, &mem_218388, bytes_217827,
                                           "mem_218388")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_218393;
                        
                        mem_218393.references = NULL;
                        if (memblock_alloc(ctx, &mem_218393, bytes_217827,
                                           "mem_218393")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_208405 = (int64_t) 0;
                        int32_t num_tasks_223807;
                        int64_t flat_tid_208751 = (int64_t) 0;
                        struct futhark_mc_task_235873 futhark_mc_task_235873;
                        
                        futhark_mc_task_235873.ctx = ctx;
                        futhark_mc_task_235873.free_n_p_203574 = n_p_203574;
                        futhark_mc_task_235873.free_q_s_203575 = q_s_203575;
                        futhark_mc_task_235873.free_jump_s_203581 =
                            jump_s_203581;
                        futhark_mc_task_235873.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_235873.free_defunc_0_f_res_203721 =
                            defunc_0_f_res_203721;
                        futhark_mc_task_235873.free_pad_css_len_203722 =
                            pad_css_len_203722;
                        futhark_mc_task_235873.free_s_n_m_203726 = s_n_m_203726;
                        futhark_mc_task_235873.free_mem_217654 = mem_217654;
                        futhark_mc_task_235873.free_mem_217658 = mem_217658;
                        futhark_mc_task_235873.free_bytes_217663 = bytes_217663;
                        futhark_mc_task_235873.free_bytes_217715 = bytes_217715;
                        futhark_mc_task_235873.free_mem_217828 = mem_217828;
                        futhark_mc_task_235873.free_mem_217833 = mem_217833;
                        futhark_mc_task_235873.free_mem_218170 = mem_218170;
                        futhark_mc_task_235873.free_mem_218175 = mem_218175;
                        futhark_mc_task_235873.free_mem_218388 = mem_218388.mem;
                        futhark_mc_task_235873.free_mem_218393 = mem_218393.mem;
                        
                        struct scheduler_segop futhark_mc_task_235873_task;
                        
                        futhark_mc_task_235873_task.args =
                            &futhark_mc_task_235873;
                        futhark_mc_task_235873_task.top_level_fn =
                            futhark_mc_segmap_task_235874;
                        futhark_mc_task_235873_task.name =
                            "futhark_mc_segmap_task_235874";
                        futhark_mc_task_235873_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_235873_task.task_time =
                            &ctx->futhark_mc_segmap_task_235874_total_time;
                        futhark_mc_task_235873_task.task_iter =
                            &ctx->futhark_mc_segmap_task_235874_total_iter;
                        futhark_mc_task_235873_task.sched = STATIC;
                        futhark_mc_task_235873_task.nested_fn =
                            futhark_mc_segmap_nested_task_235879;
                        
                        int futhark_mc_segmap_task_235874_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_235873_task);
                        
                        if (futhark_mc_segmap_task_235874_err != 0) {
                            if (memblock_unref(ctx, &mem_218393,
                                               "mem_218393") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_218388,
                                               "mem_218388") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218536,
                                               "ext_mem_218536") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218537,
                                               "ext_mem_218537") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218538,
                                               "ext_mem_218538") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218539,
                                               "ext_mem_218539") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_218537, &mem_218388,
                                         "mem_218388") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_218536, &mem_218393,
                                         "mem_218393") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218393, "mem_218393") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218388, "mem_218388") != 0)
                            return 1;
                    } else {
                        struct memblock mem_218530;
                        
                        mem_218530.references = NULL;
                        if (memblock_alloc(ctx, &mem_218530, bytes_217827,
                                           "mem_218530")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_218535;
                        
                        mem_218535.references = NULL;
                        if (memblock_alloc(ctx, &mem_218535, bytes_217827,
                                           "mem_218535")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_209095 = (int64_t) 0;
                        int32_t num_tasks_224779;
                        int64_t flat_tid_209537 = (int64_t) 0;
                        struct futhark_mc_task_235915 futhark_mc_task_235915;
                        
                        futhark_mc_task_235915.ctx = ctx;
                        futhark_mc_task_235915.free_n_p_203574 = n_p_203574;
                        futhark_mc_task_235915.free_q_s_203575 = q_s_203575;
                        futhark_mc_task_235915.free_jump_s_203581 =
                            jump_s_203581;
                        futhark_mc_task_235915.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_235915.free_defunc_0_f_res_203721 =
                            defunc_0_f_res_203721;
                        futhark_mc_task_235915.free_pad_css_len_203722 =
                            pad_css_len_203722;
                        futhark_mc_task_235915.free_s_n_m_203726 = s_n_m_203726;
                        futhark_mc_task_235915.free_mem_217654 = mem_217654;
                        futhark_mc_task_235915.free_mem_217658 = mem_217658;
                        futhark_mc_task_235915.free_bytes_217663 = bytes_217663;
                        futhark_mc_task_235915.free_bytes_217715 = bytes_217715;
                        futhark_mc_task_235915.free_mem_217828 = mem_217828;
                        futhark_mc_task_235915.free_mem_217833 = mem_217833;
                        futhark_mc_task_235915.free_mem_218170 = mem_218170;
                        futhark_mc_task_235915.free_mem_218175 = mem_218175;
                        futhark_mc_task_235915.free_mem_218530 = mem_218530.mem;
                        futhark_mc_task_235915.free_mem_218535 = mem_218535.mem;
                        
                        struct scheduler_segop futhark_mc_task_235915_task;
                        
                        futhark_mc_task_235915_task.args =
                            &futhark_mc_task_235915;
                        futhark_mc_task_235915_task.top_level_fn =
                            futhark_mc_segmap_task_235916;
                        futhark_mc_task_235915_task.name =
                            "futhark_mc_segmap_task_235916";
                        futhark_mc_task_235915_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_235915_task.task_time =
                            &ctx->futhark_mc_segmap_task_235916_total_time;
                        futhark_mc_task_235915_task.task_iter =
                            &ctx->futhark_mc_segmap_task_235916_total_iter;
                        futhark_mc_task_235915_task.sched = STATIC;
                        futhark_mc_task_235915_task.nested_fn =
                            futhark_mc_segmap_nested_task_235921;
                        
                        int futhark_mc_segmap_task_235916_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_235915_task);
                        
                        if (futhark_mc_segmap_task_235916_err != 0) {
                            if (memblock_unref(ctx, &mem_218535,
                                               "mem_218535") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_218530,
                                               "mem_218530") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218536,
                                               "ext_mem_218536") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218537,
                                               "ext_mem_218537") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218538,
                                               "ext_mem_218538") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_218539,
                                               "ext_mem_218539") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_218537, &mem_218530,
                                         "mem_218530") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_218536, &mem_218535,
                                         "mem_218535") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218535, "mem_218535") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218530, "mem_218530") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_218539, &ext_mem_218537,
                                     "ext_mem_218537") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_218538, &ext_mem_218536,
                                     "ext_mem_218536") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_218536,
                                       "ext_mem_218536") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_218537,
                                       "ext_mem_218537") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_219241, &ext_mem_218539,
                                 "ext_mem_218539") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_219240, &ext_mem_218538,
                                 "ext_mem_218538") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_218538, "ext_mem_218538") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_218539, "ext_mem_218539") != 0)
                    return 1;
            } else {
                bool match_lit_204707 = (int64_t) 0 == d_s_203578;
                struct memblock ext_mem_219239;
                
                ext_mem_219239.references = NULL;
                
                struct memblock ext_mem_219238;
                
                ext_mem_219238.references = NULL;
                if (match_lit_204707) {
                    struct memblock mem_218544;
                    
                    mem_218544.references = NULL;
                    if (memblock_alloc(ctx, &mem_218544, bytes_217827,
                                       "mem_218544")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_226007 = 0; i_226007 <
                         partition_sizze_203667; i_226007++) {
                        for (int64_t i_226008 = 0; i_226008 < n_p_203574;
                             i_226008++) {
                            for (int64_t i_226009 = 0; i_226009 < s_n_m_203726;
                                 i_226009++) {
                                ((double *) mem_218544.mem)[i_226007 *
                                                            (s_n_m_203726 *
                                                             n_p_203574) +
                                                            i_226008 *
                                                            s_n_m_203726 +
                                                            i_226009] = 0.0;
                            }
                        }
                    }
                    
                    struct memblock mem_218663;
                    
                    mem_218663.references = NULL;
                    if (memblock_alloc(ctx, &mem_218663, bytes_217827,
                                       "mem_218663")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t binop_y_218545 = (int64_t) 8 * q_s_203575;
                    int64_t bytes_218546 = smax64((int64_t) 0, binop_y_218545);
                    int64_t flat_tid_209977 = (int64_t) 0;
                    int32_t num_tasks_226010;
                    int64_t flat_tid_210166 = (int64_t) 0;
                    struct futhark_mc_task_235959 futhark_mc_task_235959;
                    
                    futhark_mc_task_235959.ctx = ctx;
                    futhark_mc_task_235959.free_n_p_203574 = n_p_203574;
                    futhark_mc_task_235959.free_q_s_203575 = q_s_203575;
                    futhark_mc_task_235959.free_jump_s_203581 = jump_s_203581;
                    futhark_mc_task_235959.free_partition_sizze_203667 =
                        partition_sizze_203667;
                    futhark_mc_task_235959.free_defunc_0_f_res_203721 =
                        defunc_0_f_res_203721;
                    futhark_mc_task_235959.free_pad_css_len_203722 =
                        pad_css_len_203722;
                    futhark_mc_task_235959.free_s_n_m_203726 = s_n_m_203726;
                    futhark_mc_task_235959.free_mem_217654 = mem_217654;
                    futhark_mc_task_235959.free_mem_217658 = mem_217658;
                    futhark_mc_task_235959.free_bytes_217663 = bytes_217663;
                    futhark_mc_task_235959.free_bytes_217715 = bytes_217715;
                    futhark_mc_task_235959.free_mem_217828 = mem_217828;
                    futhark_mc_task_235959.free_mem_217833 = mem_217833;
                    futhark_mc_task_235959.free_mem_218170 = mem_218170;
                    futhark_mc_task_235959.free_mem_218175 = mem_218175;
                    futhark_mc_task_235959.free_bytes_218546 = bytes_218546;
                    futhark_mc_task_235959.free_mem_218663 = mem_218663.mem;
                    
                    struct scheduler_segop futhark_mc_task_235959_task;
                    
                    futhark_mc_task_235959_task.args = &futhark_mc_task_235959;
                    futhark_mc_task_235959_task.top_level_fn =
                        futhark_mc_segmap_task_235960;
                    futhark_mc_task_235959_task.name =
                        "futhark_mc_segmap_task_235960";
                    futhark_mc_task_235959_task.iterations =
                        partition_sizze_203667;
                    futhark_mc_task_235959_task.task_time =
                        &ctx->futhark_mc_segmap_task_235960_total_time;
                    futhark_mc_task_235959_task.task_iter =
                        &ctx->futhark_mc_segmap_task_235960_total_iter;
                    futhark_mc_task_235959_task.sched = STATIC;
                    futhark_mc_task_235959_task.nested_fn =
                        futhark_mc_segmap_nested_task_235965;
                    
                    int futhark_mc_segmap_task_235960_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_235959_task);
                    
                    if (futhark_mc_segmap_task_235960_err != 0) {
                        if (memblock_unref(ctx, &mem_218663, "mem_218663") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218544, "mem_218544") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219238,
                                           "ext_mem_219238") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219239,
                                           "ext_mem_219239") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219240,
                                           "ext_mem_219240") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219241,
                                           "ext_mem_219241") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218011,
                                           "mem_param_218011") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218003,
                                           "mem_param_218003") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220748,
                                           "ext_mem_220748") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220749,
                                           "ext_mem_220749") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217989,
                                           "mem_param_217989") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217981,
                                           "mem_param_217981") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217973,
                                           "mem_param_217973") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220993,
                                           "ext_mem_220993") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220994,
                                           "ext_mem_220994") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220995,
                                           "ext_mem_220995") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221150,
                                           "mem_out_221150") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221149,
                                           "mem_out_221149") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221148,
                                           "mem_out_221148") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_219239, &mem_218663,
                                     "mem_218663") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219238, &mem_218544,
                                     "mem_218544") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_218663, "mem_218663") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_218544, "mem_218544") != 0)
                        return 1;
                } else {
                    bool match_lit_204779 = (int64_t) 1 == d_s_203578;
                    struct memblock ext_mem_219237;
                    
                    ext_mem_219237.references = NULL;
                    
                    struct memblock ext_mem_219236;
                    
                    ext_mem_219236.references = NULL;
                    if (match_lit_204779) {
                        struct memblock mem_218896;
                        
                        mem_218896.references = NULL;
                        if (memblock_alloc(ctx, &mem_218896, bytes_217827,
                                           "mem_218896")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_218901;
                        
                        mem_218901.references = NULL;
                        if (memblock_alloc(ctx, &mem_218901, bytes_217827,
                                           "mem_218901")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_218664 = (int64_t) 8 * q_s_203575;
                        int64_t bytes_218665 = smax64((int64_t) 0,
                                                      binop_y_218664);
                        int64_t flat_tid_210351 = (int64_t) 0;
                        int32_t num_tasks_226534;
                        int64_t flat_tid_210628 = (int64_t) 0;
                        struct futhark_mc_task_235998 futhark_mc_task_235998;
                        
                        futhark_mc_task_235998.ctx = ctx;
                        futhark_mc_task_235998.free_n_p_203574 = n_p_203574;
                        futhark_mc_task_235998.free_q_s_203575 = q_s_203575;
                        futhark_mc_task_235998.free_jump_s_203581 =
                            jump_s_203581;
                        futhark_mc_task_235998.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_235998.free_defunc_0_f_res_203721 =
                            defunc_0_f_res_203721;
                        futhark_mc_task_235998.free_pad_css_len_203722 =
                            pad_css_len_203722;
                        futhark_mc_task_235998.free_s_n_m_203726 = s_n_m_203726;
                        futhark_mc_task_235998.free_mem_217654 = mem_217654;
                        futhark_mc_task_235998.free_mem_217658 = mem_217658;
                        futhark_mc_task_235998.free_bytes_217663 = bytes_217663;
                        futhark_mc_task_235998.free_bytes_217715 = bytes_217715;
                        futhark_mc_task_235998.free_mem_217828 = mem_217828;
                        futhark_mc_task_235998.free_mem_217833 = mem_217833;
                        futhark_mc_task_235998.free_mem_218170 = mem_218170;
                        futhark_mc_task_235998.free_mem_218175 = mem_218175;
                        futhark_mc_task_235998.free_bytes_218665 = bytes_218665;
                        futhark_mc_task_235998.free_mem_218896 = mem_218896.mem;
                        futhark_mc_task_235998.free_mem_218901 = mem_218901.mem;
                        
                        struct scheduler_segop futhark_mc_task_235998_task;
                        
                        futhark_mc_task_235998_task.args =
                            &futhark_mc_task_235998;
                        futhark_mc_task_235998_task.top_level_fn =
                            futhark_mc_segmap_task_235999;
                        futhark_mc_task_235998_task.name =
                            "futhark_mc_segmap_task_235999";
                        futhark_mc_task_235998_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_235998_task.task_time =
                            &ctx->futhark_mc_segmap_task_235999_total_time;
                        futhark_mc_task_235998_task.task_iter =
                            &ctx->futhark_mc_segmap_task_235999_total_iter;
                        futhark_mc_task_235998_task.sched = STATIC;
                        futhark_mc_task_235998_task.nested_fn =
                            futhark_mc_segmap_nested_task_236006;
                        
                        int futhark_mc_segmap_task_235999_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_235998_task);
                        
                        if (futhark_mc_segmap_task_235999_err != 0) {
                            if (memblock_unref(ctx, &mem_218901,
                                               "mem_218901") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_218896,
                                               "mem_218896") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219236,
                                               "ext_mem_219236") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219237,
                                               "ext_mem_219237") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219238,
                                               "ext_mem_219238") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219239,
                                               "ext_mem_219239") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219237, &mem_218896,
                                         "mem_218896") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219236, &mem_218901,
                                         "mem_218901") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218901, "mem_218901") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_218896, "mem_218896") != 0)
                            return 1;
                    } else {
                        struct memblock mem_219230;
                        
                        mem_219230.references = NULL;
                        if (memblock_alloc(ctx, &mem_219230, bytes_217827,
                                           "mem_219230")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219235;
                        
                        mem_219235.references = NULL;
                        if (memblock_alloc(ctx, &mem_219235, bytes_217827,
                                           "mem_219235")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_218902 = (int64_t) 8 * q_s_203575;
                        int64_t bytes_218903 = smax64((int64_t) 0,
                                                      binop_y_218902);
                        int64_t flat_tid_210903 = (int64_t) 0;
                        int32_t num_tasks_227347;
                        int64_t flat_tid_211294 = (int64_t) 0;
                        struct futhark_mc_task_236048 futhark_mc_task_236048;
                        
                        futhark_mc_task_236048.ctx = ctx;
                        futhark_mc_task_236048.free_n_p_203574 = n_p_203574;
                        futhark_mc_task_236048.free_q_s_203575 = q_s_203575;
                        futhark_mc_task_236048.free_jump_s_203581 =
                            jump_s_203581;
                        futhark_mc_task_236048.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_236048.free_defunc_0_f_res_203721 =
                            defunc_0_f_res_203721;
                        futhark_mc_task_236048.free_pad_css_len_203722 =
                            pad_css_len_203722;
                        futhark_mc_task_236048.free_s_n_m_203726 = s_n_m_203726;
                        futhark_mc_task_236048.free_mem_217654 = mem_217654;
                        futhark_mc_task_236048.free_mem_217658 = mem_217658;
                        futhark_mc_task_236048.free_bytes_217663 = bytes_217663;
                        futhark_mc_task_236048.free_bytes_217715 = bytes_217715;
                        futhark_mc_task_236048.free_mem_217828 = mem_217828;
                        futhark_mc_task_236048.free_mem_217833 = mem_217833;
                        futhark_mc_task_236048.free_mem_218170 = mem_218170;
                        futhark_mc_task_236048.free_mem_218175 = mem_218175;
                        futhark_mc_task_236048.free_bytes_218903 = bytes_218903;
                        futhark_mc_task_236048.free_mem_219230 = mem_219230.mem;
                        futhark_mc_task_236048.free_mem_219235 = mem_219235.mem;
                        
                        struct scheduler_segop futhark_mc_task_236048_task;
                        
                        futhark_mc_task_236048_task.args =
                            &futhark_mc_task_236048;
                        futhark_mc_task_236048_task.top_level_fn =
                            futhark_mc_segmap_task_236049;
                        futhark_mc_task_236048_task.name =
                            "futhark_mc_segmap_task_236049";
                        futhark_mc_task_236048_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_236048_task.task_time =
                            &ctx->futhark_mc_segmap_task_236049_total_time;
                        futhark_mc_task_236048_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236049_total_iter;
                        futhark_mc_task_236048_task.sched = STATIC;
                        futhark_mc_task_236048_task.nested_fn =
                            futhark_mc_segmap_nested_task_236058;
                        
                        int futhark_mc_segmap_task_236049_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236048_task);
                        
                        if (futhark_mc_segmap_task_236049_err != 0) {
                            if (memblock_unref(ctx, &mem_219235,
                                               "mem_219235") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219230,
                                               "mem_219230") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219236,
                                               "ext_mem_219236") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219237,
                                               "ext_mem_219237") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219238,
                                               "ext_mem_219238") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219239,
                                               "ext_mem_219239") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219237, &mem_219230,
                                         "mem_219230") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219236, &mem_219235,
                                         "mem_219235") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219235, "mem_219235") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219230, "mem_219230") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_219239, &ext_mem_219237,
                                     "ext_mem_219237") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219238, &ext_mem_219236,
                                     "ext_mem_219236") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219236,
                                       "ext_mem_219236") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219237,
                                       "ext_mem_219237") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_219241, &ext_mem_219239,
                                 "ext_mem_219239") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_219240, &ext_mem_219238,
                                 "ext_mem_219238") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219238, "ext_mem_219238") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219239, "ext_mem_219239") != 0)
                    return 1;
            }
            
            struct memblock ext_mem_219313;
            
            ext_mem_219313.references = NULL;
            if (cond_203725) {
                if (memblock_set(ctx, &ext_mem_219313, &ext_mem_219241,
                                 "ext_mem_219241") != 0)
                    return 1;
            } else {
                bool bounds_invalid_upwards_205061 = slt64(pad_css_len_203722,
                                                           (int64_t) 0);
                bool valid_205062 = !bounds_invalid_upwards_205061;
                bool range_valid_c_205063;
                
                if (!valid_205062) {
                    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_203722,
                                  " 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_219313,
                                       "ext_mem_219313") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219240,
                                       "ext_mem_219240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219241,
                                       "ext_mem_219241") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218011,
                                       "mem_param_218011") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218003,
                                       "mem_param_218003") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220748,
                                       "ext_mem_220748") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220749,
                                       "ext_mem_220749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217989,
                                       "mem_param_217989") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217981,
                                       "mem_param_217981") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217973,
                                       "mem_param_217973") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220993,
                                       "ext_mem_220993") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220994,
                                       "ext_mem_220994") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220995,
                                       "ext_mem_220995") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221150,
                                       "mem_out_221150") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221149,
                                       "mem_out_221149") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221148,
                                       "mem_out_221148") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock mem_219312;
                
                mem_219312.references = NULL;
                if (memblock_alloc(ctx, &mem_219312, bytes_219311,
                                   "mem_219312")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t binop_x_219260 = n_p_203574 * pad_css_len_203722;
                int64_t binop_y_219261 = (int64_t) 8 * binop_x_219260;
                int64_t bytes_219262 = smax64((int64_t) 0, binop_y_219261);
                int64_t binop_y_219242 = (int64_t) 8 * pad_css_len_203722;
                int64_t bytes_219243 = smax64((int64_t) 0, binop_y_219242);
                int64_t flat_tid_211679 = (int64_t) 0;
                int32_t num_tasks_228519;
                int64_t flat_tid_211776 = (int64_t) 0;
                struct futhark_mc_task_236112 futhark_mc_task_236112;
                
                futhark_mc_task_236112.ctx = ctx;
                futhark_mc_task_236112.free_n_p_203574 = n_p_203574;
                futhark_mc_task_236112.free_jump_s_203581 = jump_s_203581;
                futhark_mc_task_236112.free_partition_sizze_203667 =
                    partition_sizze_203667;
                futhark_mc_task_236112.free_defunc_0_f_res_203721 =
                    defunc_0_f_res_203721;
                futhark_mc_task_236112.free_pad_css_len_203722 =
                    pad_css_len_203722;
                futhark_mc_task_236112.free_s_n_m_203726 = s_n_m_203726;
                futhark_mc_task_236112.free_ext_mem_219240 = ext_mem_219240.mem;
                futhark_mc_task_236112.free_ext_mem_219241 = ext_mem_219241.mem;
                futhark_mc_task_236112.free_bytes_219243 = bytes_219243;
                futhark_mc_task_236112.free_bytes_219262 = bytes_219262;
                futhark_mc_task_236112.free_mem_219312 = mem_219312.mem;
                
                struct scheduler_segop futhark_mc_task_236112_task;
                
                futhark_mc_task_236112_task.args = &futhark_mc_task_236112;
                futhark_mc_task_236112_task.top_level_fn =
                    futhark_mc_segmap_task_236113;
                futhark_mc_task_236112_task.name =
                    "futhark_mc_segmap_task_236113";
                futhark_mc_task_236112_task.iterations = partition_sizze_203667;
                futhark_mc_task_236112_task.task_time =
                    &ctx->futhark_mc_segmap_task_236113_total_time;
                futhark_mc_task_236112_task.task_iter =
                    &ctx->futhark_mc_segmap_task_236113_total_iter;
                futhark_mc_task_236112_task.sched = STATIC;
                futhark_mc_task_236112_task.nested_fn =
                    futhark_mc_segmap_nested_task_236117;
                
                int futhark_mc_segmap_task_236113_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_236112_task);
                
                if (futhark_mc_segmap_task_236113_err != 0) {
                    if (memblock_unref(ctx, &mem_219312, "mem_219312") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219313,
                                       "ext_mem_219313") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219240,
                                       "ext_mem_219240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219241,
                                       "ext_mem_219241") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218011,
                                       "mem_param_218011") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218003,
                                       "mem_param_218003") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220748,
                                       "ext_mem_220748") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220749,
                                       "ext_mem_220749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217989,
                                       "mem_param_217989") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217981,
                                       "mem_param_217981") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217973,
                                       "mem_param_217973") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220993,
                                       "ext_mem_220993") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220994,
                                       "ext_mem_220994") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220995,
                                       "ext_mem_220995") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221150,
                                       "mem_out_221150") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221149,
                                       "mem_out_221149") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221148,
                                       "mem_out_221148") != 0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_219313, &mem_219312,
                                 "mem_219312") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_219312, "mem_219312") != 0)
                    return 1;
            }
            if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                return 1;
            
            int64_t flat_tid_211953 = (int64_t) 0;
            int32_t num_tasks_229037;
            int64_t flat_tid_211959 = (int64_t) 0;
            struct futhark_mc_task_236134 futhark_mc_task_236134;
            
            futhark_mc_task_236134.ctx = ctx;
            futhark_mc_task_236134.free_n_p_203574 = n_p_203574;
            futhark_mc_task_236134.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236134.free_C_len_203724 = C_len_203724;
            futhark_mc_task_236134.free_css_results_l_204200 =
                css_results_l_204200;
            futhark_mc_task_236134.free_ext_mem_219313 = ext_mem_219313.mem;
            futhark_mc_task_236134.free_bytes_219316 = bytes_219316;
            futhark_mc_task_236134.free_mem_219336 = mem_219336;
            
            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_segmap_task_236135;
            futhark_mc_task_236134_task.name = "futhark_mc_segmap_task_236135";
            futhark_mc_task_236134_task.iterations = partition_sizze_203667;
            futhark_mc_task_236134_task.task_time =
                &ctx->futhark_mc_segmap_task_236135_total_time;
            futhark_mc_task_236134_task.task_iter =
                &ctx->futhark_mc_segmap_task_236135_total_iter;
            futhark_mc_task_236134_task.sched = STATIC;
            futhark_mc_task_236134_task.nested_fn =
                futhark_mc_segmap_nested_task_236139;
            
            int futhark_mc_segmap_task_236135_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236134_task);
            
            if (futhark_mc_segmap_task_236135_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                return 1;
            
            int64_t flat_tid_211977 = (int64_t) 0;
            int32_t num_tasks_229076;
            int64_t flat_tid_211983 = (int64_t) 0;
            struct futhark_mc_task_236147 futhark_mc_task_236147;
            
            futhark_mc_task_236147.ctx = ctx;
            futhark_mc_task_236147.free_n_p_203574 = n_p_203574;
            futhark_mc_task_236147.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236147.free_C_len_203724 = C_len_203724;
            futhark_mc_task_236147.free_mem_219336 = mem_219336;
            futhark_mc_task_236147.free_mem_219339 = mem_219339;
            
            struct scheduler_segop futhark_mc_task_236147_task;
            
            futhark_mc_task_236147_task.args = &futhark_mc_task_236147;
            futhark_mc_task_236147_task.top_level_fn =
                futhark_mc_segmap_task_236148;
            futhark_mc_task_236147_task.name = "futhark_mc_segmap_task_236148";
            futhark_mc_task_236147_task.iterations = partition_sizze_203667;
            futhark_mc_task_236147_task.task_time =
                &ctx->futhark_mc_segmap_task_236148_total_time;
            futhark_mc_task_236147_task.task_iter =
                &ctx->futhark_mc_segmap_task_236148_total_iter;
            futhark_mc_task_236147_task.sched = STATIC;
            futhark_mc_task_236147_task.nested_fn =
                futhark_mc_segmap_nested_task_236151;
            
            int futhark_mc_segmap_task_236148_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236147_task);
            
            if (futhark_mc_segmap_task_236148_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_211993 = (int64_t) 0;
            int32_t num_tasks_229103;
            int64_t flat_tid_211999 = (int64_t) 0;
            struct futhark_mc_task_236159 futhark_mc_task_236159;
            
            futhark_mc_task_236159.ctx = ctx;
            futhark_mc_task_236159.free_n_p_203574 = n_p_203574;
            futhark_mc_task_236159.free_i64_res_203589 = i64_res_203589;
            futhark_mc_task_236159.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236159.free_C_len_203724 = C_len_203724;
            futhark_mc_task_236159.free_lifted_single_ma_l_arg_204224 =
                lifted_single_ma_l_arg_204224;
            futhark_mc_task_236159.free_mem_219336 = mem_219336;
            futhark_mc_task_236159.free_mem_219339 = mem_219339;
            futhark_mc_task_236159.free_bytes_219341 = bytes_219341;
            futhark_mc_task_236159.free_mem_219361 = mem_219361;
            
            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_segmap_task_236160;
            futhark_mc_task_236159_task.name = "futhark_mc_segmap_task_236160";
            futhark_mc_task_236159_task.iterations = partition_sizze_203667;
            futhark_mc_task_236159_task.task_time =
                &ctx->futhark_mc_segmap_task_236160_total_time;
            futhark_mc_task_236159_task.task_iter =
                &ctx->futhark_mc_segmap_task_236160_total_iter;
            futhark_mc_task_236159_task.sched = STATIC;
            futhark_mc_task_236159_task.nested_fn =
                futhark_mc_segmap_nested_task_236164;
            
            int futhark_mc_segmap_task_236160_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236159_task);
            
            if (futhark_mc_segmap_task_236160_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_212028 = (int64_t) 0;
            int32_t num_tasks_229172;
            int64_t flat_tid_212034 = (int64_t) 0;
            struct futhark_mc_task_236175 futhark_mc_task_236175;
            
            futhark_mc_task_236175.ctx = ctx;
            futhark_mc_task_236175.free_n_p_203574 = n_p_203574;
            futhark_mc_task_236175.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236175.free_lifted_single_ma_l_arg_204224 =
                lifted_single_ma_l_arg_204224;
            futhark_mc_task_236175.free_mem_219361 = mem_219361;
            futhark_mc_task_236175.free_mem_219364 = mem_219364;
            
            struct scheduler_segop futhark_mc_task_236175_task;
            
            futhark_mc_task_236175_task.args = &futhark_mc_task_236175;
            futhark_mc_task_236175_task.top_level_fn =
                futhark_mc_segmap_task_236176;
            futhark_mc_task_236175_task.name = "futhark_mc_segmap_task_236176";
            futhark_mc_task_236175_task.iterations = partition_sizze_203667;
            futhark_mc_task_236175_task.task_time =
                &ctx->futhark_mc_segmap_task_236176_total_time;
            futhark_mc_task_236175_task.task_iter =
                &ctx->futhark_mc_segmap_task_236176_total_iter;
            futhark_mc_task_236175_task.sched = STATIC;
            futhark_mc_task_236175_task.nested_fn =
                futhark_mc_segmap_nested_task_236179;
            
            int futhark_mc_segmap_task_236176_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236175_task);
            
            if (futhark_mc_segmap_task_236176_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_212044 = (int64_t) 0;
            int32_t num_tasks_229199;
            int64_t flat_tid_212050 = (int64_t) 0;
            struct futhark_mc_task_236187 futhark_mc_task_236187;
            
            futhark_mc_task_236187.ctx = ctx;
            futhark_mc_task_236187.free_n_p_203574 = n_p_203574;
            futhark_mc_task_236187.free_i64_res_203589 = i64_res_203589;
            futhark_mc_task_236187.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236187.free_lifted_single_ma_l_arg_204224 =
                lifted_single_ma_l_arg_204224;
            futhark_mc_task_236187.free_dyn_lifted_single_ma_l_arg_204234 =
                dyn_lifted_single_ma_l_arg_204234;
            futhark_mc_task_236187.free_mem_219361 = mem_219361;
            futhark_mc_task_236187.free_mem_219364 = mem_219364;
            futhark_mc_task_236187.free_bytes_219366 = bytes_219366;
            futhark_mc_task_236187.free_mem_219386 = mem_219386;
            
            struct scheduler_segop futhark_mc_task_236187_task;
            
            futhark_mc_task_236187_task.args = &futhark_mc_task_236187;
            futhark_mc_task_236187_task.top_level_fn =
                futhark_mc_segmap_task_236188;
            futhark_mc_task_236187_task.name = "futhark_mc_segmap_task_236188";
            futhark_mc_task_236187_task.iterations = partition_sizze_203667;
            futhark_mc_task_236187_task.task_time =
                &ctx->futhark_mc_segmap_task_236188_total_time;
            futhark_mc_task_236187_task.task_iter =
                &ctx->futhark_mc_segmap_task_236188_total_iter;
            futhark_mc_task_236187_task.sched = STATIC;
            futhark_mc_task_236187_task.nested_fn =
                futhark_mc_segmap_nested_task_236192;
            
            int futhark_mc_segmap_task_236188_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236187_task);
            
            if (futhark_mc_segmap_task_236188_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_212079 = (int64_t) 0;
            int32_t num_tasks_229268;
            int64_t flat_tid_212085 = (int64_t) 0;
            struct futhark_mc_task_236203 futhark_mc_task_236203;
            
            futhark_mc_task_236203.ctx = ctx;
            futhark_mc_task_236203.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236203.free_dyn_lifted_single_ma_l_arg_204234 =
                dyn_lifted_single_ma_l_arg_204234;
            futhark_mc_task_236203.free_mem_219386 = mem_219386;
            futhark_mc_task_236203.free_mem_219389 = mem_219389;
            
            struct scheduler_segop futhark_mc_task_236203_task;
            
            futhark_mc_task_236203_task.args = &futhark_mc_task_236203;
            futhark_mc_task_236203_task.top_level_fn =
                futhark_mc_segmap_task_236204;
            futhark_mc_task_236203_task.name = "futhark_mc_segmap_task_236204";
            futhark_mc_task_236203_task.iterations = partition_sizze_203667;
            futhark_mc_task_236203_task.task_time =
                &ctx->futhark_mc_segmap_task_236204_total_time;
            futhark_mc_task_236203_task.task_iter =
                &ctx->futhark_mc_segmap_task_236204_total_iter;
            futhark_mc_task_236203_task.sched = STATIC;
            futhark_mc_task_236203_task.nested_fn =
                futhark_mc_segmap_nested_task_236207;
            
            int futhark_mc_segmap_task_236204_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236203_task);
            
            if (futhark_mc_segmap_task_236204_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_212095 = (int64_t) 0;
            int32_t num_tasks_229296;
            int64_t flat_tid_212101 = (int64_t) 0;
            struct futhark_mc_task_236215 futhark_mc_task_236215;
            
            futhark_mc_task_236215.ctx = ctx;
            futhark_mc_task_236215.free_n_203572 = n_203572;
            futhark_mc_task_236215.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236215.free_dyn_lifted_single_ma_l_arg_204234 =
                dyn_lifted_single_ma_l_arg_204234;
            futhark_mc_task_236215.free_bytes_217420 = bytes_217420;
            futhark_mc_task_236215.free_mem_219386 = mem_219386;
            futhark_mc_task_236215.free_mem_219389 = mem_219389;
            futhark_mc_task_236215.free_mem_219411 = mem_219411;
            
            struct scheduler_segop futhark_mc_task_236215_task;
            
            futhark_mc_task_236215_task.args = &futhark_mc_task_236215;
            futhark_mc_task_236215_task.top_level_fn =
                futhark_mc_segmap_task_236216;
            futhark_mc_task_236215_task.name = "futhark_mc_segmap_task_236216";
            futhark_mc_task_236215_task.iterations = partition_sizze_203667;
            futhark_mc_task_236215_task.task_time =
                &ctx->futhark_mc_segmap_task_236216_total_time;
            futhark_mc_task_236215_task.task_iter =
                &ctx->futhark_mc_segmap_task_236216_total_iter;
            futhark_mc_task_236215_task.sched = STATIC;
            futhark_mc_task_236215_task.nested_fn =
                futhark_mc_segmap_nested_task_236220;
            
            int futhark_mc_segmap_task_236216_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236215_task);
            
            if (futhark_mc_segmap_task_236216_err != 0) {
                if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            struct memblock ext_mem_219880;
            
            ext_mem_219880.references = NULL;
            
            struct memblock ext_mem_219879;
            
            ext_mem_219879.references = NULL;
            if (cond_204250) {
                bool match_lit_205280 = (int64_t) 0 == d_l_203580;
                struct memblock ext_mem_219529;
                
                ext_mem_219529.references = NULL;
                
                struct memblock ext_mem_219528;
                
                ext_mem_219528.references = NULL;
                if (match_lit_205280) {
                    struct memblock mem_219415;
                    
                    mem_219415.references = NULL;
                    if (memblock_alloc(ctx, &mem_219415, bytes_217890,
                                       "mem_219415")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_229365 = 0; i_229365 <
                         partition_sizze_203667; i_229365++) {
                        for (int64_t i_229366 = 0; i_229366 < l_n_m_203733;
                             i_229366++) {
                            ((double *) mem_219415.mem)[i_229365 *
                                                        l_n_m_203733 +
                                                        i_229366] = 0.0;
                        }
                    }
                    
                    struct memblock mem_219437;
                    
                    mem_219437.references = NULL;
                    if (memblock_alloc(ctx, &mem_219437, bytes_217890,
                                       "mem_219437")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t flat_tid_212130 = (int64_t) 0;
                    int32_t num_tasks_229367;
                    int64_t flat_tid_212204 = (int64_t) 0;
                    struct futhark_mc_task_236231 futhark_mc_task_236231;
                    
                    futhark_mc_task_236231.ctx = ctx;
                    futhark_mc_task_236231.free_n_203572 = n_203572;
                    futhark_mc_task_236231.free_q_l_203577 = q_l_203577;
                    futhark_mc_task_236231.free_jump_t_203582 = jump_t_203582;
                    futhark_mc_task_236231.free_partition_sizze_203667 =
                        partition_sizze_203667;
                    futhark_mc_task_236231.free_l_n_m_203733 = l_n_m_203733;
                    futhark_mc_task_236231.free_i_203760 = i_203760;
                    futhark_mc_task_236231.free_bytes_217838 = bytes_217838;
                    futhark_mc_task_236231.free_mem_217891 = mem_217891;
                    futhark_mc_task_236231.free_mem_217895 = mem_217895;
                    futhark_mc_task_236231.free_ctx_param_ext_217984 =
                        ctx_param_ext_217984;
                    futhark_mc_task_236231.free_ctx_param_ext_217985 =
                        ctx_param_ext_217985;
                    futhark_mc_task_236231.free_ctx_param_ext_217987 =
                        ctx_param_ext_217987;
                    futhark_mc_task_236231.free_mem_param_217989 =
                        mem_param_217989.mem;
                    futhark_mc_task_236231.free_mem_219411 = mem_219411;
                    futhark_mc_task_236231.free_mem_219437 = mem_219437.mem;
                    
                    struct scheduler_segop futhark_mc_task_236231_task;
                    
                    futhark_mc_task_236231_task.args = &futhark_mc_task_236231;
                    futhark_mc_task_236231_task.top_level_fn =
                        futhark_mc_segmap_task_236232;
                    futhark_mc_task_236231_task.name =
                        "futhark_mc_segmap_task_236232";
                    futhark_mc_task_236231_task.iterations =
                        partition_sizze_203667;
                    futhark_mc_task_236231_task.task_time =
                        &ctx->futhark_mc_segmap_task_236232_total_time;
                    futhark_mc_task_236231_task.task_iter =
                        &ctx->futhark_mc_segmap_task_236232_total_iter;
                    futhark_mc_task_236231_task.sched = STATIC;
                    futhark_mc_task_236231_task.nested_fn =
                        futhark_mc_segmap_nested_task_236236;
                    
                    int futhark_mc_segmap_task_236232_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_236231_task);
                    
                    if (futhark_mc_segmap_task_236232_err != 0) {
                        if (memblock_unref(ctx, &mem_219437, "mem_219437") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219415, "mem_219415") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219528,
                                           "ext_mem_219528") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219529,
                                           "ext_mem_219529") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219879,
                                           "ext_mem_219879") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219880,
                                           "ext_mem_219880") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219313,
                                           "ext_mem_219313") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219240,
                                           "ext_mem_219240") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219241,
                                           "ext_mem_219241") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218011,
                                           "mem_param_218011") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218003,
                                           "mem_param_218003") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220748,
                                           "ext_mem_220748") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220749,
                                           "ext_mem_220749") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217989,
                                           "mem_param_217989") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217981,
                                           "mem_param_217981") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217973,
                                           "mem_param_217973") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220993,
                                           "ext_mem_220993") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220994,
                                           "ext_mem_220994") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220995,
                                           "ext_mem_220995") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221150,
                                           "mem_out_221150") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221149,
                                           "mem_out_221149") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221148,
                                           "mem_out_221148") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_219529, &mem_219437,
                                     "mem_219437") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219528, &mem_219415,
                                     "mem_219415") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219437, "mem_219437") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219415, "mem_219415") != 0)
                        return 1;
                } else {
                    bool match_lit_205349 = (int64_t) 1 == d_l_203580;
                    struct memblock ext_mem_219527;
                    
                    ext_mem_219527.references = NULL;
                    
                    struct memblock ext_mem_219526;
                    
                    ext_mem_219526.references = NULL;
                    if (match_lit_205349) {
                        struct memblock mem_219477;
                        
                        mem_219477.references = NULL;
                        if (memblock_alloc(ctx, &mem_219477, bytes_217890,
                                           "mem_219477")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219481;
                        
                        mem_219481.references = NULL;
                        if (memblock_alloc(ctx, &mem_219481, bytes_217890,
                                           "mem_219481")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_212331 = (int64_t) 0;
                        int32_t num_tasks_229668;
                        int64_t flat_tid_212433 = (int64_t) 0;
                        struct futhark_mc_task_236257 futhark_mc_task_236257;
                        
                        futhark_mc_task_236257.ctx = ctx;
                        futhark_mc_task_236257.free_n_203572 = n_203572;
                        futhark_mc_task_236257.free_q_l_203577 = q_l_203577;
                        futhark_mc_task_236257.free_jump_t_203582 =
                            jump_t_203582;
                        futhark_mc_task_236257.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_236257.free_l_n_m_203733 = l_n_m_203733;
                        futhark_mc_task_236257.free_i_203760 = i_203760;
                        futhark_mc_task_236257.free_bytes_217838 = bytes_217838;
                        futhark_mc_task_236257.free_mem_217891 = mem_217891;
                        futhark_mc_task_236257.free_mem_217895 = mem_217895;
                        futhark_mc_task_236257.free_ctx_param_ext_217984 =
                            ctx_param_ext_217984;
                        futhark_mc_task_236257.free_ctx_param_ext_217985 =
                            ctx_param_ext_217985;
                        futhark_mc_task_236257.free_ctx_param_ext_217987 =
                            ctx_param_ext_217987;
                        futhark_mc_task_236257.free_mem_param_217989 =
                            mem_param_217989.mem;
                        futhark_mc_task_236257.free_mem_219411 = mem_219411;
                        futhark_mc_task_236257.free_mem_219477 = mem_219477.mem;
                        futhark_mc_task_236257.free_mem_219481 = mem_219481.mem;
                        
                        struct scheduler_segop futhark_mc_task_236257_task;
                        
                        futhark_mc_task_236257_task.args =
                            &futhark_mc_task_236257;
                        futhark_mc_task_236257_task.top_level_fn =
                            futhark_mc_segmap_task_236258;
                        futhark_mc_task_236257_task.name =
                            "futhark_mc_segmap_task_236258";
                        futhark_mc_task_236257_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_236257_task.task_time =
                            &ctx->futhark_mc_segmap_task_236258_total_time;
                        futhark_mc_task_236257_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236258_total_iter;
                        futhark_mc_task_236257_task.sched = STATIC;
                        futhark_mc_task_236257_task.nested_fn =
                            futhark_mc_segmap_nested_task_236263;
                        
                        int futhark_mc_segmap_task_236258_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236257_task);
                        
                        if (futhark_mc_segmap_task_236258_err != 0) {
                            if (memblock_unref(ctx, &mem_219481,
                                               "mem_219481") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219477,
                                               "mem_219477") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219526,
                                               "ext_mem_219526") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219527,
                                               "ext_mem_219527") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219528,
                                               "ext_mem_219528") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219529,
                                               "ext_mem_219529") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219879,
                                               "ext_mem_219879") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219880,
                                               "ext_mem_219880") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219313,
                                               "ext_mem_219313") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219527, &mem_219477,
                                         "mem_219477") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219526, &mem_219481,
                                         "mem_219481") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219481, "mem_219481") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219477, "mem_219477") != 0)
                            return 1;
                    } else {
                        struct memblock mem_219521;
                        
                        mem_219521.references = NULL;
                        if (memblock_alloc(ctx, &mem_219521, bytes_217890,
                                           "mem_219521")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219525;
                        
                        mem_219525.references = NULL;
                        if (memblock_alloc(ctx, &mem_219525, bytes_217890,
                                           "mem_219525")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_212617 = (int64_t) 0;
                        int32_t num_tasks_230107;
                        int64_t flat_tid_212751 = (int64_t) 0;
                        struct futhark_mc_task_236288 futhark_mc_task_236288;
                        
                        futhark_mc_task_236288.ctx = ctx;
                        futhark_mc_task_236288.free_n_203572 = n_203572;
                        futhark_mc_task_236288.free_q_l_203577 = q_l_203577;
                        futhark_mc_task_236288.free_jump_t_203582 =
                            jump_t_203582;
                        futhark_mc_task_236288.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_236288.free_l_n_m_203733 = l_n_m_203733;
                        futhark_mc_task_236288.free_i_203760 = i_203760;
                        futhark_mc_task_236288.free_bytes_217838 = bytes_217838;
                        futhark_mc_task_236288.free_mem_217891 = mem_217891;
                        futhark_mc_task_236288.free_mem_217895 = mem_217895;
                        futhark_mc_task_236288.free_ctx_param_ext_217984 =
                            ctx_param_ext_217984;
                        futhark_mc_task_236288.free_ctx_param_ext_217985 =
                            ctx_param_ext_217985;
                        futhark_mc_task_236288.free_ctx_param_ext_217987 =
                            ctx_param_ext_217987;
                        futhark_mc_task_236288.free_mem_param_217989 =
                            mem_param_217989.mem;
                        futhark_mc_task_236288.free_mem_219411 = mem_219411;
                        futhark_mc_task_236288.free_mem_219521 = mem_219521.mem;
                        futhark_mc_task_236288.free_mem_219525 = mem_219525.mem;
                        
                        struct scheduler_segop futhark_mc_task_236288_task;
                        
                        futhark_mc_task_236288_task.args =
                            &futhark_mc_task_236288;
                        futhark_mc_task_236288_task.top_level_fn =
                            futhark_mc_segmap_task_236289;
                        futhark_mc_task_236288_task.name =
                            "futhark_mc_segmap_task_236289";
                        futhark_mc_task_236288_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_236288_task.task_time =
                            &ctx->futhark_mc_segmap_task_236289_total_time;
                        futhark_mc_task_236288_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236289_total_iter;
                        futhark_mc_task_236288_task.sched = STATIC;
                        futhark_mc_task_236288_task.nested_fn =
                            futhark_mc_segmap_nested_task_236294;
                        
                        int futhark_mc_segmap_task_236289_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236288_task);
                        
                        if (futhark_mc_segmap_task_236289_err != 0) {
                            if (memblock_unref(ctx, &mem_219525,
                                               "mem_219525") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219521,
                                               "mem_219521") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219526,
                                               "ext_mem_219526") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219527,
                                               "ext_mem_219527") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219528,
                                               "ext_mem_219528") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219529,
                                               "ext_mem_219529") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219879,
                                               "ext_mem_219879") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219880,
                                               "ext_mem_219880") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219313,
                                               "ext_mem_219313") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219527, &mem_219521,
                                         "mem_219521") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219526, &mem_219525,
                                         "mem_219525") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219525, "mem_219525") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219521, "mem_219521") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_219529, &ext_mem_219527,
                                     "ext_mem_219527") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219528, &ext_mem_219526,
                                     "ext_mem_219526") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219526,
                                       "ext_mem_219526") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219527,
                                       "ext_mem_219527") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_219880, &ext_mem_219529,
                                 "ext_mem_219529") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_219879, &ext_mem_219528,
                                 "ext_mem_219528") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219528, "ext_mem_219528") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219529, "ext_mem_219529") != 0)
                    return 1;
            } else {
                bool match_lit_205574 = (int64_t) 0 == d_l_203580;
                struct memblock ext_mem_219878;
                
                ext_mem_219878.references = NULL;
                
                struct memblock ext_mem_219877;
                
                ext_mem_219877.references = NULL;
                if (match_lit_205574) {
                    struct memblock mem_219533;
                    
                    mem_219533.references = NULL;
                    if (memblock_alloc(ctx, &mem_219533, bytes_217890,
                                       "mem_219533")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_230678 = 0; i_230678 <
                         partition_sizze_203667; i_230678++) {
                        for (int64_t i_230679 = 0; i_230679 < l_n_m_203733;
                             i_230679++) {
                            ((double *) mem_219533.mem)[i_230678 *
                                                        l_n_m_203733 +
                                                        i_230679] = 0.0;
                        }
                    }
                    
                    struct memblock mem_219588;
                    
                    mem_219588.references = NULL;
                    if (memblock_alloc(ctx, &mem_219588, bytes_217890,
                                       "mem_219588")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t binop_y_219534 = (int64_t) 8 * q_l_203577;
                    int64_t bytes_219535 = smax64((int64_t) 0, binop_y_219534);
                    int64_t flat_tid_212999 = (int64_t) 0;
                    int32_t num_tasks_230680;
                    int64_t flat_tid_213059 = (int64_t) 0;
                    struct futhark_mc_task_236321 futhark_mc_task_236321;
                    
                    futhark_mc_task_236321.ctx = ctx;
                    futhark_mc_task_236321.free_n_203572 = n_203572;
                    futhark_mc_task_236321.free_q_l_203577 = q_l_203577;
                    futhark_mc_task_236321.free_jump_t_203582 = jump_t_203582;
                    futhark_mc_task_236321.free_partition_sizze_203667 =
                        partition_sizze_203667;
                    futhark_mc_task_236321.free_l_n_m_203733 = l_n_m_203733;
                    futhark_mc_task_236321.free_i_203760 = i_203760;
                    futhark_mc_task_236321.free_bytes_217838 = bytes_217838;
                    futhark_mc_task_236321.free_mem_217891 = mem_217891;
                    futhark_mc_task_236321.free_mem_217895 = mem_217895;
                    futhark_mc_task_236321.free_ctx_param_ext_217984 =
                        ctx_param_ext_217984;
                    futhark_mc_task_236321.free_ctx_param_ext_217985 =
                        ctx_param_ext_217985;
                    futhark_mc_task_236321.free_ctx_param_ext_217987 =
                        ctx_param_ext_217987;
                    futhark_mc_task_236321.free_mem_param_217989 =
                        mem_param_217989.mem;
                    futhark_mc_task_236321.free_mem_219411 = mem_219411;
                    futhark_mc_task_236321.free_bytes_219535 = bytes_219535;
                    futhark_mc_task_236321.free_mem_219588 = mem_219588.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_203667;
                    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_236327;
                    
                    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_219588, "mem_219588") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219533, "mem_219533") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219877,
                                           "ext_mem_219877") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219878,
                                           "ext_mem_219878") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219879,
                                           "ext_mem_219879") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219880,
                                           "ext_mem_219880") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219313,
                                           "ext_mem_219313") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219240,
                                           "ext_mem_219240") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219241,
                                           "ext_mem_219241") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218011,
                                           "mem_param_218011") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218003,
                                           "mem_param_218003") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220748,
                                           "ext_mem_220748") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220749,
                                           "ext_mem_220749") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217989,
                                           "mem_param_217989") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217981,
                                           "mem_param_217981") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217973,
                                           "mem_param_217973") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220993,
                                           "ext_mem_220993") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220994,
                                           "ext_mem_220994") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220995,
                                           "ext_mem_220995") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221150,
                                           "mem_out_221150") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221149,
                                           "mem_out_221149") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221148,
                                           "mem_out_221148") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_219878, &mem_219588,
                                     "mem_219588") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219877, &mem_219533,
                                     "mem_219533") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219588, "mem_219588") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219533, "mem_219533") != 0)
                        return 1;
                } else {
                    bool match_lit_205629 = (int64_t) 1 == d_l_203580;
                    struct memblock ext_mem_219876;
                    
                    ext_mem_219876.references = NULL;
                    
                    struct memblock ext_mem_219875;
                    
                    ext_mem_219875.references = NULL;
                    if (match_lit_205629) {
                        struct memblock mem_219694;
                        
                        mem_219694.references = NULL;
                        if (memblock_alloc(ctx, &mem_219694, bytes_217890,
                                           "mem_219694")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219698;
                        
                        mem_219698.references = NULL;
                        if (memblock_alloc(ctx, &mem_219698, bytes_217890,
                                           "mem_219698")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_219589 = (int64_t) 8 * q_l_203577;
                        int64_t bytes_219590 = smax64((int64_t) 0,
                                                      binop_y_219589);
                        int64_t flat_tid_213158 = (int64_t) 0;
                        int32_t num_tasks_230921;
                        int64_t flat_tid_213247 = (int64_t) 0;
                        struct futhark_mc_task_236350 futhark_mc_task_236350;
                        
                        futhark_mc_task_236350.ctx = ctx;
                        futhark_mc_task_236350.free_n_203572 = n_203572;
                        futhark_mc_task_236350.free_q_l_203577 = q_l_203577;
                        futhark_mc_task_236350.free_jump_t_203582 =
                            jump_t_203582;
                        futhark_mc_task_236350.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_236350.free_l_n_m_203733 = l_n_m_203733;
                        futhark_mc_task_236350.free_i_203760 = i_203760;
                        futhark_mc_task_236350.free_bytes_217838 = bytes_217838;
                        futhark_mc_task_236350.free_mem_217891 = mem_217891;
                        futhark_mc_task_236350.free_mem_217895 = mem_217895;
                        futhark_mc_task_236350.free_ctx_param_ext_217984 =
                            ctx_param_ext_217984;
                        futhark_mc_task_236350.free_ctx_param_ext_217985 =
                            ctx_param_ext_217985;
                        futhark_mc_task_236350.free_ctx_param_ext_217987 =
                            ctx_param_ext_217987;
                        futhark_mc_task_236350.free_mem_param_217989 =
                            mem_param_217989.mem;
                        futhark_mc_task_236350.free_mem_219411 = mem_219411;
                        futhark_mc_task_236350.free_bytes_219590 = bytes_219590;
                        futhark_mc_task_236350.free_mem_219694 = mem_219694.mem;
                        futhark_mc_task_236350.free_mem_219698 = mem_219698.mem;
                        
                        struct scheduler_segop futhark_mc_task_236350_task;
                        
                        futhark_mc_task_236350_task.args =
                            &futhark_mc_task_236350;
                        futhark_mc_task_236350_task.top_level_fn =
                            futhark_mc_segmap_task_236351;
                        futhark_mc_task_236350_task.name =
                            "futhark_mc_segmap_task_236351";
                        futhark_mc_task_236350_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_236350_task.task_time =
                            &ctx->futhark_mc_segmap_task_236351_total_time;
                        futhark_mc_task_236350_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236351_total_iter;
                        futhark_mc_task_236350_task.sched = STATIC;
                        futhark_mc_task_236350_task.nested_fn =
                            futhark_mc_segmap_nested_task_236358;
                        
                        int futhark_mc_segmap_task_236351_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236350_task);
                        
                        if (futhark_mc_segmap_task_236351_err != 0) {
                            if (memblock_unref(ctx, &mem_219698,
                                               "mem_219698") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219694,
                                               "mem_219694") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219875,
                                               "ext_mem_219875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219876,
                                               "ext_mem_219876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219877,
                                               "ext_mem_219877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219878,
                                               "ext_mem_219878") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219879,
                                               "ext_mem_219879") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219880,
                                               "ext_mem_219880") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219313,
                                               "ext_mem_219313") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219876, &mem_219694,
                                         "mem_219694") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219875, &mem_219698,
                                         "mem_219698") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219698, "mem_219698") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219694, "mem_219694") != 0)
                            return 1;
                    } else {
                        struct memblock mem_219870;
                        
                        mem_219870.references = NULL;
                        if (memblock_alloc(ctx, &mem_219870, bytes_217890,
                                           "mem_219870")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_219874;
                        
                        mem_219874.references = NULL;
                        if (memblock_alloc(ctx, &mem_219874, bytes_217890,
                                           "mem_219874")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_219699 = (int64_t) 8 * q_l_203577;
                        int64_t bytes_219700 = smax64((int64_t) 0,
                                                      binop_y_219699);
                        int64_t flat_tid_213405 = (int64_t) 0;
                        int32_t num_tasks_231315;
                        int64_t flat_tid_213534 = (int64_t) 0;
                        struct futhark_mc_task_236387 futhark_mc_task_236387;
                        
                        futhark_mc_task_236387.ctx = ctx;
                        futhark_mc_task_236387.free_n_203572 = n_203572;
                        futhark_mc_task_236387.free_q_l_203577 = q_l_203577;
                        futhark_mc_task_236387.free_jump_t_203582 =
                            jump_t_203582;
                        futhark_mc_task_236387.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_236387.free_l_n_m_203733 = l_n_m_203733;
                        futhark_mc_task_236387.free_i_203760 = i_203760;
                        futhark_mc_task_236387.free_bytes_217838 = bytes_217838;
                        futhark_mc_task_236387.free_mem_217891 = mem_217891;
                        futhark_mc_task_236387.free_mem_217895 = mem_217895;
                        futhark_mc_task_236387.free_ctx_param_ext_217984 =
                            ctx_param_ext_217984;
                        futhark_mc_task_236387.free_ctx_param_ext_217985 =
                            ctx_param_ext_217985;
                        futhark_mc_task_236387.free_ctx_param_ext_217987 =
                            ctx_param_ext_217987;
                        futhark_mc_task_236387.free_mem_param_217989 =
                            mem_param_217989.mem;
                        futhark_mc_task_236387.free_mem_219411 = mem_219411;
                        futhark_mc_task_236387.free_bytes_219700 = bytes_219700;
                        futhark_mc_task_236387.free_mem_219870 = mem_219870.mem;
                        futhark_mc_task_236387.free_mem_219874 = mem_219874.mem;
                        
                        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 =
                            partition_sizze_203667;
                        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 =
                            futhark_mc_segmap_nested_task_236397;
                        
                        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) {
                            if (memblock_unref(ctx, &mem_219874,
                                               "mem_219874") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219870,
                                               "mem_219870") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219875,
                                               "ext_mem_219875") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219876,
                                               "ext_mem_219876") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219877,
                                               "ext_mem_219877") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219878,
                                               "ext_mem_219878") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219879,
                                               "ext_mem_219879") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219880,
                                               "ext_mem_219880") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219313,
                                               "ext_mem_219313") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_219876, &mem_219870,
                                         "mem_219870") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_219875, &mem_219874,
                                         "mem_219874") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219874, "mem_219874") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219870, "mem_219870") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_219878, &ext_mem_219876,
                                     "ext_mem_219876") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_219877, &ext_mem_219875,
                                     "ext_mem_219875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219875,
                                       "ext_mem_219875") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219876,
                                       "ext_mem_219876") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_219880, &ext_mem_219878,
                                 "ext_mem_219878") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_219879, &ext_mem_219877,
                                 "ext_mem_219877") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219877, "ext_mem_219877") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219878, "ext_mem_219878") != 0)
                    return 1;
            }
            
            struct memblock ext_mem_219903;
            
            ext_mem_219903.references = NULL;
            if (cond_204197) {
                bool zzero_205873 = jump_l_203583 == (int64_t) 0;
                bool nonzzero_205874 = !zzero_205873;
                bool nonzzero_cert_205875;
                
                if (!nonzzero_205874) {
                    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_219903,
                                       "ext_mem_219903") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219879,
                                       "ext_mem_219879") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219880,
                                       "ext_mem_219880") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219313,
                                       "ext_mem_219313") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219240,
                                       "ext_mem_219240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219241,
                                       "ext_mem_219241") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218011,
                                       "mem_param_218011") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218003,
                                       "mem_param_218003") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220748,
                                       "ext_mem_220748") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220749,
                                       "ext_mem_220749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217989,
                                       "mem_param_217989") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217981,
                                       "mem_param_217981") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217973,
                                       "mem_param_217973") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220993,
                                       "ext_mem_220993") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220994,
                                       "ext_mem_220994") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220995,
                                       "ext_mem_220995") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221150,
                                       "mem_out_221150") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221149,
                                       "mem_out_221149") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221148,
                                       "mem_out_221148") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                int64_t y_205876 = sub64(l_n_m_203733, (int64_t) 1);
                struct memblock mem_219902;
                
                mem_219902.references = NULL;
                if (memblock_alloc(ctx, &mem_219902, bytes_217457,
                                   "mem_219902")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t flat_tid_213766 = (int64_t) 0;
                int32_t num_tasks_231896;
                int64_t flat_tid_213772 = (int64_t) 0;
                struct futhark_mc_task_236436 futhark_mc_task_236436;
                
                futhark_mc_task_236436.ctx = ctx;
                futhark_mc_task_236436.free_n_203572 = n_203572;
                futhark_mc_task_236436.free_jump_l_203583 = jump_l_203583;
                futhark_mc_task_236436.free_partition_sizze_203667 =
                    partition_sizze_203667;
                futhark_mc_task_236436.free_l_n_m_203733 = l_n_m_203733;
                futhark_mc_task_236436.free_i_203760 = i_203760;
                futhark_mc_task_236436.free_y_205876 = y_205876;
                futhark_mc_task_236436.free_bytes_217420 = bytes_217420;
                futhark_mc_task_236436.free_ext_mem_219879 = ext_mem_219879.mem;
                futhark_mc_task_236436.free_ext_mem_219880 = ext_mem_219880.mem;
                futhark_mc_task_236436.free_mem_219902 = mem_219902.mem;
                
                struct scheduler_segop futhark_mc_task_236436_task;
                
                futhark_mc_task_236436_task.args = &futhark_mc_task_236436;
                futhark_mc_task_236436_task.top_level_fn =
                    futhark_mc_segmap_task_236437;
                futhark_mc_task_236436_task.name =
                    "futhark_mc_segmap_task_236437";
                futhark_mc_task_236436_task.iterations = partition_sizze_203667;
                futhark_mc_task_236436_task.task_time =
                    &ctx->futhark_mc_segmap_task_236437_total_time;
                futhark_mc_task_236436_task.task_iter =
                    &ctx->futhark_mc_segmap_task_236437_total_iter;
                futhark_mc_task_236436_task.sched = STATIC;
                futhark_mc_task_236436_task.nested_fn =
                    futhark_mc_segmap_nested_task_236441;
                
                int futhark_mc_segmap_task_236437_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_236436_task);
                
                if (futhark_mc_segmap_task_236437_err != 0) {
                    if (memblock_unref(ctx, &mem_219902, "mem_219902") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219903,
                                       "ext_mem_219903") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219879,
                                       "ext_mem_219879") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219880,
                                       "ext_mem_219880") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219313,
                                       "ext_mem_219313") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219240,
                                       "ext_mem_219240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219241,
                                       "ext_mem_219241") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218011,
                                       "mem_param_218011") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218003,
                                       "mem_param_218003") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220748,
                                       "ext_mem_220748") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220749,
                                       "ext_mem_220749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217989,
                                       "mem_param_217989") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217981,
                                       "mem_param_217981") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217973,
                                       "mem_param_217973") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220993,
                                       "ext_mem_220993") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220994,
                                       "ext_mem_220994") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220995,
                                       "ext_mem_220995") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221150,
                                       "mem_out_221150") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221149,
                                       "mem_out_221149") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221148,
                                       "mem_out_221148") != 0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_219903, &mem_219902,
                                 "mem_219902") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_219902, "mem_219902") != 0)
                    return 1;
            } else {
                bool dim_match_205928 = n_203572 == l_n_m_203733;
                bool empty_or_match_cert_205929;
                
                if (!dim_match_205928) {
                    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_203667, ", ",
                                  (long long) l_n_m_203733,
                                  ") cannot match shape of type `[",
                                  (long long) partition_sizze_203667, "][",
                                  (long long) n_203572, "]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_219903,
                                       "ext_mem_219903") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219879,
                                       "ext_mem_219879") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219880,
                                       "ext_mem_219880") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219313,
                                       "ext_mem_219313") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219240,
                                       "ext_mem_219240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219241,
                                       "ext_mem_219241") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218011,
                                       "mem_param_218011") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218003,
                                       "mem_param_218003") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220748,
                                       "ext_mem_220748") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220749,
                                       "ext_mem_220749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217989,
                                       "mem_param_217989") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217981,
                                       "mem_param_217981") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217973,
                                       "mem_param_217973") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220993,
                                       "ext_mem_220993") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220994,
                                       "ext_mem_220994") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220995,
                                       "ext_mem_220995") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221150,
                                       "mem_out_221150") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221149,
                                       "mem_out_221149") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221148,
                                       "mem_out_221148") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_219903, &ext_mem_219880,
                                 "ext_mem_219880") != 0)
                    return 1;
            }
            if (memblock_unref(ctx, &ext_mem_219879, "ext_mem_219879") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219880, "ext_mem_219880") != 0)
                return 1;
            
            struct memblock mem_219926;
            
            mem_219926.references = NULL;
            if (memblock_alloc(ctx, &mem_219926, bytes_217457, "mem_219926")) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_213826 = (int64_t) 0;
            int32_t num_tasks_232006;
            int64_t flat_tid_213832 = (int64_t) 0;
            struct futhark_mc_task_236449 futhark_mc_task_236449;
            
            futhark_mc_task_236449.ctx = ctx;
            futhark_mc_task_236449.free_n_203572 = n_203572;
            futhark_mc_task_236449.free_n_p_203574 = n_p_203574;
            futhark_mc_task_236449.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236449.free_C_len_203724 = C_len_203724;
            futhark_mc_task_236449.free_bytes_217420 = bytes_217420;
            futhark_mc_task_236449.free_mem_219336 = mem_219336;
            futhark_mc_task_236449.free_ext_mem_219903 = ext_mem_219903.mem;
            futhark_mc_task_236449.free_ext_219904 = ext_219904;
            futhark_mc_task_236449.free_mem_219926 = mem_219926.mem;
            
            struct scheduler_segop futhark_mc_task_236449_task;
            
            futhark_mc_task_236449_task.args = &futhark_mc_task_236449;
            futhark_mc_task_236449_task.top_level_fn =
                futhark_mc_segmap_task_236450;
            futhark_mc_task_236449_task.name = "futhark_mc_segmap_task_236450";
            futhark_mc_task_236449_task.iterations = partition_sizze_203667;
            futhark_mc_task_236449_task.task_time =
                &ctx->futhark_mc_segmap_task_236450_total_time;
            futhark_mc_task_236449_task.task_iter =
                &ctx->futhark_mc_segmap_task_236450_total_iter;
            futhark_mc_task_236449_task.sched = STATIC;
            futhark_mc_task_236449_task.nested_fn =
                futhark_mc_segmap_nested_task_236454;
            
            int futhark_mc_segmap_task_236450_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236449_task);
            
            if (futhark_mc_segmap_task_236450_err != 0) {
                if (memblock_unref(ctx, &mem_219926, "mem_219926") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219903, "ext_mem_219903") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219879, "ext_mem_219879") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219880, "ext_mem_219880") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            if (memblock_unref(ctx, &ext_mem_219903, "ext_mem_219903") != 0)
                return 1;
            
            struct memblock ext_mem_220719;
            
            ext_mem_220719.references = NULL;
            
            struct memblock ext_mem_220718;
            
            ext_mem_220718.references = NULL;
            if (cond_204255) {
                bool match_lit_205941 = (int64_t) 0 == d_t_203579;
                struct memblock ext_mem_220206;
                
                ext_mem_220206.references = NULL;
                
                struct memblock ext_mem_220205;
                
                ext_mem_220205.references = NULL;
                if (match_lit_205941) {
                    struct memblock mem_219930;
                    
                    mem_219930.references = NULL;
                    if (memblock_alloc(ctx, &mem_219930, bytes_217952,
                                       "mem_219930")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_232031 = 0; i_232031 <
                         partition_sizze_203667; i_232031++) {
                        for (int64_t i_232032 = 0; i_232032 < t_n_m_203740;
                             i_232032++) {
                            ((double *) mem_219930.mem)[i_232031 *
                                                        t_n_m_203740 +
                                                        i_232032] = 0.0;
                        }
                    }
                    
                    struct memblock mem_220006;
                    
                    mem_220006.references = NULL;
                    if (memblock_alloc(ctx, &mem_220006, bytes_217952,
                                       "mem_220006")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t flat_tid_213842 = (int64_t) 0;
                    int32_t num_tasks_232033;
                    int64_t flat_tid_213922 = (int64_t) 0;
                    struct futhark_mc_task_236462 futhark_mc_task_236462;
                    
                    futhark_mc_task_236462.ctx = ctx;
                    futhark_mc_task_236462.free_n_203572 = n_203572;
                    futhark_mc_task_236462.free_q_t_203576 = q_t_203576;
                    futhark_mc_task_236462.free_jump_t_203582 = jump_t_203582;
                    futhark_mc_task_236462.free_partition_sizze_203667 =
                        partition_sizze_203667;
                    futhark_mc_task_236462.free_t_n_m_203740 = t_n_m_203740;
                    futhark_mc_task_236462.free_i_203760 = i_203760;
                    futhark_mc_task_236462.free_mem_217415 = mem_217415;
                    futhark_mc_task_236462.free_bytes_217420 = bytes_217420;
                    futhark_mc_task_236462.free_mem_217458 = mem_217458;
                    futhark_mc_task_236462.free_mem_217461 = mem_217461;
                    futhark_mc_task_236462.free_bytes_217900 = bytes_217900;
                    futhark_mc_task_236462.free_mem_217953 = mem_217953;
                    futhark_mc_task_236462.free_mem_217957 = mem_217957;
                    futhark_mc_task_236462.free_ctx_param_ext_217984 =
                        ctx_param_ext_217984;
                    futhark_mc_task_236462.free_ctx_param_ext_217985 =
                        ctx_param_ext_217985;
                    futhark_mc_task_236462.free_ctx_param_ext_217987 =
                        ctx_param_ext_217987;
                    futhark_mc_task_236462.free_mem_param_217989 =
                        mem_param_217989.mem;
                    futhark_mc_task_236462.free_mem_219926 = mem_219926.mem;
                    futhark_mc_task_236462.free_mem_220006 = mem_220006.mem;
                    
                    struct scheduler_segop futhark_mc_task_236462_task;
                    
                    futhark_mc_task_236462_task.args = &futhark_mc_task_236462;
                    futhark_mc_task_236462_task.top_level_fn =
                        futhark_mc_segmap_task_236463;
                    futhark_mc_task_236462_task.name =
                        "futhark_mc_segmap_task_236463";
                    futhark_mc_task_236462_task.iterations =
                        partition_sizze_203667;
                    futhark_mc_task_236462_task.task_time =
                        &ctx->futhark_mc_segmap_task_236463_total_time;
                    futhark_mc_task_236462_task.task_iter =
                        &ctx->futhark_mc_segmap_task_236463_total_iter;
                    futhark_mc_task_236462_task.sched = STATIC;
                    futhark_mc_task_236462_task.nested_fn =
                        futhark_mc_segmap_nested_task_236470;
                    
                    int futhark_mc_segmap_task_236463_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_236462_task);
                    
                    if (futhark_mc_segmap_task_236463_err != 0) {
                        if (memblock_unref(ctx, &mem_220006, "mem_220006") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219930, "mem_219930") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220205,
                                           "ext_mem_220205") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220206,
                                           "ext_mem_220206") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220718,
                                           "ext_mem_220718") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220719,
                                           "ext_mem_220719") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219926, "mem_219926") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219903,
                                           "ext_mem_219903") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219879,
                                           "ext_mem_219879") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219880,
                                           "ext_mem_219880") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219313,
                                           "ext_mem_219313") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219240,
                                           "ext_mem_219240") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219241,
                                           "ext_mem_219241") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218011,
                                           "mem_param_218011") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218003,
                                           "mem_param_218003") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220748,
                                           "ext_mem_220748") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220749,
                                           "ext_mem_220749") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217989,
                                           "mem_param_217989") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217981,
                                           "mem_param_217981") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217973,
                                           "mem_param_217973") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220993,
                                           "ext_mem_220993") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220994,
                                           "ext_mem_220994") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220995,
                                           "ext_mem_220995") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221150,
                                           "mem_out_221150") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221149,
                                           "mem_out_221149") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221148,
                                           "mem_out_221148") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_220206, &mem_220006,
                                     "mem_220006") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_220205, &mem_219930,
                                     "mem_219930") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_220006, "mem_220006") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219930, "mem_219930") != 0)
                        return 1;
                } else {
                    bool match_lit_206033 = (int64_t) 1 == d_t_203579;
                    struct memblock ext_mem_220204;
                    
                    ext_mem_220204.references = NULL;
                    
                    struct memblock ext_mem_220203;
                    
                    ext_mem_220203.references = NULL;
                    if (match_lit_206033) {
                        struct memblock mem_220100;
                        
                        mem_220100.references = NULL;
                        if (memblock_alloc(ctx, &mem_220100, bytes_217952,
                                           "mem_220100")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_220104;
                        
                        mem_220104.references = NULL;
                        if (memblock_alloc(ctx, &mem_220104, bytes_217952,
                                           "mem_220104")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_214078 = (int64_t) 0;
                        int32_t num_tasks_232405;
                        int64_t flat_tid_214186 = (int64_t) 0;
                        struct futhark_mc_task_236502 futhark_mc_task_236502;
                        
                        futhark_mc_task_236502.ctx = ctx;
                        futhark_mc_task_236502.free_n_203572 = n_203572;
                        futhark_mc_task_236502.free_q_t_203576 = q_t_203576;
                        futhark_mc_task_236502.free_jump_t_203582 =
                            jump_t_203582;
                        futhark_mc_task_236502.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_236502.free_t_n_m_203740 = t_n_m_203740;
                        futhark_mc_task_236502.free_i_203760 = i_203760;
                        futhark_mc_task_236502.free_mem_217415 = mem_217415;
                        futhark_mc_task_236502.free_bytes_217420 = bytes_217420;
                        futhark_mc_task_236502.free_mem_217458 = mem_217458;
                        futhark_mc_task_236502.free_mem_217461 = mem_217461;
                        futhark_mc_task_236502.free_bytes_217900 = bytes_217900;
                        futhark_mc_task_236502.free_mem_217953 = mem_217953;
                        futhark_mc_task_236502.free_mem_217957 = mem_217957;
                        futhark_mc_task_236502.free_ctx_param_ext_217984 =
                            ctx_param_ext_217984;
                        futhark_mc_task_236502.free_ctx_param_ext_217985 =
                            ctx_param_ext_217985;
                        futhark_mc_task_236502.free_ctx_param_ext_217987 =
                            ctx_param_ext_217987;
                        futhark_mc_task_236502.free_mem_param_217989 =
                            mem_param_217989.mem;
                        futhark_mc_task_236502.free_mem_219926 = mem_219926.mem;
                        futhark_mc_task_236502.free_mem_220100 = mem_220100.mem;
                        futhark_mc_task_236502.free_mem_220104 = mem_220104.mem;
                        
                        struct scheduler_segop futhark_mc_task_236502_task;
                        
                        futhark_mc_task_236502_task.args =
                            &futhark_mc_task_236502;
                        futhark_mc_task_236502_task.top_level_fn =
                            futhark_mc_segmap_task_236503;
                        futhark_mc_task_236502_task.name =
                            "futhark_mc_segmap_task_236503";
                        futhark_mc_task_236502_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_236502_task.task_time =
                            &ctx->futhark_mc_segmap_task_236503_total_time;
                        futhark_mc_task_236502_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236503_total_iter;
                        futhark_mc_task_236502_task.sched = STATIC;
                        futhark_mc_task_236502_task.nested_fn =
                            futhark_mc_segmap_nested_task_236511;
                        
                        int futhark_mc_segmap_task_236503_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236502_task);
                        
                        if (futhark_mc_segmap_task_236503_err != 0) {
                            if (memblock_unref(ctx, &mem_220104,
                                               "mem_220104") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_220100,
                                               "mem_220100") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220203,
                                               "ext_mem_220203") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220204,
                                               "ext_mem_220204") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220205,
                                               "ext_mem_220205") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220206,
                                               "ext_mem_220206") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220718,
                                               "ext_mem_220718") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220719,
                                               "ext_mem_220719") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219926,
                                               "mem_219926") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219903,
                                               "ext_mem_219903") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219879,
                                               "ext_mem_219879") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219880,
                                               "ext_mem_219880") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219313,
                                               "ext_mem_219313") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_220204, &mem_220100,
                                         "mem_220100") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_220203, &mem_220104,
                                         "mem_220104") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220104, "mem_220104") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220100, "mem_220100") != 0)
                            return 1;
                    } else {
                        struct memblock mem_220198;
                        
                        mem_220198.references = NULL;
                        if (memblock_alloc(ctx, &mem_220198, bytes_217952,
                                           "mem_220198")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_220202;
                        
                        mem_220202.references = NULL;
                        if (memblock_alloc(ctx, &mem_220202, bytes_217952,
                                           "mem_220202")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_214399 = (int64_t) 0;
                        int32_t num_tasks_232915;
                        int64_t flat_tid_214539 = (int64_t) 0;
                        struct futhark_mc_task_236547 futhark_mc_task_236547;
                        
                        futhark_mc_task_236547.ctx = ctx;
                        futhark_mc_task_236547.free_n_203572 = n_203572;
                        futhark_mc_task_236547.free_q_t_203576 = q_t_203576;
                        futhark_mc_task_236547.free_jump_t_203582 =
                            jump_t_203582;
                        futhark_mc_task_236547.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_236547.free_t_n_m_203740 = t_n_m_203740;
                        futhark_mc_task_236547.free_i_203760 = i_203760;
                        futhark_mc_task_236547.free_mem_217415 = mem_217415;
                        futhark_mc_task_236547.free_bytes_217420 = bytes_217420;
                        futhark_mc_task_236547.free_mem_217458 = mem_217458;
                        futhark_mc_task_236547.free_mem_217461 = mem_217461;
                        futhark_mc_task_236547.free_bytes_217900 = bytes_217900;
                        futhark_mc_task_236547.free_mem_217953 = mem_217953;
                        futhark_mc_task_236547.free_mem_217957 = mem_217957;
                        futhark_mc_task_236547.free_ctx_param_ext_217984 =
                            ctx_param_ext_217984;
                        futhark_mc_task_236547.free_ctx_param_ext_217985 =
                            ctx_param_ext_217985;
                        futhark_mc_task_236547.free_ctx_param_ext_217987 =
                            ctx_param_ext_217987;
                        futhark_mc_task_236547.free_mem_param_217989 =
                            mem_param_217989.mem;
                        futhark_mc_task_236547.free_mem_219926 = mem_219926.mem;
                        futhark_mc_task_236547.free_mem_220198 = mem_220198.mem;
                        futhark_mc_task_236547.free_mem_220202 = mem_220202.mem;
                        
                        struct scheduler_segop futhark_mc_task_236547_task;
                        
                        futhark_mc_task_236547_task.args =
                            &futhark_mc_task_236547;
                        futhark_mc_task_236547_task.top_level_fn =
                            futhark_mc_segmap_task_236548;
                        futhark_mc_task_236547_task.name =
                            "futhark_mc_segmap_task_236548";
                        futhark_mc_task_236547_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_236547_task.task_time =
                            &ctx->futhark_mc_segmap_task_236548_total_time;
                        futhark_mc_task_236547_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236548_total_iter;
                        futhark_mc_task_236547_task.sched = STATIC;
                        futhark_mc_task_236547_task.nested_fn =
                            futhark_mc_segmap_nested_task_236556;
                        
                        int futhark_mc_segmap_task_236548_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236547_task);
                        
                        if (futhark_mc_segmap_task_236548_err != 0) {
                            if (memblock_unref(ctx, &mem_220202,
                                               "mem_220202") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_220198,
                                               "mem_220198") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220203,
                                               "ext_mem_220203") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220204,
                                               "ext_mem_220204") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220205,
                                               "ext_mem_220205") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220206,
                                               "ext_mem_220206") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220718,
                                               "ext_mem_220718") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220719,
                                               "ext_mem_220719") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219926,
                                               "mem_219926") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219903,
                                               "ext_mem_219903") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219879,
                                               "ext_mem_219879") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219880,
                                               "ext_mem_219880") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219313,
                                               "ext_mem_219313") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_220204, &mem_220198,
                                         "mem_220198") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_220203, &mem_220202,
                                         "mem_220202") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220202, "mem_220202") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220198, "mem_220198") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_220206, &ext_mem_220204,
                                     "ext_mem_220204") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_220205, &ext_mem_220203,
                                     "ext_mem_220203") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220203,
                                       "ext_mem_220203") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220204,
                                       "ext_mem_220204") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_220719, &ext_mem_220206,
                                 "ext_mem_220206") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_220718, &ext_mem_220205,
                                 "ext_mem_220205") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220205, "ext_mem_220205") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220206, "ext_mem_220206") != 0)
                    return 1;
            } else {
                bool match_lit_206304 = (int64_t) 0 == d_t_203579;
                struct memblock ext_mem_220717;
                
                ext_mem_220717.references = NULL;
                
                struct memblock ext_mem_220716;
                
                ext_mem_220716.references = NULL;
                if (match_lit_206304) {
                    struct memblock mem_220210;
                    
                    mem_220210.references = NULL;
                    if (memblock_alloc(ctx, &mem_220210, bytes_217952,
                                       "mem_220210")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_233557 = 0; i_233557 <
                         partition_sizze_203667; i_233557++) {
                        for (int64_t i_233558 = 0; i_233558 < t_n_m_203740;
                             i_233558++) {
                            ((double *) mem_220210.mem)[i_233557 *
                                                        t_n_m_203740 +
                                                        i_233558] = 0.0;
                        }
                    }
                    
                    struct memblock mem_220319;
                    
                    mem_220319.references = NULL;
                    if (memblock_alloc(ctx, &mem_220319, bytes_217952,
                                       "mem_220319")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t binop_y_220220 = (int64_t) 8 * q_t_203576;
                    int64_t bytes_220221 = smax64((int64_t) 0, binop_y_220220);
                    int64_t flat_tid_214816 = (int64_t) 0;
                    int32_t num_tasks_233559;
                    int64_t flat_tid_214881 = (int64_t) 0;
                    struct futhark_mc_task_236594 futhark_mc_task_236594;
                    
                    futhark_mc_task_236594.ctx = ctx;
                    futhark_mc_task_236594.free_n_203572 = n_203572;
                    futhark_mc_task_236594.free_q_t_203576 = q_t_203576;
                    futhark_mc_task_236594.free_jump_t_203582 = jump_t_203582;
                    futhark_mc_task_236594.free_partition_sizze_203667 =
                        partition_sizze_203667;
                    futhark_mc_task_236594.free_t_n_m_203740 = t_n_m_203740;
                    futhark_mc_task_236594.free_i_203760 = i_203760;
                    futhark_mc_task_236594.free_mem_217415 = mem_217415;
                    futhark_mc_task_236594.free_bytes_217420 = bytes_217420;
                    futhark_mc_task_236594.free_mem_217458 = mem_217458;
                    futhark_mc_task_236594.free_mem_217461 = mem_217461;
                    futhark_mc_task_236594.free_bytes_217900 = bytes_217900;
                    futhark_mc_task_236594.free_mem_217953 = mem_217953;
                    futhark_mc_task_236594.free_mem_217957 = mem_217957;
                    futhark_mc_task_236594.free_ctx_param_ext_217984 =
                        ctx_param_ext_217984;
                    futhark_mc_task_236594.free_ctx_param_ext_217985 =
                        ctx_param_ext_217985;
                    futhark_mc_task_236594.free_ctx_param_ext_217987 =
                        ctx_param_ext_217987;
                    futhark_mc_task_236594.free_mem_param_217989 =
                        mem_param_217989.mem;
                    futhark_mc_task_236594.free_mem_219926 = mem_219926.mem;
                    futhark_mc_task_236594.free_bytes_220221 = bytes_220221;
                    futhark_mc_task_236594.free_mem_220319 = mem_220319.mem;
                    
                    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 =
                        partition_sizze_203667;
                    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 =
                        futhark_mc_segmap_nested_task_236603;
                    
                    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) {
                        if (memblock_unref(ctx, &mem_220319, "mem_220319") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220210, "mem_220210") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220716,
                                           "ext_mem_220716") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220717,
                                           "ext_mem_220717") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220718,
                                           "ext_mem_220718") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220719,
                                           "ext_mem_220719") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_219926, "mem_219926") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219903,
                                           "ext_mem_219903") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219879,
                                           "ext_mem_219879") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219880,
                                           "ext_mem_219880") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219313,
                                           "ext_mem_219313") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219240,
                                           "ext_mem_219240") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_219241,
                                           "ext_mem_219241") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218011,
                                           "mem_param_218011") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_218003,
                                           "mem_param_218003") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220748,
                                           "ext_mem_220748") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220749,
                                           "ext_mem_220749") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217989,
                                           "mem_param_217989") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217981,
                                           "mem_param_217981") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_param_217973,
                                           "mem_param_217973") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220993,
                                           "ext_mem_220993") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220994,
                                           "ext_mem_220994") != 0)
                            return 1;
                        if (memblock_unref(ctx, &ext_mem_220995,
                                           "ext_mem_220995") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221150,
                                           "mem_out_221150") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221149,
                                           "mem_out_221149") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_out_221148,
                                           "mem_out_221148") != 0)
                            return 1;
                        ;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx, &ext_mem_220717, &mem_220319,
                                     "mem_220319") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_220716, &mem_220210,
                                     "mem_220210") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_220319, "mem_220319") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_220210, "mem_220210") != 0)
                        return 1;
                } else {
                    bool match_lit_206381 = (int64_t) 1 == d_t_203579;
                    struct memblock ext_mem_220715;
                    
                    ext_mem_220715.references = NULL;
                    
                    struct memblock ext_mem_220714;
                    
                    ext_mem_220714.references = NULL;
                    if (match_lit_206381) {
                        struct memblock mem_220479;
                        
                        mem_220479.references = NULL;
                        if (memblock_alloc(ctx, &mem_220479, bytes_217952,
                                           "mem_220479")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_220483;
                        
                        mem_220483.references = NULL;
                        if (memblock_alloc(ctx, &mem_220483, bytes_217952,
                                           "mem_220483")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_220329 = (int64_t) 8 * q_t_203576;
                        int64_t bytes_220330 = smax64((int64_t) 0,
                                                      binop_y_220329);
                        int64_t flat_tid_215007 = (int64_t) 0;
                        int32_t num_tasks_233866;
                        int64_t flat_tid_215101 = (int64_t) 0;
                        struct futhark_mc_task_236637 futhark_mc_task_236637;
                        
                        futhark_mc_task_236637.ctx = ctx;
                        futhark_mc_task_236637.free_n_203572 = n_203572;
                        futhark_mc_task_236637.free_q_t_203576 = q_t_203576;
                        futhark_mc_task_236637.free_jump_t_203582 =
                            jump_t_203582;
                        futhark_mc_task_236637.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_236637.free_t_n_m_203740 = t_n_m_203740;
                        futhark_mc_task_236637.free_i_203760 = i_203760;
                        futhark_mc_task_236637.free_mem_217415 = mem_217415;
                        futhark_mc_task_236637.free_bytes_217420 = bytes_217420;
                        futhark_mc_task_236637.free_mem_217458 = mem_217458;
                        futhark_mc_task_236637.free_mem_217461 = mem_217461;
                        futhark_mc_task_236637.free_bytes_217900 = bytes_217900;
                        futhark_mc_task_236637.free_mem_217953 = mem_217953;
                        futhark_mc_task_236637.free_mem_217957 = mem_217957;
                        futhark_mc_task_236637.free_ctx_param_ext_217984 =
                            ctx_param_ext_217984;
                        futhark_mc_task_236637.free_ctx_param_ext_217985 =
                            ctx_param_ext_217985;
                        futhark_mc_task_236637.free_ctx_param_ext_217987 =
                            ctx_param_ext_217987;
                        futhark_mc_task_236637.free_mem_param_217989 =
                            mem_param_217989.mem;
                        futhark_mc_task_236637.free_mem_219926 = mem_219926.mem;
                        futhark_mc_task_236637.free_bytes_220330 = bytes_220330;
                        futhark_mc_task_236637.free_mem_220479 = mem_220479.mem;
                        futhark_mc_task_236637.free_mem_220483 = mem_220483.mem;
                        
                        struct scheduler_segop futhark_mc_task_236637_task;
                        
                        futhark_mc_task_236637_task.args =
                            &futhark_mc_task_236637;
                        futhark_mc_task_236637_task.top_level_fn =
                            futhark_mc_segmap_task_236638;
                        futhark_mc_task_236637_task.name =
                            "futhark_mc_segmap_task_236638";
                        futhark_mc_task_236637_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_236637_task.task_time =
                            &ctx->futhark_mc_segmap_task_236638_total_time;
                        futhark_mc_task_236637_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236638_total_iter;
                        futhark_mc_task_236637_task.sched = STATIC;
                        futhark_mc_task_236637_task.nested_fn =
                            futhark_mc_segmap_nested_task_236648;
                        
                        int futhark_mc_segmap_task_236638_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236637_task);
                        
                        if (futhark_mc_segmap_task_236638_err != 0) {
                            if (memblock_unref(ctx, &mem_220483,
                                               "mem_220483") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_220479,
                                               "mem_220479") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220714,
                                               "ext_mem_220714") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220715,
                                               "ext_mem_220715") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220716,
                                               "ext_mem_220716") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220717,
                                               "ext_mem_220717") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220718,
                                               "ext_mem_220718") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220719,
                                               "ext_mem_220719") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219926,
                                               "mem_219926") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219903,
                                               "ext_mem_219903") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219879,
                                               "ext_mem_219879") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219880,
                                               "ext_mem_219880") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219313,
                                               "ext_mem_219313") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_220715, &mem_220479,
                                         "mem_220479") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_220714, &mem_220483,
                                         "mem_220483") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220483, "mem_220483") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220479, "mem_220479") != 0)
                            return 1;
                    } else {
                        struct memblock mem_220709;
                        
                        mem_220709.references = NULL;
                        if (memblock_alloc(ctx, &mem_220709, bytes_217952,
                                           "mem_220709")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_220713;
                        
                        mem_220713.references = NULL;
                        if (memblock_alloc(ctx, &mem_220713, bytes_217952,
                                           "mem_220713")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_220493 = (int64_t) 8 * q_t_203576;
                        int64_t bytes_220494 = smax64((int64_t) 0,
                                                      binop_y_220493);
                        int64_t flat_tid_215286 = (int64_t) 0;
                        int32_t num_tasks_234326;
                        int64_t flat_tid_215420 = (int64_t) 0;
                        struct futhark_mc_task_236688 futhark_mc_task_236688;
                        
                        futhark_mc_task_236688.ctx = ctx;
                        futhark_mc_task_236688.free_n_203572 = n_203572;
                        futhark_mc_task_236688.free_q_t_203576 = q_t_203576;
                        futhark_mc_task_236688.free_jump_t_203582 =
                            jump_t_203582;
                        futhark_mc_task_236688.free_partition_sizze_203667 =
                            partition_sizze_203667;
                        futhark_mc_task_236688.free_t_n_m_203740 = t_n_m_203740;
                        futhark_mc_task_236688.free_i_203760 = i_203760;
                        futhark_mc_task_236688.free_mem_217415 = mem_217415;
                        futhark_mc_task_236688.free_bytes_217420 = bytes_217420;
                        futhark_mc_task_236688.free_mem_217458 = mem_217458;
                        futhark_mc_task_236688.free_mem_217461 = mem_217461;
                        futhark_mc_task_236688.free_bytes_217900 = bytes_217900;
                        futhark_mc_task_236688.free_mem_217953 = mem_217953;
                        futhark_mc_task_236688.free_mem_217957 = mem_217957;
                        futhark_mc_task_236688.free_ctx_param_ext_217984 =
                            ctx_param_ext_217984;
                        futhark_mc_task_236688.free_ctx_param_ext_217985 =
                            ctx_param_ext_217985;
                        futhark_mc_task_236688.free_ctx_param_ext_217987 =
                            ctx_param_ext_217987;
                        futhark_mc_task_236688.free_mem_param_217989 =
                            mem_param_217989.mem;
                        futhark_mc_task_236688.free_mem_219926 = mem_219926.mem;
                        futhark_mc_task_236688.free_bytes_220494 = bytes_220494;
                        futhark_mc_task_236688.free_mem_220709 = mem_220709.mem;
                        futhark_mc_task_236688.free_mem_220713 = mem_220713.mem;
                        
                        struct scheduler_segop futhark_mc_task_236688_task;
                        
                        futhark_mc_task_236688_task.args =
                            &futhark_mc_task_236688;
                        futhark_mc_task_236688_task.top_level_fn =
                            futhark_mc_segmap_task_236689;
                        futhark_mc_task_236688_task.name =
                            "futhark_mc_segmap_task_236689";
                        futhark_mc_task_236688_task.iterations =
                            partition_sizze_203667;
                        futhark_mc_task_236688_task.task_time =
                            &ctx->futhark_mc_segmap_task_236689_total_time;
                        futhark_mc_task_236688_task.task_iter =
                            &ctx->futhark_mc_segmap_task_236689_total_iter;
                        futhark_mc_task_236688_task.sched = STATIC;
                        futhark_mc_task_236688_task.nested_fn =
                            futhark_mc_segmap_nested_task_236701;
                        
                        int futhark_mc_segmap_task_236689_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_236688_task);
                        
                        if (futhark_mc_segmap_task_236689_err != 0) {
                            if (memblock_unref(ctx, &mem_220713,
                                               "mem_220713") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_220709,
                                               "mem_220709") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220714,
                                               "ext_mem_220714") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220715,
                                               "ext_mem_220715") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220716,
                                               "ext_mem_220716") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220717,
                                               "ext_mem_220717") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220718,
                                               "ext_mem_220718") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220719,
                                               "ext_mem_220719") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_219926,
                                               "mem_219926") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219903,
                                               "ext_mem_219903") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219879,
                                               "ext_mem_219879") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219880,
                                               "ext_mem_219880") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219313,
                                               "ext_mem_219313") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219240,
                                               "ext_mem_219240") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_219241,
                                               "ext_mem_219241") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218011,
                                               "mem_param_218011") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_218003,
                                               "mem_param_218003") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220748,
                                               "ext_mem_220748") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220749,
                                               "ext_mem_220749") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217989,
                                               "mem_param_217989") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217981,
                                               "mem_param_217981") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_param_217973,
                                               "mem_param_217973") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220993,
                                               "ext_mem_220993") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220994,
                                               "ext_mem_220994") != 0)
                                return 1;
                            if (memblock_unref(ctx, &ext_mem_220995,
                                               "ext_mem_220995") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217965,
                                               "mem_217965") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_217961,
                                               "mem_217961") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221150,
                                               "mem_out_221150") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221149,
                                               "mem_out_221149") != 0)
                                return 1;
                            if (memblock_unref(ctx, &mem_out_221148,
                                               "mem_out_221148") != 0)
                                return 1;
                            ;
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &ext_mem_220715, &mem_220709,
                                         "mem_220709") != 0)
                            return 1;
                        if (memblock_set(ctx, &ext_mem_220714, &mem_220713,
                                         "mem_220713") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220713, "mem_220713") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_220709, "mem_220709") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx, &ext_mem_220717, &ext_mem_220715,
                                     "ext_mem_220715") != 0)
                        return 1;
                    if (memblock_set(ctx, &ext_mem_220716, &ext_mem_220714,
                                     "ext_mem_220714") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220714,
                                       "ext_mem_220714") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220715,
                                       "ext_mem_220715") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &ext_mem_220719, &ext_mem_220717,
                                 "ext_mem_220717") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_220718, &ext_mem_220716,
                                 "ext_mem_220716") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220716, "ext_mem_220716") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220717, "ext_mem_220717") != 0)
                    return 1;
            }
            
            struct memblock ext_mem_220742;
            
            ext_mem_220742.references = NULL;
            if (cond_204198) {
                bool zzero_206670 = jump_t_203582 == (int64_t) 0;
                bool nonzzero_206671 = !zzero_206670;
                bool nonzzero_cert_206672;
                
                if (!nonzzero_206671) {
                    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_220742,
                                       "ext_mem_220742") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220718,
                                       "ext_mem_220718") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220719,
                                       "ext_mem_220719") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219926, "mem_219926") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219903,
                                       "ext_mem_219903") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219879,
                                       "ext_mem_219879") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219880,
                                       "ext_mem_219880") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219313,
                                       "ext_mem_219313") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219240,
                                       "ext_mem_219240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219241,
                                       "ext_mem_219241") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218011,
                                       "mem_param_218011") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218003,
                                       "mem_param_218003") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220748,
                                       "ext_mem_220748") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220749,
                                       "ext_mem_220749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217989,
                                       "mem_param_217989") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217981,
                                       "mem_param_217981") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217973,
                                       "mem_param_217973") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220993,
                                       "ext_mem_220993") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220994,
                                       "ext_mem_220994") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220995,
                                       "ext_mem_220995") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221150,
                                       "mem_out_221150") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221149,
                                       "mem_out_221149") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221148,
                                       "mem_out_221148") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                int64_t y_206673 = sub64(t_n_m_203740, (int64_t) 1);
                struct memblock mem_220741;
                
                mem_220741.references = NULL;
                if (memblock_alloc(ctx, &mem_220741, bytes_217457,
                                   "mem_220741")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t flat_tid_215679 = (int64_t) 0;
                int32_t num_tasks_234974;
                int64_t flat_tid_215685 = (int64_t) 0;
                struct futhark_mc_task_236751 futhark_mc_task_236751;
                
                futhark_mc_task_236751.ctx = ctx;
                futhark_mc_task_236751.free_n_203572 = n_203572;
                futhark_mc_task_236751.free_jump_t_203582 = jump_t_203582;
                futhark_mc_task_236751.free_partition_sizze_203667 =
                    partition_sizze_203667;
                futhark_mc_task_236751.free_t_n_m_203740 = t_n_m_203740;
                futhark_mc_task_236751.free_i_203760 = i_203760;
                futhark_mc_task_236751.free_y_206673 = y_206673;
                futhark_mc_task_236751.free_bytes_217420 = bytes_217420;
                futhark_mc_task_236751.free_ext_mem_220718 = ext_mem_220718.mem;
                futhark_mc_task_236751.free_ext_mem_220719 = ext_mem_220719.mem;
                futhark_mc_task_236751.free_mem_220741 = mem_220741.mem;
                
                struct scheduler_segop futhark_mc_task_236751_task;
                
                futhark_mc_task_236751_task.args = &futhark_mc_task_236751;
                futhark_mc_task_236751_task.top_level_fn =
                    futhark_mc_segmap_task_236752;
                futhark_mc_task_236751_task.name =
                    "futhark_mc_segmap_task_236752";
                futhark_mc_task_236751_task.iterations = partition_sizze_203667;
                futhark_mc_task_236751_task.task_time =
                    &ctx->futhark_mc_segmap_task_236752_total_time;
                futhark_mc_task_236751_task.task_iter =
                    &ctx->futhark_mc_segmap_task_236752_total_iter;
                futhark_mc_task_236751_task.sched = STATIC;
                futhark_mc_task_236751_task.nested_fn =
                    futhark_mc_segmap_nested_task_236756;
                
                int futhark_mc_segmap_task_236752_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_236751_task);
                
                if (futhark_mc_segmap_task_236752_err != 0) {
                    if (memblock_unref(ctx, &mem_220741, "mem_220741") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220742,
                                       "ext_mem_220742") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220718,
                                       "ext_mem_220718") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220719,
                                       "ext_mem_220719") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219926, "mem_219926") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219903,
                                       "ext_mem_219903") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219879,
                                       "ext_mem_219879") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219880,
                                       "ext_mem_219880") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219313,
                                       "ext_mem_219313") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219240,
                                       "ext_mem_219240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219241,
                                       "ext_mem_219241") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218011,
                                       "mem_param_218011") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218003,
                                       "mem_param_218003") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220748,
                                       "ext_mem_220748") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220749,
                                       "ext_mem_220749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217989,
                                       "mem_param_217989") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217981,
                                       "mem_param_217981") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217973,
                                       "mem_param_217973") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220993,
                                       "ext_mem_220993") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220994,
                                       "ext_mem_220994") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220995,
                                       "ext_mem_220995") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221150,
                                       "mem_out_221150") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221149,
                                       "mem_out_221149") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221148,
                                       "mem_out_221148") != 0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_220742, &mem_220741,
                                 "mem_220741") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_220741, "mem_220741") != 0)
                    return 1;
            } else {
                bool dim_match_206726 = n_203572 == t_n_m_203740;
                bool empty_or_match_cert_206727;
                
                if (!dim_match_206726) {
                    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_203667, ", ",
                                  (long long) t_n_m_203740,
                                  ") cannot match shape of type `[",
                                  (long long) partition_sizze_203667, "][",
                                  (long long) n_203572, "]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_220742,
                                       "ext_mem_220742") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220718,
                                       "ext_mem_220718") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220719,
                                       "ext_mem_220719") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_219926, "mem_219926") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219903,
                                       "ext_mem_219903") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219879,
                                       "ext_mem_219879") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219880,
                                       "ext_mem_219880") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219313,
                                       "ext_mem_219313") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219240,
                                       "ext_mem_219240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_219241,
                                       "ext_mem_219241") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218011,
                                       "mem_param_218011") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_218003,
                                       "mem_param_218003") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220748,
                                       "ext_mem_220748") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220749,
                                       "ext_mem_220749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217989,
                                       "mem_param_217989") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217981,
                                       "mem_param_217981") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_217973,
                                       "mem_param_217973") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220993,
                                       "ext_mem_220993") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220994,
                                       "ext_mem_220994") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_220995,
                                       "ext_mem_220995") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221150,
                                       "mem_out_221150") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221149,
                                       "mem_out_221149") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_221148,
                                       "mem_out_221148") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_220742, &ext_mem_220719,
                                 "ext_mem_220719") != 0)
                    return 1;
            }
            if (memblock_unref(ctx, &ext_mem_220718, "ext_mem_220718") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_220719, "ext_mem_220719") != 0)
                return 1;
            
            int64_t ctx_param_ext_tmp_222912 = ext_220743;
            int64_t ctx_param_ext_tmp_222913 = ext_220743;
            struct memblock mem_param_tmp_222914;
            
            mem_param_tmp_222914.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_222914, &mem_219926,
                             "mem_219926") != 0)
                return 1;
            
            struct memblock mem_param_tmp_222915;
            
            mem_param_tmp_222915.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_222915, &ext_mem_220742,
                             "ext_mem_220742") != 0)
                return 1;
            ctx_param_ext_218005 = ctx_param_ext_tmp_222912;
            ctx_param_ext_218007 = ctx_param_ext_tmp_222913;
            if (memblock_set(ctx, &mem_param_218003, &mem_param_tmp_222914,
                             "mem_param_tmp_222914") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_218011, &mem_param_tmp_222915,
                             "mem_param_tmp_222915") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_222915,
                               "mem_param_tmp_222915") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_222914,
                               "mem_param_tmp_222914") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_220742, "ext_mem_220742") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_220718, "ext_mem_220718") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_220719, "ext_mem_220719") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_219926, "mem_219926") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219903, "ext_mem_219903") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219879, "ext_mem_219879") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219880, "ext_mem_219880") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219313, "ext_mem_219313") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219240, "ext_mem_219240") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_219241, "ext_mem_219241") != 0)
                return 1;
        }
        ext_220755 = ctx_param_ext_218005;
        ext_220753 = ctx_param_ext_218007;
        if (memblock_set(ctx, &ext_mem_220749, &mem_param_218003,
                         "mem_param_218003") != 0)
            return 1;
        if (memblock_set(ctx, &ext_mem_220748, &mem_param_218011,
                         "mem_param_218011") != 0)
            return 1;
        
        bool cond_206729 = slt64(i_outer_204282, y_204199);
        int64_t ext_220992;
        
        if (cond_206729) {
            ext_220992 = partition_sizze_203667;
        } else {
            ext_220992 = ctx_param_ext_217986;
        }
        
        int64_t ext_220991;
        
        if (cond_206729) {
            ext_220991 = n_203572;
        } else {
            ext_220991 = ctx_param_ext_217988;
        }
        
        int64_t ext_220990;
        
        if (cond_206729) {
            ext_220990 = partition_sizze_203667;
        } else {
            ext_220990 = ctx_param_ext_217982;
        }
        
        int64_t ext_220989;
        
        if (cond_206729) {
            ext_220989 = n_203572;
        } else {
            ext_220989 = ctx_param_ext_217983;
        }
        
        int64_t ext_220988;
        
        if (cond_206729) {
            ext_220988 = n_203572;
        } else {
            ext_220988 = ctx_param_ext_217985;
        }
        
        int64_t ext_220987;
        
        if (cond_206729) {
            ext_220987 = (int64_t) 1;
        } else {
            ext_220987 = ctx_param_ext_217987;
        }
        
        int64_t ext_220986;
        
        if (cond_206729) {
            ext_220986 = (int64_t) 0;
        } else {
            ext_220986 = ctx_param_ext_217984;
        }
        
        struct memblock ext_mem_220985;
        
        ext_mem_220985.references = NULL;
        if (cond_206729) {
            if (mem_220803_cached_sizze_235568 < (size_t) bytes_217457) {
                mem_220803 = realloc(mem_220803, bytes_217457);
                mem_220803_cached_sizze_235568 = bytes_217457;
            }
            if (mem_220807_cached_sizze_235569 < (size_t) bytes_217457) {
                mem_220807 = realloc(mem_220807, bytes_217457);
                mem_220807_cached_sizze_235569 = bytes_217457;
            }
            
            int64_t flat_tid_215739 = (int64_t) 0;
            int32_t num_tasks_235084;
            int64_t flat_tid_215747 = (int64_t) 0;
            struct futhark_mc_task_236764 futhark_mc_task_236764;
            
            futhark_mc_task_236764.ctx = ctx;
            futhark_mc_task_236764.free_n_203572 = n_203572;
            futhark_mc_task_236764.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236764.free_mem_217415 = mem_217415;
            futhark_mc_task_236764.free_bytes_217420 = bytes_217420;
            futhark_mc_task_236764.free_mem_217458 = mem_217458;
            futhark_mc_task_236764.free_ext_mem_220748 = ext_mem_220748.mem;
            futhark_mc_task_236764.free_ext_mem_220749 = ext_mem_220749.mem;
            futhark_mc_task_236764.free_ext_220753 = ext_220753;
            futhark_mc_task_236764.free_mem_220803 = mem_220803;
            futhark_mc_task_236764.free_mem_220807 = mem_220807;
            
            struct scheduler_segop futhark_mc_task_236764_task;
            
            futhark_mc_task_236764_task.args = &futhark_mc_task_236764;
            futhark_mc_task_236764_task.top_level_fn =
                futhark_mc_segmap_task_236765;
            futhark_mc_task_236764_task.name = "futhark_mc_segmap_task_236765";
            futhark_mc_task_236764_task.iterations = partition_sizze_203667;
            futhark_mc_task_236764_task.task_time =
                &ctx->futhark_mc_segmap_task_236765_total_time;
            futhark_mc_task_236764_task.task_iter =
                &ctx->futhark_mc_segmap_task_236765_total_iter;
            futhark_mc_task_236764_task.sched = STATIC;
            futhark_mc_task_236764_task.nested_fn =
                futhark_mc_segmap_nested_task_236770;
            
            int futhark_mc_segmap_task_236765_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236764_task);
            
            if (futhark_mc_segmap_task_236765_err != 0) {
                if (memblock_unref(ctx, &ext_mem_220985, "ext_mem_220985") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            int32_t iters_206755;
            
            if (empty_slice_204209) {
                iters_206755 = 0;
            } else {
                iters_206755 = 32;
            }
            
            bool loop_nonempty_206756 = slt32(0, iters_206755);
            bool loop_not_taken_206757 = !loop_nonempty_206756;
            bool protect_assert_disj_206758 = bounds_check_203763 ||
                 loop_not_taken_206757;
            bool index_certs_206759;
            
            if (!protect_assert_disj_206758) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) i_203760,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_220985, "ext_mem_220985") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                err = 1;
                goto cleanup;
            }
            if (mem_220953_cached_sizze_235570 < (size_t) bytes_217457) {
                mem_220953 = realloc(mem_220953, bytes_217457);
                mem_220953_cached_sizze_235570 = bytes_217457;
            }
            
            int64_t binop_y_220831 = (int64_t) 4 * n_203572;
            int64_t bytes_220832 = smax64((int64_t) 0, binop_y_220831);
            int64_t num_bytes_221138 = (int64_t) 8 * n_203572;
            int64_t num_bytes_221143 = (int64_t) 8 * n_203572;
            int64_t flat_tid_215774 = (int64_t) 0;
            int32_t num_tasks_235146;
            int64_t flat_tid_215782 = (int64_t) 0;
            struct futhark_mc_task_236783 futhark_mc_task_236783;
            
            futhark_mc_task_236783.ctx = ctx;
            futhark_mc_task_236783.free_n_203572 = n_203572;
            futhark_mc_task_236783.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236783.free_i_203760 = i_203760;
            futhark_mc_task_236783.free_iters_206755 = iters_206755;
            futhark_mc_task_236783.free_bytes_217420 = bytes_217420;
            futhark_mc_task_236783.free_mem_220803 = mem_220803;
            futhark_mc_task_236783.free_bytes_220832 = bytes_220832;
            futhark_mc_task_236783.free_mem_220953 = mem_220953;
            futhark_mc_task_236783.free_num_bytes_221138 = num_bytes_221138;
            futhark_mc_task_236783.free_num_bytes_221143 = num_bytes_221143;
            
            struct scheduler_segop futhark_mc_task_236783_task;
            
            futhark_mc_task_236783_task.args = &futhark_mc_task_236783;
            futhark_mc_task_236783_task.top_level_fn =
                futhark_mc_segmap_task_236784;
            futhark_mc_task_236783_task.name = "futhark_mc_segmap_task_236784";
            futhark_mc_task_236783_task.iterations = partition_sizze_203667;
            futhark_mc_task_236783_task.task_time =
                &ctx->futhark_mc_segmap_task_236784_total_time;
            futhark_mc_task_236783_task.task_iter =
                &ctx->futhark_mc_segmap_task_236784_total_iter;
            futhark_mc_task_236783_task.sched = STATIC;
            futhark_mc_task_236783_task.nested_fn =
                futhark_mc_segmap_nested_task_236792;
            
            int futhark_mc_segmap_task_236784_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236783_task);
            
            if (futhark_mc_segmap_task_236784_err != 0) {
                if (memblock_unref(ctx, &ext_mem_220985, "ext_mem_220985") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            bool empty_slice_206881 = j_m_i_204223 == (int64_t) 0;
            int64_t m_206882 = sub64(j_m_i_204223, (int64_t) 1);
            int64_t i_p_m_t_s_206883 = add64(stl_res_203754, m_206882);
            bool zzero_leq_i_p_m_t_s_206884 = sle64((int64_t) 0,
                                                    i_p_m_t_s_206883);
            bool i_p_m_t_s_leq_w_206885 = slt64(i_p_m_t_s_206883, n_203572);
            bool zzero_lte_i_206886 = sle64((int64_t) 0, stl_res_203754);
            bool i_lte_j_206887 = sle64(stl_res_203754, stl_res_203755);
            bool y_206888 = i_p_m_t_s_leq_w_206885 && zzero_lte_i_206886;
            bool y_206889 = zzero_leq_i_p_m_t_s_206884 && y_206888;
            bool y_206890 = i_lte_j_206887 && y_206889;
            bool forwards_ok_206891 = zzero_lte_i_206886 && y_206890;
            bool ok_or_empty_206892 = empty_slice_206881 || forwards_ok_206891;
            bool index_certs_206893;
            
            if (!ok_or_empty_206892) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) stl_res_203754, ":",
                              (long long) stl_res_203755,
                              "] out of bounds for array of shape [",
                              (long long) n_203572, "].",
                              "-> #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_220985, "ext_mem_220985") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                err = 1;
                goto cleanup;
            }
            if (mem_220956_cached_sizze_235571 < (size_t) bytes_217460) {
                mem_220956 = realloc(mem_220956, bytes_217460);
                mem_220956_cached_sizze_235571 = bytes_217460;
            }
            if (mem_220959_cached_sizze_235572 < (size_t) bytes_217460) {
                mem_220959 = realloc(mem_220959, bytes_217460);
                mem_220959_cached_sizze_235572 = bytes_217460;
            }
            if (mem_220962_cached_sizze_235573 < (size_t) bytes_217460) {
                mem_220962 = realloc(mem_220962, bytes_217460);
                mem_220962_cached_sizze_235573 = bytes_217460;
            }
            
            int64_t flat_tid_215878 = (int64_t) 0;
            int32_t num_tasks_235432;
            int64_t flat_tid_215884 = (int64_t) 0;
            struct futhark_mc_task_236814 futhark_mc_task_236814;
            
            futhark_mc_task_236814.ctx = ctx;
            futhark_mc_task_236814.free_n_203572 = n_203572;
            futhark_mc_task_236814.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236814.free_stl_res_203754 = stl_res_203754;
            futhark_mc_task_236814.free_j_m_i_204223 = j_m_i_204223;
            futhark_mc_task_236814.free_mem_220953 = mem_220953;
            futhark_mc_task_236814.free_mem_220956 = mem_220956;
            futhark_mc_task_236814.free_mem_220959 = mem_220959;
            futhark_mc_task_236814.free_mem_220962 = mem_220962;
            
            struct scheduler_segop futhark_mc_task_236814_task;
            
            futhark_mc_task_236814_task.args = &futhark_mc_task_236814;
            futhark_mc_task_236814_task.top_level_fn =
                futhark_mc_segmap_task_236815;
            futhark_mc_task_236814_task.name = "futhark_mc_segmap_task_236815";
            futhark_mc_task_236814_task.iterations = partition_sizze_203667;
            futhark_mc_task_236814_task.task_time =
                &ctx->futhark_mc_segmap_task_236815_total_time;
            futhark_mc_task_236814_task.task_iter =
                &ctx->futhark_mc_segmap_task_236815_total_iter;
            futhark_mc_task_236814_task.sched = STATIC;
            futhark_mc_task_236814_task.nested_fn =
                futhark_mc_segmap_nested_task_236818;
            
            int futhark_mc_segmap_task_236815_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236814_task);
            
            if (futhark_mc_segmap_task_236815_err != 0) {
                if (memblock_unref(ctx, &ext_mem_220985, "ext_mem_220985") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            
            struct memblock mem_220984;
            
            mem_220984.references = NULL;
            if (memblock_alloc(ctx, &mem_220984, bytes_217457, "mem_220984")) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_215897 = (int64_t) 0;
            int32_t num_tasks_235461;
            int64_t flat_tid_215903 = (int64_t) 0;
            struct futhark_mc_task_236826 futhark_mc_task_236826;
            
            futhark_mc_task_236826.ctx = ctx;
            futhark_mc_task_236826.free_n_203572 = n_203572;
            futhark_mc_task_236826.free_partition_sizze_203667 =
                partition_sizze_203667;
            futhark_mc_task_236826.free_bytes_217420 = bytes_217420;
            futhark_mc_task_236826.free_mem_220807 = mem_220807;
            futhark_mc_task_236826.free_mem_220956 = mem_220956;
            futhark_mc_task_236826.free_mem_220959 = mem_220959;
            futhark_mc_task_236826.free_mem_220962 = mem_220962;
            futhark_mc_task_236826.free_mem_220984 = mem_220984.mem;
            
            struct scheduler_segop futhark_mc_task_236826_task;
            
            futhark_mc_task_236826_task.args = &futhark_mc_task_236826;
            futhark_mc_task_236826_task.top_level_fn =
                futhark_mc_segmap_task_236827;
            futhark_mc_task_236826_task.name = "futhark_mc_segmap_task_236827";
            futhark_mc_task_236826_task.iterations = partition_sizze_203667;
            futhark_mc_task_236826_task.task_time =
                &ctx->futhark_mc_segmap_task_236827_total_time;
            futhark_mc_task_236826_task.task_iter =
                &ctx->futhark_mc_segmap_task_236827_total_iter;
            futhark_mc_task_236826_task.sched = STATIC;
            futhark_mc_task_236826_task.nested_fn =
                futhark_mc_segmap_nested_task_236831;
            
            int futhark_mc_segmap_task_236827_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_236826_task);
            
            if (futhark_mc_segmap_task_236827_err != 0) {
                if (memblock_unref(ctx, &mem_220984, "mem_220984") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220985, "ext_mem_220985") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218011,
                                   "mem_param_218011") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_218003,
                                   "mem_param_218003") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217989,
                                   "mem_param_217989") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217981,
                                   "mem_param_217981") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_217973,
                                   "mem_param_217973") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            if (memblock_set(ctx, &ext_mem_220985, &mem_220984, "mem_220984") !=
                0)
                return 1;
            if (memblock_unref(ctx, &mem_220984, "mem_220984") != 0)
                return 1;
        } else {
            if (memblock_set(ctx, &ext_mem_220985, &mem_param_217989,
                             "mem_param_217989") != 0)
                return 1;
        }
        
        int64_t ctx_param_ext_tmp_222897 = ext_220755;
        int64_t ctx_param_ext_tmp_222898 = ext_220753;
        int64_t ctx_param_ext_tmp_222899 = ext_220990;
        int64_t ctx_param_ext_tmp_222900 = ext_220989;
        int64_t ctx_param_ext_tmp_222901 = ext_220986;
        int64_t ctx_param_ext_tmp_222902 = ext_220988;
        int64_t ctx_param_ext_tmp_222903 = ext_220992;
        int64_t ctx_param_ext_tmp_222904 = ext_220987;
        int64_t ctx_param_ext_tmp_222905 = ext_220991;
        struct memblock mem_param_tmp_222906;
        
        mem_param_tmp_222906.references = NULL;
        if (memblock_set(ctx, &mem_param_tmp_222906, &ext_mem_220749,
                         "ext_mem_220749") != 0)
            return 1;
        
        struct memblock mem_param_tmp_222907;
        
        mem_param_tmp_222907.references = NULL;
        if (memblock_set(ctx, &mem_param_tmp_222907, &ext_mem_220748,
                         "ext_mem_220748") != 0)
            return 1;
        
        struct memblock mem_param_tmp_222908;
        
        mem_param_tmp_222908.references = NULL;
        if (memblock_set(ctx, &mem_param_tmp_222908, &ext_mem_220985,
                         "ext_mem_220985") != 0)
            return 1;
        ctx_param_ext_217975 = ctx_param_ext_tmp_222897;
        ctx_param_ext_217977 = ctx_param_ext_tmp_222898;
        ctx_param_ext_217982 = ctx_param_ext_tmp_222899;
        ctx_param_ext_217983 = ctx_param_ext_tmp_222900;
        ctx_param_ext_217984 = ctx_param_ext_tmp_222901;
        ctx_param_ext_217985 = ctx_param_ext_tmp_222902;
        ctx_param_ext_217986 = ctx_param_ext_tmp_222903;
        ctx_param_ext_217987 = ctx_param_ext_tmp_222904;
        ctx_param_ext_217988 = ctx_param_ext_tmp_222905;
        if (memblock_set(ctx, &mem_param_217973, &mem_param_tmp_222906,
                         "mem_param_tmp_222906") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_217981, &mem_param_tmp_222907,
                         "mem_param_tmp_222907") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_217989, &mem_param_tmp_222908,
                         "mem_param_tmp_222908") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_tmp_222908,
                           "mem_param_tmp_222908") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_tmp_222907,
                           "mem_param_tmp_222907") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_tmp_222906,
                           "mem_param_tmp_222906") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220985, "ext_mem_220985") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_218011, "mem_param_218011") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_218003, "mem_param_218003") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220748, "ext_mem_220748") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220749, "ext_mem_220749") != 0)
            return 1;
    }
    ext_221008 = ctx_param_ext_217975;
    ext_221006 = ctx_param_ext_217977;
    ext_221002 = ctx_param_ext_217982;
    ext_221001 = ctx_param_ext_217983;
    ext_221000 = ctx_param_ext_217984;
    ext_220999 = ctx_param_ext_217985;
    ext_220998 = ctx_param_ext_217986;
    ext_220997 = ctx_param_ext_217987;
    ext_220996 = ctx_param_ext_217988;
    if (memblock_set(ctx, &ext_mem_220995, &mem_param_217973,
                     "mem_param_217973") != 0)
        return 1;
    if (memblock_set(ctx, &ext_mem_220994, &mem_param_217981,
                     "mem_param_217981") != 0)
        return 1;
    if (memblock_set(ctx, &ext_mem_220993, &mem_param_217989,
                     "mem_param_217989") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
        return 1;
    
    struct memblock mem_221020;
    
    mem_221020.references = NULL;
    if (memblock_alloc(ctx, &mem_221020, bytes_217414, "mem_221020")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_235518 = 0; i_235518 < m_203571; i_235518++) {
        for (int64_t i_235519 = 0; i_235519 < n_203572; i_235519++) {
            ((double *) mem_221020.mem)[i_235518 * n_203572 + i_235519] = NAN;
        }
    }
    
    struct memblock mem_221024;
    
    mem_221024.references = NULL;
    if (memblock_alloc(ctx, &mem_221024, bytes_217414, "mem_221024")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_235520 = 0; i_235520 < m_203571; i_235520++) {
        for (int64_t i_235521 = 0; i_235521 < n_203572; i_235521++) {
            ((double *) mem_221024.mem)[i_235520 * n_203572 + i_235521] = NAN;
        }
    }
    
    struct memblock mem_221028;
    
    mem_221028.references = NULL;
    if (memblock_alloc(ctx, &mem_221028, bytes_217414, "mem_221028")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_235522 = 0; i_235522 < m_203571; i_235522++) {
        for (int64_t i_235523 = 0; i_235523 < n_203572; i_235523++) {
            ((double *) mem_221028.mem)[i_235522 * n_203572 + i_235523] = NAN;
        }
    }
    
    int64_t flat_tid_215929 = (int64_t) 0;
    int32_t num_tasks_235524;
    struct futhark_mc_task_236839 futhark_mc_task_236839;
    
    futhark_mc_task_236839.ctx = ctx;
    futhark_mc_task_236839.free_m_203571 = m_203571;
    futhark_mc_task_236839.free_n_203572 = n_203572;
    futhark_mc_task_236839.free_partition_sizze_203667 = partition_sizze_203667;
    futhark_mc_task_236839.free_mem_217415 = mem_217415;
    futhark_mc_task_236839.free_mem_217418 = mem_217418;
    futhark_mc_task_236839.free_bytes_217420 = bytes_217420;
    futhark_mc_task_236839.free_ext_mem_220994 = ext_mem_220994.mem;
    futhark_mc_task_236839.free_ext_mem_220995 = ext_mem_220995.mem;
    futhark_mc_task_236839.free_ext_221006 = ext_221006;
    futhark_mc_task_236839.free_mem_221020 = mem_221020.mem;
    futhark_mc_task_236839.free_mem_221024 = mem_221024.mem;
    futhark_mc_task_236839.free_mem_221028 = mem_221028.mem;
    
    struct scheduler_segop futhark_mc_task_236839_task;
    
    futhark_mc_task_236839_task.args = &futhark_mc_task_236839;
    futhark_mc_task_236839_task.top_level_fn = futhark_mc_segmap_task_236840;
    futhark_mc_task_236839_task.name = "futhark_mc_segmap_task_236840";
    futhark_mc_task_236839_task.iterations = partition_sizze_203667;
    futhark_mc_task_236839_task.task_time =
        &ctx->futhark_mc_segmap_task_236840_total_time;
    futhark_mc_task_236839_task.task_iter =
        &ctx->futhark_mc_segmap_task_236840_total_iter;
    futhark_mc_task_236839_task.sched = STATIC;
    futhark_mc_task_236839_task.nested_fn = NULL;
    
    int futhark_mc_segmap_task_236840_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_236839_task);
    
    if (futhark_mc_segmap_task_236840_err != 0) {
        if (memblock_unref(ctx, &mem_221028, "mem_221028") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_221024, "mem_221024") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_221020, "mem_221020") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_217989, "mem_param_217989") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_217981, "mem_param_217981") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_217973, "mem_param_217973") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
            return 1;
        ;
        err = 1;
        goto cleanup;
    }
    if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
        return 1;
    if (memblock_set(ctx, &mem_out_221148, &mem_221020, "mem_221020") != 0)
        return 1;
    if (memblock_set(ctx, &mem_out_221149, &mem_221024, "mem_221024") != 0)
        return 1;
    if (memblock_set(ctx, &mem_out_221150, &mem_221028, "mem_221028") != 0)
        return 1;
    (*mem_out_p_235539).references = NULL;
    if (memblock_set(ctx, &*mem_out_p_235539, &mem_out_221148,
                     "mem_out_221148") != 0)
        return 1;
    (*mem_out_p_235540).references = NULL;
    if (memblock_set(ctx, &*mem_out_p_235540, &mem_out_221149,
                     "mem_out_221149") != 0)
        return 1;
    (*mem_out_p_235541).references = NULL;
    if (memblock_set(ctx, &*mem_out_p_235541, &mem_out_221150,
                     "mem_out_221150") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_221028, "mem_221028") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_221024, "mem_221024") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_221020, "mem_221020") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_217989, "mem_param_217989") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_217981, "mem_param_217981") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_217973, "mem_param_217973") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220993, "ext_mem_220993") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220994, "ext_mem_220994") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_220995, "ext_mem_220995") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_217965, "mem_217965") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_217961, "mem_217961") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_out_221150, "mem_out_221150") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_out_221149, "mem_out_221149") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_out_221148, "mem_out_221148") != 0)
        return 1;
    
  cleanup:
    { }
    free(mem_217406);
    free(mem_217409);
    free(mem_217411);
    free(mem_217415);
    free(mem_217418);
    free(mem_217458);
    free(mem_217461);
    free(mem_217532);
    free(mem_217654);
    free(mem_217658);
    free(mem_217828);
    free(mem_217833);
    free(mem_217891);
    free(mem_217895);
    free(mem_217953);
    free(mem_217957);
    free(mem_218033);
    free(mem_218170);
    free(mem_218175);
    free(mem_219336);
    free(mem_219339);
    free(mem_219361);
    free(mem_219364);
    free(mem_219386);
    free(mem_219389);
    free(mem_219411);
    free(mem_220803);
    free(mem_220807);
    free(mem_220953);
    free(mem_220956);
    free(mem_220959);
    free(mem_220962);
    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_217387;
    
    Y_mem_217387.references = NULL;
    
    int64_t m_203571;
    int64_t n_203572;
    int64_t n_p_203574;
    int64_t q_s_203575;
    int64_t q_t_203576;
    int64_t q_l_203577;
    int64_t d_s_203578;
    int64_t d_t_203579;
    int64_t d_l_203580;
    int64_t jump_s_203581;
    int64_t jump_t_203582;
    int64_t jump_l_203583;
    int64_t n_inner_203584;
    int64_t n_outer_203585;
    int64_t jump_threshold_203586;
    int64_t q_threshold_203587;
    struct memblock mem_out_221148;
    
    mem_out_221148.references = NULL;
    
    struct memblock mem_out_221149;
    
    mem_out_221149.references = NULL;
    
    struct memblock mem_out_221150;
    
    mem_out_221150.references = NULL;
    
    int ret = 0;
    
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    Y_mem_217387 = in0->mem;
    m_203571 = in0->shape[0];
    n_203572 = in0->shape[1];
    n_p_203574 = in1;
    q_s_203575 = in2;
    q_t_203576 = in3;
    q_l_203577 = in4;
    d_s_203578 = in5;
    d_t_203579 = in6;
    d_l_203580 = in7;
    jump_s_203581 = in8;
    jump_t_203582 = in9;
    jump_l_203583 = in10;
    n_inner_203584 = in11;
    n_outer_203585 = in12;
    jump_threshold_203586 = in13;
    q_threshold_203587 = in14;
    if (!(m_203571 == in0->shape[0] && n_203572 == 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_221148, &mem_out_221149,
                                &mem_out_221150, Y_mem_217387, m_203571,
                                n_203572, n_p_203574, q_s_203575, q_t_203576,
                                q_l_203577, d_s_203578, d_t_203579, d_l_203580,
                                jump_s_203581, jump_t_203582, jump_l_203583,
                                n_inner_203584, n_outer_203585,
                                jump_threshold_203586, q_threshold_203587);
        if (ret == 0) {
            assert((*out0 =
                    (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d))) !=
                NULL);
            (*out0)->mem = mem_out_221148;
            (*out0)->shape[0] = m_203571;
            (*out0)->shape[1] = n_203572;
            assert((*out1 =
                    (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d))) !=
                NULL);
            (*out1)->mem = mem_out_221149;
            (*out1)->shape[0] = m_203571;
            (*out1)->shape[1] = n_203572;
            assert((*out2 =
                    (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d))) !=
                NULL);
            (*out2)->mem = mem_out_221150;
            (*out2)->shape[0] = m_203571;
            (*out2)->shape[1] = n_203572;
        }
    }
    lock_unlock(&ctx->lock);
    return ret;
}
  
